Fix Capistrano with RubyGems 1.6

After updating your RubyGems, you will probably not be able to run Capistrano any more, but receive an error similar to this:
can't activate net-ssh (= 2.0.22) for [], already activated net-ssh-2.1.0 for [] (Gem::LoadError)

If you have Bundler installed, you can use bundle exec to avoid this problem as follows:

Create a gemfile at ~/.capistrano/Gemfile (or at some other sensible place), that only contains these 2 lines:
source 'http://rubygems.org'
gem 'capistrano'
gem 'capistrano-ext' # You need this for multistage deployments
gem 'hoptoad_notifier' # Add this for projects that use Hoptoad and Capistrano integration

Run bundle install in the same directory.

Now you can use Capistrano again by prepending BUNDLE_GEMFILE=~/.capistrano/Gemfile bundle exec, i.e.
BUNDLE_GEMFILE=~/.capistrano/Gemfile bundle exec cap deploy

I suggest making a shell alias. For the Bash, append this to your ~/.bashrc:
alias cap='BUNDLE_GEMFILE=~/.capistrano/Gemfile bundle exec cap'

Now you can once again simply run cap deploy.

Tobias Kraze