¶ â
Autotest Growl-
Author: Sven Schwyn (www.bitcetera.com)
-
Issues and forum: forge.bitcetera.com/projects/show/autotest-growl
¶ â
DESCRIPTION:This gem aims to improve support for Growl notifications by autotest. It comes with a nice and colorful icon sets and supports several testing frameworks on different platforms.
Furthermore the terminal running autotest is cleared on every cycle (unless configured otherwise). Donât worry though, itâs still possible to scroll up to see the output of previous cycles - at least when using the Terminal.app bundled with Mac OS X.
¶ â
REQUIREMENTS:-
any ZenTest compatible test suite
-
Growl >=1.3 on Mac OS X >=10.7 âORâ
-
Growl >=1.1 and <1.3 on Mac OS <10.7 âORâ
-
Growl for Windows >= 2.0b18 on Windows âORâ
-
libnotify >= 0.4.5 on Linux
¶ â
INSTALL:First of all, you have to decide whether you want to use the comprehensive ZenTest gem or the lightweight autotest-standalone gem and install either of them. (See âAutotestâ below for more on this.)
sudo gem install ZenTest --OR-- sudo gem install autotest-standalone
Now install this gem:
sudo gem install autotest-growl
Then add the following line to your ~/.autotest file:
require 'autotest/growl'
Growl must be installed on your computer. You can download it from:
Mac OS X: growl.info Windows: growlforwindows.com
On Linux you can use libnotify instead, however, some of the features wonât work. The binary notify-send must be in your PATH:
Linux: www.galago-project.org
If you like this gem, please consider to recommend me on Working with Rails, thank you!
workingwithrails.com/recommendation/new/person/11706-sven-schwyn
¶ â
AUTOTEST:You can use any ZenTest-compatible test suite with this gem, which basically boils down to either of the following two sets of gems.
Comprehensive test suite by Ryan Davis:
-
ZenTest
-
autotest-rails (for Ruby on Rails compatibility)
Lightweight test suite by Michael Grosser:
-
autotest-standalone
-
autotest-rails-pure (for Ruby on Rails compatibility)
-
zentest-without-autotest (for full ZenTest compatibility)
Note: Due to a naming disagreement, starting from version 4.4.6 the autotest gem is no longer a lightweight fork but only an empty gem which requires ZenTest. Switch to the autotest-standalone gem if you want to stick with the lightweight approach.
¶ â
CONFIGURATION:¶ â
PrioritiesThe priority of a notification is set according to the actual result so you can configure Growl to style the notifications differently based on these priorities:
-
2 for error or failed
-
0 for info
-
-1 for pending, undefined or unknown
-
-2 for passed
¶ â
IconsTwo icon sets are bundled with this gem:
-
ruby (default): The original Ruby logo dressed in traffic light colors.
-
ampelmaennchen: The famous traffic light man from the now extinct GDR.
To choose an icon set, add the following to your ~/.autotest:
Autotest::Growl::image_dir = 'ampelmaennchen'
Using your own icon set is pretty simple. Images should be named as follows: passed.png, pending.png, failed.png, error.png and info.png.
Place these images in a directory of your choosing and specify its location in your ~/.autotest, example:
Autotest::Growl::image_dir = File.join(ENV['HOME'], '.autotest-growl')
¶ â
Donât Clear the TerminalAdd the following to your ~/.autotest if you donât want the terminal to be cleared before running a test:
Autotest::Growl::clear_terminal = false
¶ â
Hide the LabelIf 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
¶ â
One Notification per RunAllow only one test and one feature notification per run by adding the following to your ~/.autotest:
Autotest::Growl::one_notification_per_run = true
¶ â
Make Failure and Error Notifications StickyIf you donât want to miss any failure or error notifications while you get a cup of coffee, make them stay on your display until you explicitly click them away. Simply add the following to your ~/.autotest:
Autotest::Growl::sticky_failure_notifications = true
¶ â
Custom OptionsYou can pass any custom option to the Growl binary. For instance to set a non-standard port for remote notifications, add the following to your ~/.autotest:
Autotest::Growl::custom_options = '--port 54321'
¶ â
Show Modified FilesAdd the following to your ~/.autotest if you would like to receive a Growl notification listing the files modified before tests are re-run.
Autotest::Growl::show_modified_files = true
¶ â
TROUBLESHOOTING:¶ â
Autotest Binary Not PresentMake sure you have either the ZenTest gem or the autotest-standalone gem installed. This dependency has been dropped as of autotest-growl-0.2.5 in order to allow any compatible test suite.
¶ â
Unreliable Growl Notifications on Mac OS XUnder some circumstances, Growl notifications seem to be swallowed randomly on Mac OS X. 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.
¶ â
Duplicate NotificationsSome people reported problems with duplicate notifications on some versions of Mac OS X 10.5. If you experience this oddity, add the following to your ~/.autotest:
Autotest::Growl::custom_options = '-w'
¶ â
No Notifications on Mac OS X 10.5If you are still on Leopard and notifications donât work for you, get your hands dirty and remove the â-n Autotestâ argument from growl.rb. Make sure you submit a bug or comment on a related and existing bug, too.
¶ â
Errors by growlnotifyOn Mac OS X make sure you have an adequate version of Growl installed:
-
Growl >=1.3 for Mac OS X >=10.7
-
Growl >=1.1.5 and <1.3 for Mac OS X <10.7
¶ â
Strange Characters in TerminalIf strange characters show up in the terminal and maybe even lock it up, make sure it is set to âxterm-colorâ or disable the terminal clear sequence by adding the follogin to your ~/.autotest:
Autotest::Growl::clear_terminal = false
¶ â
DEVELOPMENT:You can install the bleeding edge version as follows:
git clone git://github.com/svoop/autotest-growl.git cd autotest-growl bundle install rake build rake install
Please submit issues on:
forge.bitcetera.com/projects/show/autotest-growl
To contribute code, fork the project on Github, add your code and submit a pull request:
github.com/guides/fork-a-project-and-submit-your-modifications
¶ â
CONTRIBUTIONS:Thanks to the following folks who have contributed to this project:
-
Michael Moen
-
Graham Savage
-
Karl OâKeeffe
-
Konstantin Haase
-
Edward Dewyea
-
-
Martin Vielsmaier
-
Charles Roper
-
Ben Ritcey
-
Patrick Aikens
-
Gordon Thiesfeld
-
Leif Eriksen
¶ â
LICENSE:(The MIT License)
Copyright © 2011 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.