Created
August 25, 2011 20:09
-
-
Save s4nchez/1171743 to your computer and use it in GitHub Desktop.
Watchr config for jasmine-node
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
watch('./(.*).js') { |m| run_tests } | |
def run_tests | |
output = `jasmine-node spec/` | |
report output rescue nil | |
end | |
def report(output) | |
tests = /[0-9]+ tests?/.match(output).to_s; | |
failures = /[0-9]+ failures?/.match(output).to_s; | |
info = "#{tests}, #{failures}" | |
if /0 failures?/.match(failures); | |
title = "Success" | |
image = "~/.watchr_images/passed.png" | |
else | |
title = "Tests failing" | |
image = "~/.watchr_images/failed.png" | |
end | |
growlnotify = `which growlnotify`.chomp | |
options = "-w -n Watchr --image '#{File.expand_path(image)}' --html '#{title}' -m '#{info}'" | |
system %(#{growlnotify} #{options} &) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment