diff options
author | shekharrajak <shekharstudy@ymail.com> | 2017-02-01 14:29:19 +0530 |
---|---|---|
committer | shekharrajak <shekharstudy@ymail.com> | 2017-02-01 14:29:19 +0530 |
commit | 3ef05361e8fc8b4ae1225f1dba8428c66e953d27 (patch) | |
tree | b15e2aa16dce3ad6498d816d60a4d615c68c601a | |
parent | 8c0cbf3c03a56b8cdfeaba2558c35f461608b287 (diff) | |
download | bundler-3ef05361e8fc8b4ae1225f1dba8428c66e953d27.tar.gz |
do not take more than one gem and version as arg
-rw-r--r-- | lib/bundler/cli.rb | 6 | ||||
-rw-r--r-- | lib/bundler/cli/inject.rb | 5 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/bundler/cli.rb b/lib/bundler/cli.rb index a70d66f200..cb20dddc16 100644 --- a/lib/bundler/cli.rb +++ b/lib/bundler/cli.rb @@ -461,11 +461,11 @@ module Bundler Platform.new(options).run end - desc "inject GEM VERSION ...", "Add the named gem(s), with version requirements, to the resolved Gemfile" - def inject(name, version, *gems) + desc "inject GEM VERSION" "Add the named gem, with version requirements, to the resolved Gemfile" + def inject(name, version) SharedHelpers.major_deprecation "The `inject` command has been replaced by the `add` command" require "bundler/cli/inject" - Inject.new(options, name, version, gems).run + Inject.new(options, name, version).run end desc "lock", "Creates a lockfile without installing" diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index 9d1d08120a..994bcb4993 100644 --- a/lib/bundler/cli/inject.rb +++ b/lib/bundler/cli/inject.rb @@ -2,13 +2,13 @@ module Bundler class CLI::Inject attr_reader :options, :name, :version, :group, :source, :gems - def initialize(options, name, version, gems) + def initialize(options, name, version) @options = options @name = name @version = version || last_version_number @group = options[:group] @source = options[:source] - @gems = gems + @gems = [] end def run @@ -18,6 +18,7 @@ module Bundler # Build an array of Dependency objects out of the arguments deps = [] + # when `inject` will support addition of multiple gem, then this loop will help. gems.each_slice(4) do |gem_name, gem_version, gem_group, gem_source| ops = Gem::Requirement::OPS.map {|key, _val| key } has_op = ops.any? {|op| gem_version.start_with? op } |