Thursday, July 19, 2007

Capistrano on Windows client...

It was supposed to be easy: just read the Capistrano manual make a little magic with your deploy.rb file, and you're in business. Sounds wonderful, doesn't it? Would that it were so easy.

The documentation (manual and elsewhere) makes it clear that Cap'ping to a Windows server is pretty challenging... Cap is made for *nix machines. However, I didn't find anything about a Windows client, other than the statement that "you must have an svn client installed on your machine." I did -- RapidSVN, TortoiseSVN, and the svn client embedded in the Aptana IDE.

However, once I got to actually attempting to deploy my application, it failed every time with a "no such file or directory" error message and a reference to the repository trunk itself. No amount of hair-pulling (it was a VERY long weekend), searching the web, emailing a few contacts helped... not matter what I did, it continued to fail in exactly the same manner. I even built a new development environment on another machine just to make sure it wasn't some brain-dead Windows issue: no dice.

Tuesday night, I went to the local Ruby on Rails Meetup and got the answer from another Windows-based developer Hob Spillane -- thanks!

So... drum roll please... here's how to get Cap working on your system:

You MUST have the svn binaries installed on your Windows client machine and in your execution path before Cap can deploy successfully -- the GUI clients do not provide what Capistrano needs. The binary you need depends on the version of Apache that your provider is running: 2.0 and 2.2 require different binaries.

For my Apache 2.2, I went to the subversion download page, and clicked on the link, installed it in /usr/bin/svn/bin, added that directory to my PATH statement and -- voila! -- Capistrano deploys like a charm! (When I went to the download site, there was only the choice of a zip file, no setup.exe. That may change by the time you get there.)

If your version is Apache 2.0, go to this download page and chose the appropriate setup.exe or .zip file.