Don't call run_on_change guard method when there is no matched files.

This commit is contained in:
Thibaud Guillaume-Gentil 2010-11-25 08:52:53 +01:00
parent eebd74b253
commit 85beb5e97a
2 changed files with 10 additions and 4 deletions

View File

@ -30,10 +30,12 @@ module Guard
Interactor.init_signal_traps
listener.on_change do |files|
run do
guards.each do |guard|
paths = Watcher.match_files(guard, files)
supervised_task(guard, :run_on_change, paths) unless paths.empty?
if Watcher.match_files?(guards, files)
run do
guards.each do |guard|
paths = Watcher.match_files(guard, files)
supervised_task(guard, :run_on_change, paths) unless paths.empty?
end
end
end
end

View File

@ -30,5 +30,9 @@ module Guard
end
end
def self.match_files?(guards, files)
guards.any? { |guard| !match_files(guard, files).empty? }
end
end
end