summaryrefslogtreecommitdiff
path: root/lib/bundler/cli/add.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/bundler/cli/add.rb')
-rw-r--r--lib/bundler/cli/add.rb17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/bundler/cli/add.rb b/lib/bundler/cli/add.rb
index 12a681a816..20f76b59d1 100644
--- a/lib/bundler/cli/add.rb
+++ b/lib/bundler/cli/add.rb
@@ -14,6 +14,9 @@ module Bundler
def run
Bundler.ui.level = "warn" if options[:quiet]
+ Bundler::CLI::Common.validate_cooldown!(options[:cooldown])
+ Bundler.settings.set_command_option_if_given :cooldown, options[:cooldown]
+
validate_options!
inject_dependencies
perform_bundle_install unless options["skip-install"]
@@ -31,12 +34,22 @@ module Bundler
Injector.inject(dependencies,
conservative_versioning: options[:version].nil?, # Perform conservative versioning only when version is not specified
- optimistic: options[:optimistic],
+ pessimistic: options[:pessimistic],
strict: options[:strict])
end
def validate_options!
- raise InvalidOption, "You cannot specify `--strict` and `--optimistic` at the same time." if options[:strict] && options[:optimistic]
+ raise InvalidOption, "You cannot specify `--git` and `--github` at the same time." if options["git"] && options["github"]
+
+ unless options["git"] || options["github"]
+ raise InvalidOption, "You cannot specify `--branch` unless `--git` or `--github` is specified." if options["branch"]
+
+ raise InvalidOption, "You cannot specify `--ref` unless `--git` or `--github` is specified." if options["ref"]
+ end
+
+ raise InvalidOption, "You cannot specify `--branch` and `--ref` at the same time." if options["branch"] && options["ref"]
+
+ raise InvalidOption, "You cannot specify `--strict` and `--pessimistic` at the same time." if options[:strict] && options[:pessimistic]
# raise error when no gems are specified
raise InvalidOption, "Please specify gems to add." if gems.empty?