summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <website+github.com@arko.net>2011-09-13 11:54:57 -0700
committerAndre Arko <website+github.com@arko.net>2011-09-13 11:54:57 -0700
commitf995bc7fc148cf84ad4be9ab1f18e7277b154b5e (patch)
treecf5ff083820f1232cb6e6fc63f6e2f7cbd46b2a6
parent9f80959eb316c78f90f7725a030eb39dacc727af (diff)
parent704545214e7da8085c543697696fa72750a8a125 (diff)
downloadbundler-f995bc7fc148cf84ad4be9ab1f18e7277b154b5e.tar.gz
Merge pull request #1411 from nextmat/improve_current_release_detection
Useful error message when current_release is nil
-rw-r--r--lib/bundler/deployment.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/bundler/deployment.rb b/lib/bundler/deployment.rb
index 727f357e7e..213972a794 100644
--- a/lib/bundler/deployment.rb
+++ b/lib/bundler/deployment.rb
@@ -4,9 +4,11 @@ module Bundler
if defined?(Capistrano) && context.is_a?(Capistrano::Configuration)
context_name = "capistrano"
role_default = "{:except => {:no_release => true}}"
+ error_type = ::Capistrano::CommandError
else
context_name = "vlad"
role_default = "[:app]"
+ error_type = ::Rake::CommandFailedError
end
roles = context.fetch(:bundle_roles, false)
@@ -39,13 +41,16 @@ module Bundler
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
-
- args = ["--gemfile #{File.join(context.fetch(:current_release), bundle_gemfile)}"]
+ current_release = context.fetch(:current_release)
+ if current_release.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 << "--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 #{context.fetch(:current_release)} && #{bundle_cmd} install #{args.join(' ')}"
+ run "cd #{current_release} && #{bundle_cmd} install #{args.join(' ')}"
end
end
end