Posted about 7 years ago. Visible to the public.

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 ''
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.

By refactoring problematic code and creating automated tests, makandra can vastly improve the maintainability of your Rails application.

Author of this card:

Tobias Kraze
Last edit:
over 5 years ago
netssh, ruby, deployment, conflict
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Tobias Kraze to makandra dev