Skip to content

Instantly share code, notes, and snippets.

@ajmorris
Created April 9, 2009 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajmorris/92529 to your computer and use it in GitHub Desktop.
Save ajmorris/92529 to your computer and use it in GitHub Desktop.
# .autotest
require 'autotest/redgreen'
require 'autotest/menu'
# This replaces the stock Autotest::Growl
module Autotest::Growl
def self.growl title, msg, image=nil, pri=0
title += " in #{Dir.pwd}"
msg += " at #{Time.now}"
system "growlnotify -n autotest --image #{image || "/Applications/Mail.app/Contents/Resources/Caution.tiff"} -m #{msg.inspect} -t #{title}"
end
Autotest.add_hook :initialize do |at|
growl "autotest running", "Started",'~/Library/autotest/rails_grey.png'
end
Autotest.add_hook :reset do |at|
growl "autotest reset", "Reset",'~/Library/autotest/rails_grey.png'
end
Autotest.add_hook :red do |at|
growl "Tests Failed", "#{at.files_to_test.size} tests failed", '~/Library/autotest/rails_fail.png'
end
Autotest.add_hook :green do |at|
growl "Tests Passed", "#{at.results.scan(at.completed_re)}", '~/Library/autotest/rails_ok.png'
end
Autotest.add_hook :all_good do |at|
growl "All Tests Passed", "#{at.results.scan(at.completed_re)}", '~/Library/autotest/rails_ok.png'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment