From 64449acbc90c23adc36cdb202398cc7af6f91677 Mon Sep 17 00:00:00 2001 From: Robert Coleman Date: Tue, 26 Nov 2013 12:48:21 +1300 Subject: [PATCH 1/6] parse fullpath for ignore --- lib/rack/livereload/processing_skip_analyzer.rb | 3 ++- .../livereload/processing_skip_analyzer_spec.rb | 13 ++++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/rack/livereload/processing_skip_analyzer.rb b/lib/rack/livereload/processing_skip_analyzer.rb index ba6ae63..ec2b654 100644 --- a/lib/rack/livereload/processing_skip_analyzer.rb +++ b/lib/rack/livereload/processing_skip_analyzer.rb @@ -28,7 +28,8 @@ module Rack end def ignored? - @options[:ignore] and @options[:ignore].any? { |filter| @env['PATH_INFO'][filter] } + path = @env['QUERY_STRING'].empty? ? @env['PATH_INFO'] : "#{@env['PATH_INFO']}?#{@env['QUERY_STRING']}" + @options[:ignore] and @options[:ignore].any? { |filter| path[filter] } end def bad_browser? diff --git a/spec/rack/livereload/processing_skip_analyzer_spec.rb b/spec/rack/livereload/processing_skip_analyzer_spec.rb index e1c856e..600e386 100644 --- a/spec/rack/livereload/processing_skip_analyzer_spec.rb +++ b/spec/rack/livereload/processing_skip_analyzer_spec.rb @@ -22,13 +22,13 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do let(:options) { { :ignore => [ %r{file} ] } } context 'path contains ignore pattern' do - let(:env) { { 'PATH_INFO' => '/this/file' } } + let(:env) { { 'PATH_INFO' => '/this/file', 'QUERY_STRING' => '' } } it { should be_ignored } end context 'root path' do - let(:env) { { 'PATH_INFO' => '/' } } + let(:env) { { 'PATH_INFO' => '/', 'QUERY_STRING' => '' } } it { should_not be_ignored } end @@ -56,7 +56,8 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do describe '#ignored?' do let(:path_info) { 'path info' } - let(:env) { { 'PATH_INFO' => path_info } } + let(:query_string) { 'query_string' } + let(:env) { { 'PATH_INFO' => path_info, 'QUERY_STRING' => query_string } } context 'no ignore set' do it { should_not be_ignored } @@ -67,6 +68,12 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do it { should be_ignored } end + + context 'ignore set including query_string' do + let(:options) { { :ignore => [ %r{#{path_info}\?#{query_string}} ] } } + + it { should be_ignored } + end end describe '#bad_browser?' do -- 2.40.1 From 9a4316ce37ea8c8efa9a9807e1aa6ef5102865cf Mon Sep 17 00:00:00 2001 From: Payam Moghaddam Date: Sat, 11 Oct 2014 22:09:22 -0700 Subject: [PATCH 2/6] Update middleware order to resolve flash.keep issue and unnecessary logging --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4e0e19..f6d9307 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Then add the middleware to your Rails middleware stack by editing your `config/e MyApp::Application.configure do # Add Rack::LiveReload to the bottom of the middleware stack with the default options. - config.middleware.use Rack::LiveReload + config.middleware.insert_after ActionDispatch::Static, Rack::LiveReload # ... end -- 2.40.1 From e7cbf825d9806115119477c8c84712069afa7909 Mon Sep 17 00:00:00 2001 From: Chris Kelly Date: Tue, 10 Feb 2015 14:29:15 -0800 Subject: [PATCH 3/6] Fix link to livereload.com --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e4e0e19..2d360eb 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Code Climate](https://codeclimate.com/github/johnbintz/rack-livereload.png)](https://codeclimate.com/github/johnbintz/rack-livereload) -Hey, you've got [LiveReload](http://www.livereload.com/) in my [Rack](http://rack.rubyforge.org/)! +Hey, you've got [LiveReload](http://livereload.com/) in my [Rack](http://rack.rubyforge.org/)! No need for browser extensions anymore! Just plug it in your middleware stack and go! Even supports browsers without WebSockets! -- 2.40.1 From ef3895cbcf3c2c8391a88952198168b4c4eaab41 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 3 Jul 2015 09:31:46 -0400 Subject: [PATCH 4/6] No one uses 1.8.7 or 1.9.2 anymore. Sorry, folks. --- .travis.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3209843..11a3815 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,4 @@ rvm: - - 1.8.7 - - 1.9.2 - 1.9.3 - 2.0.0 branches: @@ -11,9 +9,4 @@ gemfile: - gemfiles/rails31.gemfile - gemfiles/rails32.gemfile - gemfiles/rails40.gemfile -matrix: - exclude: - - rvm: 1.8.7 - gemfile: gemfiles/rails40.gemfile - - rvm: 1.9.2 - gemfile: gemfiles/rails40.gemfile + -- 2.40.1 From d06a756c8d79f0095474337bf65c16a3f94b841e Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 3 Jul 2015 12:20:54 -0400 Subject: [PATCH 5/6] RSpec modernization fixes. --- spec/rack/livereload/body_processor_spec.rb | 2 +- spec/rack/livereload/processing_skip_analyzer_spec.rb | 2 +- spec/rack/livereload_spec.rb | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/spec/rack/livereload/body_processor_spec.rb b/spec/rack/livereload/body_processor_spec.rb index fad68b6..331471c 100644 --- a/spec/rack/livereload/body_processor_spec.rb +++ b/spec/rack/livereload/body_processor_spec.rb @@ -15,7 +15,7 @@ describe Rack::LiveReload::BodyProcessor do end it 'responds false when no head tag' do - regex.match("
").should be_false + regex.match("
").should be_falsey end end diff --git a/spec/rack/livereload/processing_skip_analyzer_spec.rb b/spec/rack/livereload/processing_skip_analyzer_spec.rb index e1c856e..bc28426 100644 --- a/spec/rack/livereload/processing_skip_analyzer_spec.rb +++ b/spec/rack/livereload/processing_skip_analyzer_spec.rb @@ -14,7 +14,7 @@ describe Rack::LiveReload::ProcessingSkipAnalyzer do describe '#skip_processing?' do it "should skip processing" do - subject.skip_processing?.should be_true + subject.skip_processing?.should be_truthy end end diff --git a/spec/rack/livereload_spec.rb b/spec/rack/livereload_spec.rb index d955ab5..9322706 100644 --- a/spec/rack/livereload_spec.rb +++ b/spec/rack/livereload_spec.rb @@ -7,7 +7,9 @@ describe Rack::LiveReload do subject { middleware } - its(:app) { should == app } + it 'should be an app' do + middleware.app.should be == app + end let(:env) { {} } let(:options) { {} } @@ -20,7 +22,7 @@ describe Rack::LiveReload do end it 'should return the js file' do - middleware._call(env).should be_true + middleware._call(env).should be_truthy end end end -- 2.40.1 From ffa5d63ffc1eb45634fc855f0ef12ec64edbda54 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 3 Jul 2015 12:28:20 -0400 Subject: [PATCH 6/6] Trim a little more out of the tests. --- .travis.yml | 2 -- Appraisals | 8 -------- gemfiles/rails30.gemfile | 7 ------- gemfiles/rails31.gemfile | 7 ------- 4 files changed, 24 deletions(-) delete mode 100644 gemfiles/rails30.gemfile delete mode 100644 gemfiles/rails31.gemfile diff --git a/.travis.yml b/.travis.yml index 11a3815..f00aa31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,8 +5,6 @@ branches: only: - master gemfile: - - gemfiles/rails30.gemfile - - gemfiles/rails31.gemfile - gemfiles/rails32.gemfile - gemfiles/rails40.gemfile diff --git a/Appraisals b/Appraisals index e80ed07..2e0bfb2 100644 --- a/Appraisals +++ b/Appraisals @@ -1,11 +1,3 @@ -appraise 'rails30' do - gem 'rails', '~> 3.0.0' -end - -appraise 'rails31' do - gem 'rails', '~> 3.1.0' -end - appraise 'rails32' do gem 'rails', '~> 3.2.0' end diff --git a/gemfiles/rails30.gemfile b/gemfiles/rails30.gemfile deleted file mode 100644 index eaf7f8d..0000000 --- a/gemfiles/rails30.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "~> 3.0.0" - -gemspec :path=>"../" \ No newline at end of file diff --git a/gemfiles/rails31.gemfile b/gemfiles/rails31.gemfile deleted file mode 100644 index 5a7622b..0000000 --- a/gemfiles/rails31.gemfile +++ /dev/null @@ -1,7 +0,0 @@ -# This file was generated by Appraisal - -source "http://rubygems.org" - -gem "rails", "~> 3.1.0" - -gemspec :path=>"../" \ No newline at end of file -- 2.40.1