better messages when matching no files in run_on_change

This commit is contained in:
John Bintz 2011-08-07 12:51:42 -04:00
parent 7e31c0d2d7
commit 9734d6cbeb

View File

@ -37,10 +37,11 @@ class Guard::Hydra < Guard::Guard
end end
def run_on_change(files = []) def run_on_change(files = [])
files = ensure_files(files) if !(files = ensure_files(files)).empty?
Guard::UI.info "Running Hydra on #{files.join(', ')}" Guard::UI.info "Running Hydra on #{files.join(', ')}"
run_all if run_hydra(files) run_all if run_hydra(files)
end end
end
def run_all def run_all
Guard::UI.info "Running Hydra on all matching tests..." Guard::UI.info "Running Hydra on all matching tests..."
@ -49,6 +50,7 @@ class Guard::Hydra < Guard::Guard
private private
def run_hydra(files = []) def run_hydra(files = [])
if !files.empty?
File.unlink @options[:runner_log] if runner_log? && @options[:clear_runner_log] File.unlink @options[:runner_log] if runner_log? && @options[:clear_runner_log]
start = Time.now start = Time.now
@ -64,6 +66,10 @@ class Guard::Hydra < Guard::Guard
puts File.read(@options[:runner_log]) if runner_log? && @options[:show_runner_log] puts File.read(@options[:runner_log]) if runner_log? && @options[:show_runner_log]
hydra.failed_files.empty? hydra.failed_files.empty?
else
Guard::UI.info "No files matched!"
false
end
end end
def runner_log? def runner_log?