diff options
author | The Bundler Bot <bot@bundler.io> | 2017-04-07 03:35:05 +0000 |
---|---|---|
committer | The Bundler Bot <bot@bundler.io> | 2017-04-07 03:35:05 +0000 |
commit | 32fb8327328789bdc911dccda4a59e99956c558c (patch) | |
tree | 92e0de674fdd0a70d844fd268ad7f2c881a67d5c /spec | |
parent | 7358d857d32ce07c79b874e60441b971ff4c0f24 (diff) | |
parent | 1754e5019fe7f97db6d24f11bba8768d1dca7772 (diff) | |
download | bundler-32fb8327328789bdc911dccda4a59e99956c558c.tar.gz |
Auto merge of #5456 - Shekharrajak:5452_bundle_inject_options, r=colby-swandale
`bundle inject` with source and group options
Fixes https://github.com/bundler/bundler/issues/5452
Eg
```
$ bundle inject "bootstrap" ">0" --source=https://rubygems.org --group=development
Fetching gem metadata from https://rubygems.org/............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Fetching gem metadata from https://rubygems.org/.............
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Added to Gemfile:
bootstrap (> 0), group => [:development], :source => 'https://rubygems.org'
```
In GemFile
```
gem 'bootstrap', '> 0', :group => [:development], :source => 'https://rubygems.org'
```
### Multiple group :
```
$ dbundle inject "bootstrap" ">0" --source=https://rubygems.org --group=development,production
Fetching gem metadata from https://rubygems.org/............
Added to Gemfile:
gem 'bootstrap', '> 0', :group => [:development, :production], :source => 'https://rubygems.org'
```
In gemfile
```
# Added at 2017-03-24 11:40:51 +0530 by shekharrajak:
gem 'bootstrap', '> 0', :group => [:development, :production], :source => 'https://rubygems.org'
```
Diffstat (limited to 'spec')
-rw-r--r-- | spec/commands/inject_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/commands/inject_spec.rb b/spec/commands/inject_spec.rb index dd5e22498b..5c711b32a0 100644 --- a/spec/commands/inject_spec.rb +++ b/spec/commands/inject_spec.rb @@ -52,6 +52,31 @@ Usage: "bundle inject GEM VERSION" 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 + 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" |