Created
July 25, 2010 02:55
-
-
Save igstan/489244 to your computer and use it in GitHub Desktop.
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 characters
| # PHPUnit recipe for kicker | |
| require 'osx/cocoa' | |
| recipe :phpunit do | |
| process do |files| | |
| execute "phpunit" | |
| end | |
| end | |
| # take control of the growl notifications | |
| module GrowlHacks | |
| def icon(name) | |
| OSX::NSImage.alloc.initWithContentsOfFile(File.join(File.dirname(__FILE__), "icons/#{name}.png")) | |
| end | |
| def pass | |
| icon("passed") | |
| end | |
| def fail | |
| icon("failed") | |
| end | |
| def growl(type, subject, body, *args, &block) | |
| case type | |
| when Kicker::Growl::notifications[:succeeded] | |
| subject = "OK" | |
| body = body.match(/\([0-9]+ tests?, [0-9]+ assertions?\)/) | |
| icon = pass | |
| when Kicker::Growl::notifications[:failed] | |
| subject = "FAILURES!" | |
| body = body.match(/Tests: ([0-9]+), Assertions: ([0-9]+), Failures: ([0-9]+)/) | |
| icon = fail | |
| else | |
| return nil | |
| end | |
| body = "Error parsing PHPUnit output" if body.nil? else body[0] | |
| super(type, subject, body, {:icon => icon}, &block) | |
| end | |
| end | |
| Kicker::Growl.send :extend, GrowlHacks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment