The maze book for programmers!

Algorithms, circle mazes, hex grids, masking, weaving, braiding, 3D and 4D grids, spheres, and more!

DRM-Free Ebook

The Buckblog

assorted ramblings by Jamis Buck

Capistrano 2.2.0

27 February 2008 — 2-minute read

Capistrano 2.2.0 is now available (well, it’s released, anyway, you might need to wait for the file to propagate to the gem mirrors).

gem install capistrano

Version 2.2.0 sports the following changes:

FEATURE: Dynamic role definition. The role() method now accepts a block, which should return either a host name, a Capistrano::ServerDefinition object, an array of host names, or an array of Capistrano::ServerDefinition objects. This can be used to describe the servers in a role at runtime.

role :app do
  hosts = some_method_that_looks_up_the_current_hosts

FEATURE: Alternative server-centric role definitions, using the server() method:

role :app, "server"
role :web, "server"

# the above is the same as this:
server "server", :app, :web

FEATURE: Support for a :max_hosts option in tasks, that restricts the task so that it is only executed in hosts at a time, in chunks. This helps people who use Capistrano with very large numbers of servers, and prevents them running into connection caps and from running out of memory.

task :ping, :max_hosts => 100 do
  # anything here will only run against 100 hosts at a time

# alternatively, you can pass :max_hosts to the run command itself for
# finer granularity
task :pong do
  # this will run on ALL hosts at once
  run "something"

  # this will run on no more than 100 hosts at a time
  run "something-else", :max_hosts => 100

ENHANCEMENT: Improved Git support! Not being a git user myself (yet), I can’t really speak intelligently about what the changes are, but if you use git chances are you aren’t afraid to dig into the code and read it. For those of you that use git, I’d encourage you to blog about the changes, to assuage some of my embarrassment about releasing code that I can’t describe intelligently!

ENHANCEMENT: Password prompt support in the Mercurial SCM.

ENHANCEMENT: Implement Bzr#next_revision so that pending changes can be reported correctly, and use checkout—lightweight instead of branch.

ENHANCEMENT: Bring back the :p4sync_flags and :p4client_root variables for perforce SCM.

Additionally, there are several minor bugs and typos that have been fixed. You can see the CHANGELOG for all the gory details.

As ever, please report bugs via the Rails trac, at And if you aren’t yet subscribed to the Capistrano mailing list, it’s where all the cool cappists hang out.

Reader Comments

Hello Jamis,

I’m new to RoR and Capistrano and I’m running into some issues deploying my new application.

A little background: my work station is Windows xp -I have svn command line and svn Tortoise installed I’m deploying to a fedora 8 box (my test box) My svn is on my test box

my deploy.rb file is pretty standard I have it prompt me for my svn password and user name and password for ssh to my fedora box.

the problem:

when I try to do a cold deploy IE cap deploy:cold Capistrano flips my slashes from forward to back.

C:\Documents and Settings\Don\My Documents\NetBeansProjects\someSoftWare * executing `deploy:cold’ * executing `deploy:update’ ** transaction: start * executing `deploy:update_code’ SVN Password: http:\\\svn\someSoftWare\trunk: (Not a valid URL)

an additional concern: Capistrano seem to mix up the parameters when it does its “svn info” call

c:/ruby/lib/ruby/gems/1.8/gems/capistrano – bla bla bla `query_revision’: tried to run `svn info—username xxx—password xxx—no-auth-cache -rHEAD’ and got unexpected result ”” (RuntimeError)

When I run it from svn command line it runs fine:

C:\>svn info -rHEAD—username xxx—password xxx Path: Trunk URL: Repository Root: Repository UUID: 83f63d38-5a67-411b-a7a5-b180abd2e38f Revision: 64 Node Kind: directory Last Changed Author: xxx Last Changed Rev: 64 Last Changed Date: 2008-03-02 20:36:54 -0700 (Sun, 02 Mar 2008)

I read about someone having a like problem and he solved it by Uninstalling svn Tortoise which seems crazy to me. Even it worked there has to be an alternative. Did I mention I’m very fond of svn Tortoise and its user interface.

Thanks for any advice in advance


@Don, I’m afraid I cannot answer support questions here, but if you query the mailing list you might have better luck.

Thanks Jamis and team. You guys rock! I just started using cap and its been a big time saver.