Don't assume watched directory, use value from listener

This commit is contained in:
Doug Renn 2011-07-22 11:57:49 -06:00
parent baa1817b3a
commit ee8489fb83
3 changed files with 5 additions and 3 deletions

View File

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

View File

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

View File

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