Skip to content

Instantly share code, notes, and snippets.

@igstan
Created July 25, 2010 02:55
Show Gist options
  • Select an option

  • Save igstan/489244 to your computer and use it in GitHub Desktop.

Select an option

Save igstan/489244 to your computer and use it in GitHub Desktop.
# 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