I got so hooked on redgreen autotest that I wanted to see green in my growl notifications. So I came up with this modification to Labrat’s advice on autotest and growl.
Greg and I decided we don’t like the sticky window for errors, hence we commented out the “-s” parameter. It took me awhile to realize that one can customize the display properties of different message priorities in the Growl control panel, but I prefer to change the image instead of the background color.
Add the following to your ~/.autotest file:
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}"
end
Autotest.add_hook :ran_command do |at|
output = at.results.slice(/(\d+).*errors/)
if output =~ /ns.*[1-9]/
growl "Test Results", "#{output}", '~/Library/autotest/rails_fail.png', 2 #, "-s"
else
growl "Test Results", "#{output}", '~/Library/autotest/rails_ok.png'
end
end
end
(Note: also make sure you comment out the “require ‘autotest/growl’” line at the top, as this replaces it.)
Here are the images that I use:

output = at.results.last.slice(/(\d+).*errors/)


Sorry, comments are closed for this article.