Created
November 24, 2014 22:08
-
-
Save schurpf/cc252ae0225166f9cde2 to your computer and use it in GitHub Desktop.
rb: watchr file for phpunit
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('.*\.php') { |m| code_changed(m[0]) } | |
def code_changed(file) | |
run "phpunit" | |
end | |
def run(cmd) | |
result = `#{cmd}` | |
growl result rescue nil | |
end | |
def growl(message) | |
puts(message) | |
message = message.split("\n").last(3); | |
title = message.find { |e| /FAILURES/ =~ e } ? "FAILURES" : "PASS" | |
if title == "FAILURES" | |
image = "/Users/admin/Library/Icons/fail.png" | |
else | |
image = "/Users/admin/Library/Icons/success.png" | |
end | |
`growlnotify #{title} -m "#{message[-1][8..-4]}" --image #{image}` | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment