Rename Guard::Dsl.revaluate_guardfile to Guard::Dsl.reevaludate_guardfile

This commit is contained in:
Rémy Coutable 2011-07-29 00:22:53 +02:00
parent 48057cb6c8
commit 1481604411
4 changed files with 7 additions and 5 deletions

View File

@ -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.

View File

@ -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

View File

@ -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]}."

View File

@ -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