diff options
author | Boggs <hello@boggs.xyz> | 2016-06-27 16:31:48 +0800 |
---|---|---|
committer | Boggs <hello@boggs.xyz> | 2016-06-27 16:31:48 +0800 |
commit | fc207307e126593b927f2dd6d4af32defd521e83 (patch) | |
tree | 49fdd051fe5df06f828ac49f4321a58a964054f1 /lib/bundler/cli | |
parent | d992d9569916e271e210f3a9a4d5a0854af9a3c8 (diff) | |
download | bundler-fc207307e126593b927f2dd6d4af32defd521e83.tar.gz |
Rename flag to `--group`
Remove pry
Fix rubocop offenses
Diffstat (limited to 'lib/bundler/cli')
-rw-r--r-- | lib/bundler/cli/inject.rb | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/bundler/cli/inject.rb b/lib/bundler/cli/inject.rb index 1b659e687b..262514d587 100644 --- a/lib/bundler/cli/inject.rb +++ b/lib/bundler/cli/inject.rb @@ -1,13 +1,12 @@ # frozen_string_literal: true -require "pry-byebug" module Bundler class CLI::Inject - attr_reader :options, :name, :version, :groups, :source, :gems + attr_reader :options, :name, :version, :group, :source, :gems def initialize(options, name, version, gems) @options = options @name = name @version = version || last_version_number - @groups = options[:groups] + @group = options[:group] @source = options[:source] @gems = gems end @@ -15,15 +14,15 @@ module Bundler def run # The required arguments allow Thor to give useful feedback when the arguments # are incorrect. This adds those first two arguments onto the list as a whole. - gems.unshift(source).unshift(groups).unshift(version).unshift(name) + gems.unshift(source).unshift(group).unshift(version).unshift(name) # Build an array of Dependency objects out of the arguments deps = [] - gems.each_slice(4) do |gem_name, gem_version, gem_groups, gem_source| - ops = Gem::Requirement::OPS.map {|key, val| key } + 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 } - gem_version = "~> #{gem_version}" if !has_op - deps << Bundler::Dependency.new(gem_name, gem_version, { "group" => gem_groups, "source" => gem_source }) + gem_version = "~> #{gem_version}" unless has_op + deps << Bundler::Dependency.new(gem_name, gem_version, "group" => gem_group, "source" => gem_source) end added = Injector.inject(deps, options) |