Friday, June 29, 2007

Capistrano 2.0 Preview 4

Posted by jamis

I am such a chicken. I very much wanted the next release of Capistrano to be the official “Capistrano 2.0” release. But as I watched the changelog grow, I started to get cold feet.

Thus, tonight I announce the fourth (and final, hopefully!) preview release of Capistrano 2.0. As before, you can grab it from the Rails beta gems server:

gem install -s capistrano

(What is Capistrano, you ask? Allow me to direct your attention to…)

The following items are just some of the changes new in preview #4:

  • The deploy:symlink task works correctly now when run by itself.
  • Synchronously instantiate the gateway to prevent it being instantiated multiple times.
  • Use “which” instead of "test -p to test whether a command exists on the path.
  • The :hosts and :roles keys can now accept lambdas, to lazily select which hosts or roles a task uses.
  • Versions of Net::SSH prior to 1.1.0 work with Capistrano again.
  • Variable accesses are now thread safe.
  • The deployment code is now locale-independent, so that the revision is parsed correctly even if your computer is using a non-English locale.
  • You can now pass :on_error => :continue when defining a task, so that any connection or command errors that occur during the task’s execution will be ignored, allowing the task (and subsequent tasks) to continue.

You can see the entire list of changes in the CHANGELOG.

So, give it a go. Try it out. Post your feedback to the Capistrano mailing list. I’d love to release cap2 final next week!

P.S. If you are on a Windows machine, and you get Zlib errors trying to install the Capistrano gem, try this. Find the rubygems/package.rb file (wherever it happens to be in your Ruby installation), open it up, and find the zipped_stream method. Then, replace it, wholesale, with the following:

def zipped_stream(entry) # skip the gzip header
  zis =
  is =
  zis.finish if zis

That seems to do the trick for me; let me know if it doesn’t work for you.