The maze book for programmers!
mazesforprogrammers.com

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 1.1

6 March 2006 — 1-minute read

Capistrano is a utility for executing tasks in parallel across multiple remote hosts. It was formerly known as SwitchTower.

Installation:

gem install capistrano

Version 1.1 introduces a few changes:

  • The generated capistrano.rake file is simpler now than it used to be. You can easily append custom options to individual tasks now. For instance, if you want the deploy to be silent, instead of verbose, just add “-q” to the parameter list for that task.
  • The generated capistrano.rake file uses the “remote” namespace, so you’ll need to have at least Rake 0.7.0. You can still do “rake deploy” and “rake rollback”, but the other tasks must be prefixed with the namespace (“rake remote:exec”, “rake remote:show_tasks”, etc.)
  • The ‘switchtower’ command is replaced by the ‘cap’ command.
  • The cap utility is verbose by default. If you want it to be silent, use the -q option. If you want it to be less verbose, you can specify the -v or -vv flags explicitly.
  • The cap utility uses more rake-like command-line semantics. Instead of needing to do “cap -r config/deploy -a deploy”, you can just do “cap deploy”. It will look for config/deploy.rb, capfile, or Capfile automatically, and will treat raw parameters as action names.

Upgrading/switching from SwitchTower to Capistrano is a little inconvenient. Here’s what you’ll need to do:

  • gem uninstall switchtower (remove all versions)
  • gem install capistrano
  • For each of your Rails projects, do “cap -A .”, keeping your deploy.rb
  • For each of your Rails projects, remove lib/tasks/switchtower.rake

Enjoy!

Reader Comments

The GEM installation fails here:
$ sudo gem install capistrano
Attempting local installation of 'capistrano'
Local gem file not found: capistrano*.gem
Attempting remote installation of 'capistrano'
Updating Gem source index for: http://gems.rubyforge.org
ERROR:  While executing gem ... (ArgumentError)
    invalid date
Is this a general problem or am I the only one seeing this?
Now instead of displacing some obscure enterprise software's Google rankings, you get to displace an entire cities. :) Thanks for not making the upgrade too complex!
Patrice, weird! The upgrade went smoothly for me, and others. I've not heard any other instances of that issue. Has anyone else encountered that? Anyone know how to work around it?
It did work now, with the same command line. Strange. Should the problem come up on other computers I'm on Mac OS 10.4 with Spanish/German/English language configured in that order (language setting changes date formatting, that's why I mention that).
Since installing Capistrano, I'm getting errors now whenever I run rake. $ rake rake aborted! undefined method `namespace' for #<object:0x339b8> ./rakefile:10 Removing the capistrano.rake file causes these error to go away, but of course I can't deploy either.
Capistrano 1.1 requires Rake 0.7.0, because it (like the next version of Rails, actually) uses rake namespaces to categorize tasks. Be sure you are using the latest version of Rake.
D'oh. I had the correct version of rake inside locomotive, but I was testing outside. Thanks, Jamis.
Rereading the docs in Hieraki [1], I see that the list of supported scm systems is out of sync with .../gems/captistrano-1.1.0/lib/capistrano/scm [2]. Might want to change that so people who are evaluating Capistrano will see that their scm is (most probably) supported already. [1] http://manuals.rubyonrails.com/read/chapter/102#page273 [2] Capistrano 1.1 supports Bazaar, Bazaar-NG, cvs, Darcs, Perforce and Subversion.