2008-08-14 17:49:51 +10:00
|
|
|
require 'autotest/redgreen'
|
|
|
|
require 'autotest/timestamp'
|
|
|
|
|
|
|
|
module Autotest::Growl
|
|
|
|
def self.growl title, msg, img, pri=0, sticky=""
|
2008-12-17 23:32:26 +11:00
|
|
|
system "growlnotify -n autotest -d #{title} --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
|
2008-08-14 17:49:51 +10:00
|
|
|
end
|
|
|
|
|
|
|
|
Autotest.add_hook :ran_command do |at|
|
|
|
|
unless at.results.empty?
|
2009-02-04 12:21:50 +11:00
|
|
|
output = at.results.last.slice(/(\d+)\s.*(?:examples|assertions)?,\s(\d+)\s.*failures?/)
|
2008-08-14 17:49:51 +10:00
|
|
|
if output =~ /[1-9]\sfailures?/
|
|
|
|
growl "Tests", "#{output}", "~/.ruby_fail.png", 2, "-s"
|
|
|
|
else
|
|
|
|
growl "Tests", "#{output}", "~/.ruby_ok.png"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|