From 3ac650799c790a613f04d64308133430444eb320 Mon Sep 17 00:00:00 2001 From: Tim Preston Date: Mon, 17 Oct 2011 14:33:27 +1100 Subject: [PATCH] Swapped run_all for reload. This means hitting return will not reload rails server, instead 'r' or 'reload' must be issued. --- .gitignore | 1 + lib/guard/rails.rb | 8 +++----- spec/lib/guard/rails_spec.rb | 16 ++++++++-------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 4040c6c..466c187 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ .bundle Gemfile.lock pkg/* +.rvmrc diff --git a/lib/guard/rails.rb b/lib/guard/rails.rb index ff5caec..fcdd3f4 100644 --- a/lib/guard/rails.rb +++ b/lib/guard/rails.rb @@ -26,10 +26,10 @@ module Guard def start server = options[:server] ? "#{options[:server]} and " : "" UI.info "Guard::Rails will now restart your app on port #{options[:port]} using #{server}#{options[:environment]} environment." - run_all if options[:start_on_start] + reload if options[:start_on_start] end - def run_all + def reload UI.info "Restarting Rails..." Notifier.notify("Rails restarting on port #{options[:port]} in #{options[:environment]} environment...", :title => "Restarting Rails...", :image => :pending) if runner.restart @@ -41,15 +41,13 @@ module Guard end end - alias :reload :run_all - def stop Notifier.notify("Until next time...", :title => "Rails shutting down.", :image => :pending) runner.stop end def run_on_change(paths) - run_all + reload end end end diff --git a/spec/lib/guard/rails_spec.rb b/spec/lib/guard/rails_spec.rb index 569e866..6cf9257 100644 --- a/spec/lib/guard/rails_spec.rb +++ b/spec/lib/guard/rails_spec.rb @@ -19,7 +19,7 @@ describe Guard::Rails do context 'start on start' do it "should show the right message and run startup" do - guard.expects(:run_all).once + guard.expects(:reload).once ui_expectation guard.start end @@ -29,14 +29,14 @@ describe Guard::Rails do let(:options) { { :start_on_start => false } } it "should show the right message and not run startup" do - guard.expects(:run_all).never + guard.expects(:reload).never ui_expectation guard.start end end end - describe '#run_all' do + describe '#reload' do let(:pid) { '12345' } before do @@ -56,7 +56,7 @@ describe Guard::Rails do Guard::UI.expects(:info).with(regexp_matches(/#{pid}/)) Guard::Notifier.expects(:notify).with(regexp_matches(/Rails restarted/), has_entry(:image => :success)) - guard.run_all + guard.reload end end @@ -70,11 +70,11 @@ describe Guard::Rails do Guard::UI.expects(:info).with(regexp_matches(/Rails NOT restarted/)) Guard::Notifier.expects(:notify).with(regexp_matches(/Rails NOT restarted/), has_entry(:image => :failed)) - guard.run_all + guard.reload end end end - + describe '#stop' do it "should stop correctly" do Guard::Notifier.expects(:notify).with('Until next time...', anything) @@ -83,8 +83,8 @@ describe Guard::Rails do end describe '#run_on_change' do - it "should run on change" do - guard.expects(:run_all).once + it "should reload on change" do + guard.expects(:reload).once guard.run_on_change([]) end end -- 2.40.1