This is cool. The newest version of Capistrano now supports multiple stages. Like when you want to have different configuration for, say, production, testing, and staging. This is something I’ve been doing manually, which while it works, is not without its quirks.
It’s part of the capistrano extensions plugin (capistrano-ext), which is as easy as gem install capistrano-ext to obtain. Once installed, you simply require the multistage support in your deploy recipe file.
require 'capistrano/ext/multistage'
The best part is how stages are defined. All you have to do is place your stage-specific code in config/deploy/staging.rb and/or
config/deploy/production.rb and it will get loaded automatically.
And if your stages aren’t named “production” and “staging,” you can define your own easily. You can then deploy to the staging server with cap staging deploy and to the production server with cap production deploy. And if you want the stating server to be the default, you can save yourself some typing by setting the default stage:
set :default_stage, 'staging' require 'capistrano/ext/multistage'


Hey, thanks jeff for posting this….yeah, I’ve had kind of a hackish solution in place for this for a while now, but it’s never felt right. Good to know
This is awesome. Just what I’ve been looking for. Thanks for the info