diff options
author | Homu <homu@barosl.com> | 2016-02-11 16:48:44 +0900 |
---|---|---|
committer | Homu <homu@barosl.com> | 2016-02-11 16:48:44 +0900 |
commit | 3f5e01816d6822dfe0c3454f9df41f7dcca3c91a (patch) | |
tree | c4123a6978e1999f69067111989ef6a56473bf7c /lib | |
parent | e76760d1a492cf457a9952da2e5c24a3ba50b51d (diff) | |
parent | 52261a1db8a37f70ac78630f86dd382d5fcbeb72 (diff) | |
download | bundler-3f5e01816d6822dfe0c3454f9df41f7dcca3c91a.tar.gz |
Auto merge of #4291 - RochesterinNYC:add-clarifying-usage-message-for-deployment-and-system, r=indirect
Add alternative error message for when `--deployment` and `--system` flags are both used on `bundle install`
Calling `bundle install --deployment --system` currently results in the following error message:
```
$ bundle install --deployment --system
You have specified both a path to install your gems to,
as well as --system. Please choose.
```
which is a little confusing.
This PR changes the behavior to:
```
$ bundle install --deployment --system
You have specified both --deployment as well as --system. Please choose. #<-- in red
```
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/cli/install.rb | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/bundler/cli/install.rb b/lib/bundler/cli/install.rb index 0e859996..8f27f7cf 100644 --- a/lib/bundler/cli/install.rb +++ b/lib/bundler/cli/install.rb @@ -45,11 +45,7 @@ module Bundler # Just disable color in deployment mode Bundler.ui.shell = Thor::Shell::Basic.new if options[:deployment] - if (options[:path] || options[:deployment]) && options[:system] - Bundler.ui.error "You have specified both a path to install your gems to, \n" \ - "as well as --system. Please choose." - exit 1 - end + check_for_options_conflicts if options["trust-policy"] unless Bundler.rubygems.security_policies.keys.include?(options["trust-policy"]) @@ -185,5 +181,14 @@ module Bundler Bundler.ui.confirm "Post-install message from #{name}:" Bundler.ui.info msg end + + def check_for_options_conflicts + if (options[:path] || options[:deployment]) && options[:system] + error_message = String.new + error_message << "You have specified both a path to install your gems to as well as --system. Please choose.\n" if options[:path] + error_message << "You have specified both --deployment as well as --system. Please choose.\n" if options[:deployment] + raise InvalidOption.new(error_message) + end + end end end |