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?


Thursday, November 19, 2009

An apology

After many years I have finally decided to try some kind of regular routine to capture thoughts that might be useful to others. I was reminded to do this once again after slogging my way through a Ruby on Rails issue looking for information about how to configure something on Windows. I found some of the information I needed but not all and it took some piecing things together to arrive at a solution. Unfortunately, not documented well enough to post just yet but it will be coming shortly. All of this to was the lead in to say that I have used many blog postings, news groups, user forums and the like over the last 24 years of developing software. I am ashamed to say that I have contributed very little back into the collective during that time. I have helped many developers one on one (some of them will find this post amusing) over those years, however, those of you out there I don't know have seen a benefit for anything I've done. Here's my apology and hopefully the start of some real contributions.