Skip to content

Instantly share code, notes, and snippets.

@samlown
Created August 25, 2010 13:41
Show Gist options
  • Save samlown/549528 to your computer and use it in GitHub Desktop.
Save samlown/549528 to your computer and use it in GitHub Desktop.
namespace :bundler do
task :create_symlinks, :roles => :app do
shared_bundle_path = File.join(shared_path, 'bundle')
release_bundle_path = File.join(current_release, '.bundle')
run("mkdir -p #{shared_bundle_path} && ln -s #{shared_bundle_path} #{release_bundle_path}")
shared_gemfile_path = File.join(shared_path, 'bundle', 'Gemfile.lock')
release_gemfile_path = File.join(current_release, 'Gemfile.lock')
run "touch #{shared_gemfile_path}"
run "ln -s #{shared_gemfile_path} #{release_gemfile_path}"
end
task :install, :roles => :app do
bundler.create_symlinks
shared_bundle_path = File.join(shared_path, 'bundle')
run "cd #{release_path} && bundle install --path #{shared_bundle_path} --without test"
end
task :update, :roles => :app do
run "cd #{current_release} && bundle update;"
end
end
after "deploy:update_code" do
bundler.install
end
@therobot
Copy link

What are the advantadges?

@samlown
Copy link
Author

samlown commented Aug 26, 2010

The --path is now required in Bundler 1.0 as by default it will try to install to the system gems (sudo password fail). Locking is now always enabled, so you need to copy the Gemfile.lock and allow updates to go more quickly. The 'cap bundler:install' will only add new gems, it won't update the old, which is when 'cap bundler:update' comes in.

The problem is when you change Rails versions, it looses track so you need to access the server manually to get it working again :-( At least thats what I was battling with the other day. I may have mis-understood the problem!

I can't help feeling I'm over-complicating or missing something .... :-S

sam

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment