Adding bundle install to your Capistrano Deploy file
If you're using bundler to manage your ruby gems, and capistrano to deploy your application, this handy deploy task can save you some time.
Add the following to deploy.rb
# ...lots of other code
namespace :bundle do
desc "run bundle install and ensure all gem requirements are met"
task :install do
run "cd #{current_path} && bundle install --without=test --no-update-sources"
end
end
before "deploy:restart", "bundle:install"
After the code on the server has been updated, but before the application has been restarted, this task will run bundle install to ensure all gem requirements are met.
Note: "--without=test" and "--no-update-source" are optional. "--without=test" ignores any gems that are in the test group within your Gemfile and "--no-update-source" speeds things up a little by skipping the "Fetching source index for http://rubygems.org/..."
0 comments