Mar 27, 2009

Setting a Capistrano Variable from the Command Line

It took me a little while to find a solution for this, so I thought I’d post it.

I was cleaning some deployment dirs and wanted, just for this instance, to only leave 1 release as opposed to the 5 releases that capistrano leaves by default. Keep in mind this was across about 6 apps and 2 stages for each.

Option 1: Add the following to the deploy.rb files:

set :keep_releases, 1

That would require changing them all back afterwards.

Options 2: Set the capistrano variable from the command line:

cap deploy:cleanup -s keep_releases=1