Saturday, November 21, 2009

Installing Autotest and Snarl on Windows

I was looking for a personal productivity boost (no cracks about having Windows please) and I decided to setup Autotest. Unfortunately for me the best information I could find to do this was slightly more than a year old. To have the same reference point I did you can see the post Andrew On Rails: Autotest and Snarl - Coding bliss is obtainable in Windows.

Before you try to setup Autotest I recommend confirming your current suite of tests are actually working even if they aren't all passing.

As a reference my important version numbers are:

Ruby 1.8.6, Gem 1.3.5, and Rails 2.3.4

I have Windows XP Professional Version 2002 SP3 and a laptop with Windows Vista Home Premium SP2 and I followed these steps to get Autotest setup and working with Snarl on Windows.

  1. Start with downloading and installing the latest version of Snarl. At this time that's Snarl R2.21 (V40.15) I picked the default installation path.
  2. Next I installed ZenTest (4.1.4) (don't forget the capital Z and capital T). I noticed that there is an all lower case zentest with lots of dependencies. I didn't use that one.

    gem install ZenTest

  3. I also installed autotest-rails which was recently split from ZenTest. (version 4.1.0)

    gem install autotest-rails

  4. Then install ruby-snarl. (said version 1.0.0 on the install but shows 0.0.8 on the folder under gems)

    gem install ruby-snarl

  5. Now download and install the GNU Diffutils package. I used the complete package dated May 24, 2004. Autotest uses this to figure out which tests have changed so it can just re-run those particular tests. You will need to put the bin directory into your system PATH.
  6. While you are adding that bin directory to your system PATH you also need to setup a "HOME" environment variable and point it to some place real. I used HOME = %USERPROFILE%
  7. The default icons used with ruby-snarl are located under the gems folder. On my box that is "C:\ruby\lib\ruby\gems\1.8\gems\ruby-snarl-0.0.8\icons". You are probably going to want a couple of nice images because these defaults are small. One for tests have passed and one for tests failing. You can find a couple here: http://www.danielfischer.com/2007/05/14/ruby-on-rails-bdd-with-autotest-growl-rspec at the very bottom of the page. Whatever images you come up with you need to drop them into that icon folder and use the same names as the defaults. There's probably a better way to configure this but hey, I was in a hurry, that's why I wanted Autotest setup this way.
  8. Now create a file named .autotest in your Rails application root directory. You can't use the GUI to create an extension only file name so you'll probably want to drop to a command prompt and just type Edit .autotest to get this going. The only line you need to include in this file right now is:

    require "autosnarl"

  9. At this point you should be able to drop to a command prompt in your Rails application root directory and run the command "autotest". NOTE: If you have an open command prompt you'll need to exit it and open another so that you get the PATH and the HOME environment variable changes you made. Running the autotest command should result in your tests running and the result being shown as a Snarl message.

References

ZenTest

Why Autotest?


1 comment:

  1. Excellent post! I was having trouble installing it, and your post just clarified everything.

    thanks a lot

    ReplyDelete