Programifications

A mashup of technical quirks

Using Bundler With Capistrano

| Comments

To make capistrano build your gems with bundler you can use the following code snippet:

1
2
3
4
5
6
7
8
9
namespace :bundle do
  task :install, :roles => :app do
    shared_dir = File.join(shared_path, 'bundle')
    run "mkdir -p #{shared_dir}"
    run "cd #{release_path} && bundle install --without development test --path #{shared_dir}"
  end
end

after 'deploy:update_code', 'bundle:install'

Of course, this is assuming that you already have bundler installed on your remote server.

Comments