I have previously described how to deploy gems using Capistrano in a Rails 2 application. After upgrading to Rails 3, this has changed a bit. Rails now uses Bundler for dependency management, so we need to use the bundle install command instead of rake gems:install.
In your deploy.rb:
after "deploy:update_code", "bundle:install"
namespace :bundle do
desc "Bundle install"
task :install, :roles => :app do
run "cd #{current_release} && #{sudo} bundle install"
end
end
It’s as easy as that. Let me know if you have any comments.
Related posts
Tags: Capistrano, Deployment, Ruby on Rails, RubyGems