Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Commit

Permalink
writing groups instead of group in the Gemfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Shekharrajak committed Apr 5, 2017
1 parent 1f466c0 commit 1754e50
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion lib/bundler/injector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ def new_gem_lines
@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")
Expand Down
2 changes: 1 addition & 1 deletion spec/commands/inject_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
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
Expand Down

0 comments on commit 1754e50

Please sign in to comment.