summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorshekharrajak <shekharstudy@ymail.com>2017-04-05 10:19:04 +0530
committershekharrajak <shekharstudy@ymail.com>2017-04-05 10:32:15 +0530
commit1754e5019fe7f97db6d24f11bba8768d1dca7772 (patch)
treee7f7891363d40e8d41214dd0dccb06499d1e8384
parent1f466c04a6d3ea54abfafc4d5fde0a17717ade55 (diff)
downloadbundler-1754e5019fe7f97db6d24f11bba8768d1dca7772.tar.gz
writing groups instead of group in the Gemfile
-rw-r--r--lib/bundler/injector.rb9
-rw-r--r--spec/commands/inject_spec.rb2
2 files changed, 9 insertions, 2 deletions
diff --git a/lib/bundler/injector.rb b/lib/bundler/injector.rb
index 787d95fd9c..7c78486dac 100644
--- a/lib/bundler/injector.rb
+++ b/lib/bundler/injector.rb
@@ -51,7 +51,14 @@ module Bundler
@new_deps.map do |d|
name = "'#{d.name}'"
requirement = ", '#{d.requirement}'"
- group = ", :group => #{d.groups.inspect}" if d.groups != Array(:default)
+ if d.groups != Array(:default)
+ group =
+ if d.groups.size == 1
+ ", :group => #{d.groups.inspect}"
+ else
+ ", :groups => #{d.groups.inspect}"
+ end
+ end
source = ", :source => '#{d.source}'" unless d.source.nil?
%(gem #{name}#{requirement}#{group}#{source})
end.join("\n")
diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb
index f39818b04e..5c711b32a0 100644
--- a/spec/commands/inject_spec.rb
+++ b/spec/commands/inject_spec.rb
@@ -72,7 +72,7 @@ Usage: "bundle inject GEM VERSION"
it "add gem with multiple groups in gemfile" do
bundle "inject 'rack-obama' '>0' --group=development,test"
gemfile = bundled_app("Gemfile").read
- str = "gem 'rack-obama', '> 0', :group => [:development, :test]"
+ str = "gem 'rack-obama', '> 0', :groups => [:development, :test]"
expect(gemfile).to include str
end
end