Created
March 15, 2011 11:18
-
-
Save markoa/870606 to your computer and use it in GitHub Desktop.
The snippet for config/deploy.rb to use Bundler.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# use this in a after "deploy:update_code" block | |
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 | |
shared_dir = File.join(shared_path, 'bundle') | |
run "cd #{release_path} && bundle install --path #{shared_dir} --without test development" | |
end | |
task :lock, :roles => :app do | |
run "cd #{current_release} && bundle lock;" | |
end | |
task :unlock, :roles => :app do | |
run "cd #{current_release} && bundle unlock;" | |
end | |
end |
nevermind, I RTFM and figured that out. But a better question is when to lock and unlock. You lock after you do a bundle install and unlock only when you are changing your Gemfile and redeploying?
I don't ever do anything to Gemfile.lock - Bundler changes it itself when you do a bundle install and a newer version of something is available, or you add a new dependency to Gemfile.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Marko,
Which of these tasks will need to be run after each deployment?