Skip to content

Dry bundler in capistrano

Richard Huang edited this page Sep 29, 2010 · 1 revision

Please go to http://rails-bestpractices.com/posts/51-dry-bundler-in-capistrano

Before:


namespace :bundler do
  task :create_symlink, :roles => :app do
    shared_dir = File.join(shared_path, 'bundle')
    release_dir = File.join(current_release, '.bundle')
    run("mkdir -p \#{shared_dir} && ln -s \#{shared_dir} \#{release_dir}")
  end

  task :bundle_new_release, :roles => :app do
    bundler.create_symlink
    run "cd \#{release_path} && bundle install --without development test"
  end
end

after 'deploy:update_code', 'bundler:bundle_new_release'

After:


require 'bundler/capistrano'