diff --git a/Guardfile b/Guardfile index 7cd30ab..826ffb6 100644 --- a/Guardfile +++ b/Guardfile @@ -1,4 +1,4 @@ -guard :rspec, :version => 2, :keep_failed => false, :cli => '-f doc' do +guard 'rspec', :version => 2, :keep_failed => false, :cli => '-f doc' do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } watch('spec/spec_helper.rb') { "spec" } diff --git a/lib/guard.rb b/lib/guard.rb index a297f12..8923320 100644 --- a/lib/guard.rb +++ b/lib/guard.rb @@ -35,7 +35,7 @@ module Guard run { run_on_change_for_all_guards(files) } if Watcher.match_files?(guards, files) end - UI.info "Guard is now watching at '#{Dir.pwd}'" + UI.info "Guard is now watching at '#{listener.directory}'" guards.each { |guard| supervised_task(guard, :start) } listener.start end @@ -50,7 +50,7 @@ module Guard end # Reparse the whole directory to catch new files modified during the guards run - new_modified_files = listener.modified_files([Dir.pwd], :all => true) + new_modified_files = listener.modified_files([listener.directory], :all => true) if !new_modified_files.empty? && Watcher.match_files?(guards, new_modified_files) run { run_on_change_for_all_guards(new_modified_files) } end diff --git a/lib/guard/listener.rb b/lib/guard/listener.rb index ae8b07a..1a8eeaf 100644 --- a/lib/guard/listener.rb +++ b/lib/guard/listener.rb @@ -9,6 +9,8 @@ module Guard autoload :Polling, 'guard/listeners/polling' class Listener + + attr_reader :directory def self.select_and_init(*a) if mac? && Darwin.usable?