“Rails 3 and Bundler: Deploying gems using Capistrano”

rails, Uncategorized

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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s