Skip to content

Instantly share code, notes, and snippets.

@richievos
Created November 28, 2009 06:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save richievos/244420 to your computer and use it in GitHub Desktop.
Save richievos/244420 to your computer and use it in GitHub Desktop.
namespace :bundler do
task :install, :roles => :app, :except => { :no_release => true } do
run("gem install bundler --source=http://gemcutter.org")
end
task :symlink_vendor, :roles => :app, :except => { :no_release => true } do
shared_gems = File.join(shared_path, 'vendor/gems/ruby/1.8')
release_gems = "#{release_path}/vendor/gems/ruby/1.8"
# if you don't commit your cache, add cache to this list
%w(gems specifications).each do |sub_dir|
shared_sub_dir = File.join(shared_gems, sub_dir)
run("mkdir -p #{shared_sub_dir} && mkdir -p #{release_gems} && ln -s #{shared_sub_dir} #{release_gems}/#{sub_dir}")
end
end
task :bundle_new_release, :roles => :app, :except => { :no_release => true } do
bundler.symlink_vendor
# if you don't commit your cache, remove --cached from this line
run("cd #{release_path} && gem bundle --only #{rails_env} --cached")
end
end
after 'deploy:update_code', 'bundler:bundle_new_release'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment