diff --git a/CHANGELOG.md b/CHANGELOG.md index a8a702a..d72d6db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ## Improvements +- `Guard::Dsl.revaluate_guardfile` has been renamed to `Guard::Dsl.reevaluate_guardfile`. ([@rymai][]) - New CLI options: ([@nestegg][]) - `watchdir`/`-w` to specify the directory in which Guard should watch for changes, - `guardfile`/`-G` to specify an alternate location for the Guardfile to use. diff --git a/lib/guard.rb b/lib/guard.rb index 024ac02..ae6b8fb 100644 --- a/lib/guard.rb +++ b/lib/guard.rb @@ -19,18 +19,18 @@ module Guard @options[:notify] && ENV["GUARD_NOTIFY"] != 'false' ? Notifier.turn_on : Notifier.turn_off + UI.clear if @options[:clear] self end def start(options = {}) - UI.clear if options[:clear] setup(options) Interactor.init_signal_traps Dsl.evaluate_guardfile(options) listener.on_change do |files| - Dsl.revaluate_guardfile if Watcher.match_guardfile?(files) + Dsl.reevaluate_guardfile if Watcher.match_guardfile?(files) run { run_on_change_for_all_guards(files) } if Watcher.match_files?(guards, files) end diff --git a/lib/guard/dsl.rb b/lib/guard/dsl.rb index 59a2950..dc39f28 100644 --- a/lib/guard/dsl.rb +++ b/lib/guard/dsl.rb @@ -12,7 +12,7 @@ module Guard UI.error "No guards found in Guardfile, please add at least one." if !::Guard.guards.nil? && ::Guard.guards.empty? end - def revaluate_guardfile + def reevaluate_guardfile ::Guard.guards.clear Dsl.evaluate_guardfile(@@options) msg = "Guardfile has been re-evaluated." @@ -50,6 +50,7 @@ module Guard @@options[:guardfile_path] = 'Inline Guardfile' elsif @@options.has_key?(:guardfile) + UI.debug File.exist?(@@options[:guardfile]) if File.exist?(@@options[:guardfile]) read_guardfile(@@options[:guardfile]) UI.info "Using Guardfile at #{@@options[:guardfile]}." diff --git a/spec/guard/dsl_spec.rb b/spec/guard/dsl_spec.rb index 65a24ca..83c2f68 100644 --- a/spec/guard/dsl_spec.rb +++ b/spec/guard/dsl_spec.rb @@ -127,7 +127,7 @@ describe Guard::Dsl do lambda { subject.evaluate_guardfile(:guardfile_contents => invalid_guardfile_string ) }.should raise_error end - describe ".revaluate_guardfile" do + describe ".reevaluate_guardfile" do before(:each) { ::Guard::Dsl.stub!(:instance_eval_guardfile) } it "resets already definded guards before calling evaluate_guardfile" do @@ -135,7 +135,7 @@ describe Guard::Dsl do subject.evaluate_guardfile(:guardfile_contents => invalid_guardfile_string) ::Guard.guards.should_not be_empty ::Guard::Dsl.should_receive(:evaluate_guardfile) - subject.revaluate_guardfile + subject.reevaluate_guardfile ::Guard.guards.should be_empty end end