diff options
author | Colby Swandale <colby@taplaboratories.com> | 2017-04-04 20:49:18 +1000 |
---|---|---|
committer | Colby Swandale <colby@taplaboratories.com> | 2017-04-04 20:49:18 +1000 |
commit | 2fbc5104e9172c6747d43b01aae7c05746907b5d (patch) | |
tree | b768365000aed2447625b5af4a73425de56011f7 | |
parent | 10e6f73bf230bb4478184b6e539c5f25417c6563 (diff) | |
download | bundler-2fbc5104e9172c6747d43b01aae7c05746907b5d.tar.gz |
move validation into #validate_keys
-rw-r--r-- | lib/bundler/dsl.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index ec434bf622..b1f2dec39e 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -321,10 +321,6 @@ module Bundler normalize_hash(opts) - if opts["branch"] && !(opts["git"] || opts["github"]) - raise GemfileError, %(The `branch` option for `gem "#{name}"` is not allowed. Only gems with a git source can specify a branch) - end - git_names = @git_sources.keys.map(&:to_s) validate_keys("gem '#{name}'", opts, valid_keys + git_names) @@ -388,6 +384,11 @@ module Bundler def validate_keys(command, opts, valid_keys) invalid_keys = opts.keys - valid_keys + + if opts["branch"] && !(opts["git"] || opts["github"]) + raise GemfileError, %(The `branch` option for `#{command}` is not allowed. Only gems with a git source can specify a branch) + end + if invalid_keys.any? message = String.new message << "You passed #{invalid_keys.map {|k| ":" + k }.join(", ")} " |