Skip to content

Instantly share code, notes, and snippets.

@jackdempsey
Created November 12, 2008 19:40
Show Gist options
  • Select an option

  • Save jackdempsey/24246 to your computer and use it in GitHub Desktop.

Select an option

Save jackdempsey/24246 to your computer and use it in GitHub Desktop.
~ $ cat .autotest
require 'autotest/redgreen'
require 'autotest/timestamp'
module Autotest::Growl
def self.growl title, msg, img, pri=0, sticky=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}"
end
Autotest.add_hook :ran_command do |at|
image_root = "~/.autotest_images"
output = at.results.last.slice(/(\d+)\s.*examples?,\s(\d+)\s.*failures?/)
if output =~ /[1-9]\sfailures?/
growl "FAIL", "#{output}", "#{image_root}/fail.png", 2
else
growl "Pass", "#{output}", "#{image_root}/pass.png"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment