Any way to have a different SOUND from growl for a 'pass' rather than a 'fail' when using "./script/


#1

Hi,

Is there any way to have a different SOUND from growl for a ‘pass’
rather than a ‘fail’ when using “./script/autospec” ???

thanks


#2

I’m not sure what platform you’re on, or if this is what you’re after,
but
the .autospec I use on the Mac uses the built in speech stuff to say
what
happens at the end of an autotest run. So, it tells me things like “all
tests passed”, or “tests passed” (depends on whether or not it ran the
full
suite, or just a changed file/spec), “some pending”, and of course
fails. I
use different voices depending on the results :slight_smile:
http://gist.github.com/23649

On Sat, Nov 8, 2008 at 12:37 PM, Greg H. <


#3

I’m on Mac too - so it may be as simple as changing the Growl
Preferences to get this working then?
(assuming I’m using vanilla Rspec gem).

I’ve also customised (copy/pasted from a recommendation) my
~/.autotest file. Is this an issue? Does this file actually get
used now I’m using RSpec and “./script/autospec” (as opposed to just
using ZenTest’s autotest)?

regards
Greg


Macintosh-2:myequity greg$ cat ~/.autotest

-- ruby --

NOTE Copy this to your home folder as .autotest

Originally from

http://wincent.com/knowledge-base/Setting_up_autotest_to_use_Growl

Modifications:

* Minor refactoring to use .autotest_images directory

[Geoffrey Grosenbach http://peepcode.com]

* Test::Unit compatibility [Pat N.]

module Autotest::Growl

AUTOTEST_IMAGE_ROOT = “~/.autotest_images”

def self.growl title, msg, img, pri=0, sticky=""

puts "GREGS: growlnotify -n autotest --image #{img} -p #{pri} -m

#{msg.inspect} #{title} #{sticky}"
system “growlnotify -n autotest --image #{img} -p #{pri} -m
#{msg.inspect} #{title} #{sticky}”
end

def self.growl_fail(output)

puts “GREGS: growl FAIL, #{output}”

growl “FAIL”, “#{output}”, “#{AUTOTEST_IMAGE_ROOT}/fail.png”, 2
end

def self.growl_pass(output)

puts “GREGS: growl_pass PASS, #{output}”

growl “Pass”, “#{output}”, “#{AUTOTEST_IMAGE_ROOT}/pass.png”
end

Autotest.add_hook :ran_command do |at|

results = [at.results].flatten.join("\n")

if results.include? ‘tests’
output =
results.slice(/(\d+)\s+tests?,\s*(\d+)\s+assertions?,\s*(\d+)\s+failures?(,\s*(\d+)\s+errors)?/)
if output
$~[3].to_i + $~[5].to_i > 0 ? growl_fail(output) :
growl_pass(output)
end
else
output =
results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+not
implemented)?/)
if output
$~[2].to_i > 0 ? growl_fail(output) : growl_pass(output)
end
end
end

end


On Tue, Nov 11, 2008 at 7:51 AM, Christopher B.


#4

On Nov 10, 2008, at 6:03 PM, Greg H. wrote:

I’m on Mac too - so it may be as simple as changing the Growl
Preferences to get this working then?
(assuming I’m using vanilla Rspec gem).

One easy way is to use qp - a command line utility for playing
QuickTIme sounds. It’s been removed from it’s original home, but you
can get it from the wayback machine:

go to http://www.archive.org/index.php

and search for: http://www.ed.com/qp/QP.dmg.gz

then you can use qp in the script to play a sound file based on the
event.

SR


#5

thanks Chris - the help in http://gist.github.com/23649 worked great

On Tue, Nov 11, 2008 at 7:51 AM, Christopher B.