Head On

Blog by Marcus Ahnve

Autotest 3.5.0 and Growl

Autotest 3.5.0 is out, and the result given from Autotest is no longer a String, it’s an array of strings. So if you still want Growl to function properly just modify the .autotest slightly:

 1 module Autotest::Growl
 2   def self.growl title, msg, img, pri=0, stick="" 
 3     system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}" 
 4   end
 5 
 6   Autotest.add_hook :ran_command do |at|
 7     output = at.results.last.slice(/(\d+)\s.*specifications?,\s(\d+)\s.*failures?/)
 8     if output =~ /[1-9]\sfailures?/
 9       growl "Test Results", "#{output}", '~/Library/autotest/rails_fail.png', 2 #, "-s" 
10     else
11       growl "Test Results", "#{output}", '~/Library/autotest/rails_ok.png'
12     end
13   end
14 end
blog comments powered by Disqus