
Untitled
By: a guest on
Feb 26th, 2012 | syntax:
None | size: 0.81 KB | hits: 13 | expires: Never
require 'autotest/growl'
module Autotest::Growl
def self.growl title, msg, img, pri=0, stick=""
system "growlnotify -n autotest --image #{img} -p #{pri} -m '#{msg}' #{title} #{stick}"
end
Autotest.add_hook :red do |at|
errors = at.files_to_test.map { |k, v| "#{k}:\n #{v.join("\n ")}"}.join("\n\n")
#failed_tests = at.files_to_test.inject(0){ |s,a| k,v = a; s + v.size}
growl "Tests failed:", "#{errors}", '~/library/autotest/rails_fail.png', 2
end
Autotest.add_hook :green do |at|
res = at.results.scan(/Finished.*failures/m).to_s.gsub(/\e\[32m/,'')
growl "Test Results", "#{res}", '~/library/autotest/rails_ok.png'
end
end
Autotest.add_hook :initialize do |at|
%w{.git vendor rerun.txt tmp log}.each {|exception| at.add_exception(exception)}
end