Greg Hauptmann
2008-Nov-08 20:37 UTC
[rspec-users] any way to have a different SOUND from growl for a ''pass'' rather than a ''fail'' when using "./script/autospec" ???
Hi, Is there any way to have a different SOUND from growl for a ''pass'' rather than a ''fail'' when using "./script/autospec" ??? thanks
Christopher Bailey
2008-Nov-10 21:51 UTC
[rspec-users] any way to have a different SOUND from growl for a ''pass'' rather than a ''fail'' when using "./script/autospec" ???
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 :) http://gist.github.com/23649 On Sat, Nov 8, 2008 at 12:37 PM, Greg Hauptmann < greg.hauptmann.ruby at gmail.com> wrote:> Hi, > > Is there any way to have a different SOUND from growl for a ''pass'' > rather than a ''fail'' when using "./script/autospec" ??? > > thanks > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >-- Christopher Bailey Cobalt Edge LLC http://cobaltedge.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20081110/8008ce1c/attachment.html>
Greg Hauptmann
2008-Nov-11 00:03 UTC
[rspec-users] any way to have a different SOUND from growl for a ''pass'' rather than a ''fail'' when using "./script/autospec" ???
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 Nakajima]
#
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 Bailey
<chris at cobaltedge.com> wrote:> 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 :)
> http://gist.github.com/23649
>
> On Sat, Nov 8, 2008 at 12:37 PM, Greg Hauptmann
> <greg.hauptmann.ruby at gmail.com> wrote:
>>
>> Hi,
>>
>> Is there any way to have a different SOUND from growl for a
''pass''
>> rather than a ''fail'' when using
"./script/autospec" ???
>>
>> thanks
>> _______________________________________________
>> rspec-users mailing list
>> rspec-users at rubyforge.org
>> http://rubyforge.org/mailman/listinfo/rspec-users
>
>
>
> --
> Christopher Bailey
> Cobalt Edge LLC
> http://cobaltedge.com
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
Steven Rogers
2008-Nov-11 01:56 UTC
[rspec-users] any way to have a different SOUND from growl for a ''pass'' rather than a ''fail'' when using "./script/autospec" ???
On Nov 10, 2008, at 6:03 PM, Greg Hauptmann 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
Greg Hauptmann
2008-Nov-11 10:26 UTC
[rspec-users] any way to have a different SOUND from growl for a ''pass'' rather than a ''fail'' when using "./script/autospec" ???
thanks Chris - the help in http://gist.github.com/23649 worked great On Tue, Nov 11, 2008 at 7:51 AM, Christopher Bailey <chris at cobaltedge.com> wrote:> 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 :) > http://gist.github.com/23649 > > On Sat, Nov 8, 2008 at 12:37 PM, Greg Hauptmann > <greg.hauptmann.ruby at gmail.com> wrote: >> >> Hi, >> >> Is there any way to have a different SOUND from growl for a ''pass'' >> rather than a ''fail'' when using "./script/autospec" ??? >> >> thanks >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users > > > > -- > Christopher Bailey > Cobalt Edge LLC > http://cobaltedge.com > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >