diff --git a/lib/guard.rb b/lib/guard.rb index 7d12926..6ddc608 100644 --- a/lib/guard.rb +++ b/lib/guard.rb @@ -25,6 +25,7 @@ module Guard # @option options [String] watchdir the director to watch # @option options [String] guardfile the path to the Guardfile # @option options [Boolean] watch_all_modifications watches all file modifications if true + # def setup(options = {}) @options = options @guards = [] @@ -192,21 +193,21 @@ module Guard catch group.options[:halt_on_fail] == true ? :task_has_failed : :no_catch do guards(:group => group.name).each do |guard| if task == :run_on_change - paths = Watcher.match_files(guard, files) - unless paths.empty? - if @watch_all_modifications - UI.debug "#{guard.class.name}##{task} with #{paths.inspect}" - supervised_task(guard, task, paths.select {|f| !f.start_with?('!') }) - deletions = paths.collect { |f| f.slice(1..-1) if f.start_with?('!') }.compact - unless deletions.empty? - UI.debug "#{guard.class.name}#run_on_deletion with #{deletions.inspect}" - supervised_task(guard, :run_on_deletion, deletions) - end - else - UI.debug "#{guard.class.name}##{task} with #{paths.inspect}" - supervised_task(guard, task, paths) - end + paths = Watcher.match_files(guard, files) + unless paths.empty? + if @watch_all_modifications + UI.debug "#{guard.class.name}##{task} with #{paths.inspect}" + supervised_task(guard, task, paths.select { |f| !f.start_with?('!') }) + deletions = paths.collect { |f| f.slice(1..-1) if f.start_with?('!') }.compact + unless deletions.empty? + UI.debug "#{guard.class.name}#run_on_deletion with #{deletions.inspect}" + supervised_task(guard, :run_on_deletion, deletions) + end + else + UI.debug "#{guard.class.name}##{task} with #{paths.inspect}" + supervised_task(guard, task, paths) end + end else supervised_task(guard, task) end