How do I manage bundled gems in a capistrano deplo

2020-07-18 05:14发布

问题:

Currently, I'm just running the following:

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

namespace :deploy do
  task :bundle do
    run "cd #{release_path} && bundle install --deployment --without development test staging"
  end
end

Now this works fine, but the bundler ends up installing all the gems to vendor/gems every time. While I understand the merit in isolating the gems to each release (as opposed to using the shared folder, which (?) might result in errors on rollback and such), surely there is a better way to do this that doesn't take as much time to deploy and saves on disk space.

回答1:

Things have changed after the release of bundler 1.0

You don't need to create a custom task from deploy.

just use require 'bundler/capistrano'

take a look at this http://blog.josephholsten.com/2010/09/deploying-with-bundler-and-capistrano/ for more details