Created
March 9, 2011 10:45
Revisions
-
proofek created this gist
Mar 9, 2011 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,28 @@ watch('./(.*).php') { |m| code_changed(m[0]) } def code_changed(file) run "phpunit" end def run(cmd) result = `cd Test && #{cmd}` growl result rescue nil end def growl(message) puts(message) message = message.split("\n").last(3); growlnotify = `which growlnotify`.chomp title = message.find { |e| /FAILURES/ =~ e } ? "FAILURES" : "PASS" if title == "FAILURES" image = "~/.watchr_images/failed.png" info = /\x1b\[37;41m\x1b\[2K(.*)/.match(message[1])[1] else image = "~/.watchr_images/passed.png" info = /\x1b\[30;42m\x1b\[2K(.*)/.match(message[1])[1] end options = "-w -n Watchr --image '#{File.expand_path(image)}' --html '#{title}' -m '#{info}'" system %(#{growlnotify} #{options} &) end