Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
fixes for capistrano integration
Browse files Browse the repository at this point in the history
switch the bundler hook to before "deploy:finalize_update", so that finalize_update will not run if `bundle install` fails. (thanks @leehambley)

change from `current_release` to `latest_release`, because both cap and vlad provide more robust directory-finding code behind `latest_release`. (thanks @dontangg)

closes #1264
  • Loading branch information
indirect committed May 27, 2012
1 parent 978d0f5 commit 11851a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/bundler/capistrano.rb
Expand Up @@ -5,7 +5,7 @@
require 'bundler/deployment'

Capistrano::Configuration.instance(:must_exist).load do
after "deploy:finalize_update", "bundle:install"
before "deploy:finalize_update", "bundle:install"
Bundler::Deployment.define_task(self, :task, :except => { :no_release => true })
set :rake, lambda { "#{fetch(:bundle_cmd, "bundle")} exec rake" }
end
8 changes: 4 additions & 4 deletions lib/bundler/deployment.rb
Expand Up @@ -41,16 +41,16 @@ def self.define_task(context, task_method = :task, opts = {})
bundle_dir = context.fetch(:bundle_dir, File.join(context.fetch(:shared_path), 'bundle'))
bundle_gemfile = context.fetch(:bundle_gemfile, "Gemfile")
bundle_without = [*context.fetch(:bundle_without, [:development, :test])].compact
current_release = context.fetch(:current_release)
if current_release.to_s.empty?
app_path = context.fetch(:latest_release)
if app_path.to_s.empty?
raise error_type.new("Cannot detect current release path - make sure you have deployed at least once.")
end
args = ["--gemfile #{File.join(current_release, bundle_gemfile)}"]
args = ["--gemfile #{File.join(app_path, bundle_gemfile)}"]
args << "--path #{bundle_dir}" unless bundle_dir.to_s.empty?
args << bundle_flags.to_s
args << "--without #{bundle_without.join(" ")}" unless bundle_without.empty?

run "cd #{current_release} && #{bundle_cmd} install #{args.join(' ')}"
run "cd #{app_path} && #{bundle_cmd} install #{args.join(' ')}"
end
end
end
Expand Down

0 comments on commit 11851a5

Please sign in to comment.