Skip to content

Instantly share code, notes, and snippets.

@schurpf
Created November 24, 2014 22:08
Show Gist options
  • Save schurpf/cc252ae0225166f9cde2 to your computer and use it in GitHub Desktop.
Save schurpf/cc252ae0225166f9cde2 to your computer and use it in GitHub Desktop.
rb: watchr file for phpunit
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