This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2k
bundle inject
with source and group options
#5456
Merged
bundlerbot
merged 8 commits into
rubygems:master
from
Shekharrajak:5452_bundle_inject_options
Apr 7, 2017
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
069cce3
bundle inject can be used with few options
Shekharrajak 67ee37f
test cases added
Shekharrajak b78a3f0
minor changes
Shekharrajak 9f64468
failed testcase fixed
Shekharrajak d73d78c
using source.dump
Shekharrajak cfe4ecc
multiple groups testcase added and confirmation msg added
Shekharrajak 1f466c0
minor change: typo fixed
Shekharrajak 1754e50
writing groups instead of group in the Gemfile
Shekharrajak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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}" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If it's just one group, we shouldn't need to put it in an array |
||
else | ||
", :groups => #{d.groups.inspect}" | ||
end | ||
end | ||
source = ", :source => '#{d.source}'" unless d.source.nil? | ||
%(gem #{name}#{requirement}#{group}#{source}) | ||
end.join("\n") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,6 +52,31 @@ | |
end | ||
end | ||
|
||
context "with source option" do | ||
it "add gem with source option in gemfile" do | ||
bundle "inject 'foo' '>0' --source file://#{gem_repo1}" | ||
gemfile = bundled_app("Gemfile").read | ||
str = "gem 'foo', '> 0', :source => 'file://#{gem_repo1}'" | ||
expect(gemfile).to include str | ||
end | ||
end | ||
|
||
context "with group option" do | ||
it "add gem with group option in gemfile" do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please also add a test for including multiple groups There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for review I have added the testcase for multiple groups in this commit |
||
bundle "inject 'rack-obama' '>0' --group=development" | ||
gemfile = bundled_app("Gemfile").read | ||
str = "gem 'rack-obama', '> 0', :group => [:development]" | ||
expect(gemfile).to include str | ||
end | ||
|
||
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', :groups => [:development, :test]" | ||
expect(gemfile).to include str | ||
end | ||
end | ||
|
||
context "when frozen" do | ||
before do | ||
bundle "install" | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe
"install gem from the given source"
and"Install gem into a bundler group"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for review @colby-swandale . I have edited the PR according to to your comments.