Autotest Growl

DESCRIPTION:

This gem aims to improve support for Growl notification by ZenTest’s autotest. It comes with a nice colored Ruby icon set and - for now - supports Cucumber notifications by means of a workaround.

Furthermore the terminal running autotest is cleared on every cycle. Don’t worry though, it’s still possible to scroll up to see the output of previous cycles.

Ruby 1.9.1 Note

For the moment, autotest-growl doesn’t seem to work on Ruby 1.9.1. This will change soon, however, it will take a few days as autotest itself is currently misbehaving - at least on my setup.

REQUIREMENTS:

  • Growl >= 1.1.4

  • ZenTest >= 4.0.0

INSTALL:

Make sure Growl is installed on your computer. You can download it from:

growl.info

Now install the gem:

sudo gem install autotest-growl

With ZenTest >4.0.0

Add the following line to your ~/.autotest file:

require 'autotest/growl'

With ZenTest 4.0.0

ZenTest comes with a bundled Growl plugin which will be removed in the near future. If you use ZenTest-4.0.0 or older, the above require won’t do the trick, instead do the following:

Find the full path to autotest-growl:

find /Library/Ruby /usr -name growl.rb | grep "gems/autotest"

Then add the output of the above to your ~/.autotest file:

require '--PUT-OUTPUT-HERE--'

CONFIGURATION:

Custom Icons

Using your own set of icons is pretty simple. Just create a directory ~/.autotest-growl, copy your icons there and name them passed.png, pending.png, failed.png and error.png.

Hide the Label

If you prefer the Growl notifications not to show labels such as “LABEL: All tests have passed”, add the following to your ~/.autotest:

Autotest::Growl::hide_label = true

Don’t clear the screen on each run

Autotest::Growl::clear_before_run = false

Wrap the message on commas

Autotest::Growl::wrap_lines = true

Try and make the message a little more readable

Setting this true sets wrap_lines to false as they don’t play nice together

Autotest::Growl::pretty_print = true

TROUBLESHOOTING:

Missing Cucumber Notifications

If you are using autotest-fsevent as well, the require statements are not ordered correctly. The require for autotest-fsevent must come after all other requires in your ~/.autotest.

Unreliable Growl Notifications

Under some circumstances, Growl notifications seem to be swallowed randomly. If this happens to you, try the following.

Add this to your ~/.autotest:

Autotest::Growl::remote_notification = true

Now open “System Preferences -> Growl -> Network” and set the checkboxes “Listen for incoming notifications” and “Allow remote application registration”. Try whether remote notifications work with the following test:

find /Library/Ruby /usr -name growlnotify -exec {} -H localhost -n autotest -m ok \;

If you get a NSPortTimeoutException, you should restart Growl and check whether a firewall is blocking the connection. Once the notification is displayed, go back to the System Preferences and disable the checkbox “Allow remote application registration” again.

LICENSE:

(The MIT License)

Copyright © 2009 Sven Schwyn

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.