Created
May 5, 2010 12:25
-
-
Save ryopeko/390707 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- ruby -*- | |
# require 'autotest/autoupdate' | |
# require 'autotest/once' | |
# require 'autotest/rcov' | |
# require 'autotest/restart' | |
# require 'autotest/timestamp' | |
# Autotest::AutoUpdate.sleep_time = o | |
# Autotest::AutoUpdate.update_cmd = o | |
# Autotest::RCov.command = o | |
# Autotest::RCov.pattern = o | |
module Autotest::Growl | |
def self.growl title, msg, img="~/images/rails_ok.png", pri=0, sticky="" | |
msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}" | |
system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{sticky}" | |
end | |
Autotest.add_hook :ran_command do |at| | |
results = [at.results].flatten.join("¥n") | |
output = results.slice(/\d+\s+examples,\s*(\d)\s*failure/) | |
if output | |
if $~[1].to_i > 0 | |
growl "Tests Failed", "#{output}", "~/images/rails_fail.png", 2 | |
else | |
growl "Tests Passed", "#{output}", "~/images/rails_ok.png", 2 | |
end | |
else | |
growl "Tests Errored", "errors", "~/images/rails_fail.png", 2 | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment