diff --git a/lib/rack/livereload/body_processor.rb b/lib/rack/livereload/body_processor.rb index c5fc029..234a028 100644 --- a/lib/rack/livereload/body_processor.rb +++ b/lib/rack/livereload/body_processor.rb @@ -4,7 +4,6 @@ module Rack class LiveReload class BodyProcessor LIVERELOAD_JS_PATH = '/__rack/livereload.js' - HEAD_TAG_REGEX = /
|/ LIVERELOAD_PORT = 35729 attr_reader :content_length, :new_body, :livereload_added @@ -63,22 +62,20 @@ module Rack def process!(env) @env = env @body.close if @body.respond_to?(:close) + @string_body = '' ; @body.each { |line| @string_body += line.to_s } - @new_body = [] ; @body.each { |line| @new_body << line.to_s } - - @content_length = 0 - @livereload_added = false - - @new_body.each do |line| - if !@livereload_added && line[' 0 + + @processed = true + @new_body = [@string_body] end def app_root diff --git a/rack-livereload.gemspec b/rack-livereload.gemspec index 3e41bd2..6b17ea3 100644 --- a/rack-livereload.gemspec +++ b/rack-livereload.gemspec @@ -21,6 +21,7 @@ Gem::Specification.new do |s| # specify any dependencies here; for example: s.add_development_dependency "rspec" + s.add_development_dependency "rspec-its" s.add_development_dependency "cucumber" s.add_development_dependency "httparty" s.add_development_dependency "sinatra" diff --git a/spec/rack/livereload/body_processor_spec.rb b/spec/rack/livereload/body_processor_spec.rb index fad68b6..478eb53 100644 --- a/spec/rack/livereload/body_processor_spec.rb +++ b/spec/rack/livereload/body_processor_spec.rb @@ -2,23 +2,6 @@ require 'spec_helper' require 'nokogiri' describe Rack::LiveReload::BodyProcessor do - describe 'head tag regex' do - let(:regex) { described_class::HEAD_TAG_REGEX } - subject { regex } - - it { should be_kind_of(Regexp) } - - it 'only picks a valid tag' do - regex.match("").to_s.should eq('') - regex.match("