Setting up autotest to use GrowlEdit

Created , updated

Introduction

This information based on the following three articles:

Get GrowlNotify

Growl 1.1.2

wget http://growl.info/files/Growl-1.1.2.dmg
open Growl-1.1.2.dmg 
cd /Volumes/Growl\ 1.1.2/Extras/growlnotify
less install.sh
sudo ./install.sh 
cd
hdiutil detach /Volumes/Growl\ 1.1.2

Growl 0.7.6

wget http://growl.info/files/Growl-0.7.6.dmg
open Growl-0.7.6.dmg
cd /Volumes/Growl/Extras/growlnotify
sudo ./install.sh
cd
hdiutil detach /Volumes/Growl

Grab the failure/success graphics

cd ~
wget http://blog.internautdesign.com/files/rails_fail.png
wget http://blog.internautdesign.com/files/rails_ok.png
mv rails_fail.png .rails_fail.png
mv rails_ok.png .rails_ok.png

Customize ~/.autotest

(Last updated 21 December 2007 to handle new RSpec "pending" notifications):

module Autotest::Growl
  
  def self.growl title, msg, img, pri=0, sticky=""
    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+failures?(,\s*(\d+)\s+pending)?/)
    if output
      if $~[2].to_i > 0
        growl "Test Results", "#{output}", "~/.rails_fail.png", 2
      else
        growl "Test Results", "#{output}", "~/.rails_ok.png"
      end
    end
  end
    
end

Configure Growl

  • Configure notifications from autotest to display using the "Smoke" display.
  • Set the "Emergency" color scheme for "Smoke" to show a red background.