Ruby on Rails, programming, and SEO
Check out my articles about Ruby on Rails, programming, and SEO. Weekly updates? Subscribe to my feed.

Rails 3 and Bundler: Deploying gems using Capistrano

How to deploy gems from your Rails 3 application through Capistrano.

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: , , ,

Leave a comment

Fork me on GitHub