diff options
| author | Takuya Noguchi <takninnovationresearch@gmail.com> | 2022-09-06 07:37:50 +0000 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-01-07 08:49:23 +0000 |
| commit | 3657700c4069ffd5d9e9b900e75f484f80eb8e3f (patch) | |
| tree | d507ec1efdda76aac966563a0301ba5d07a31174 /lib | |
| parent | 88467996862a15f64ee05e49c9df9b18296c66d6 (diff) | |
[ruby/rubygems] Bundler: validate more options for add sub-command
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
https://github.com/ruby/rubygems/commit/6ca2e28680
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/bundler/cli/add.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/bundler/cli/add.rb b/lib/bundler/cli/add.rb index 12a681a816..9f17604096 100644 --- a/lib/bundler/cli/add.rb +++ b/lib/bundler/cli/add.rb @@ -36,6 +36,16 @@ module Bundler end def validate_options! + 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 `--optimistic` at the same time." if options[:strict] && options[:optimistic] # raise error when no gems are specified |
