Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
This paste will be private.
module Autotest::Growl def self.growl title, msg, img, pri=0, stick="" system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}" end Autotest.add_hook :ran_command do |at| output = at.results.join(' ').slice(/(\d+).*errors/) if output =~ /ns.*[1-9]/ unflag if flagged? growl "Test Results", "#{output}", '~/Library/autotest/rails_fail.png', 2 #, "-s" else if(!flagged?) flag growl "Test Results", "#{output}", '~/Library/autotest/rails_ok.png' end end end def self.flagged? File.exist?('tmp/autotest-flag') end # setting new green flag def self.flag File.open('tmp/autotest-flag','w') puts 'planting green flag' end # removing green flag def self.unflag puts 'removing green flag' File.delete('tmp/autotest-flag') if flagged? end end
From the Design Piracy series on my blog: