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

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Shekharrajak committed Feb 22, 2017
1 parent 67ee37f commit dd31394
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 17 deletions.
4 changes: 2 additions & 2 deletions lib/bundler/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -466,9 +466,9 @@ def platform

desc "inject GEM VERSION", "Add the named gem, with version requirements, to the resolved Gemfile"
method_option "source", :type => :string, :banner =>
"Use the specific source for the gem"
"Install gem from the given source"
method_option "group", :type => :string, :banner =>
"Put the gem into specific group"
"Install gem into a bundler group"
def inject(name, version)
SharedHelpers.major_deprecation "The `inject` command has been replaced by the `add` command"
require "bundler/cli/inject"
Expand Down
2 changes: 1 addition & 1 deletion lib/bundler/definition.rb
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ def specs
bundler = local.search(Gem::Dependency.new("bundler", VERSION)).last
specs["bundler"] = bundler if bundler
end

specs

end
end

Expand Down
23 changes: 9 additions & 14 deletions spec/commands/inject_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,26 +52,21 @@
end
end

context "use source and group options" do
it "add gem with source in gemfile" do
bundle "inject 'bootstrap' '>0' --source=https://rubygems.org"
context "with source option" do
it "add gem with source option in gemfile" do
bundle "inject 'bootstrap' '>0' --source=https://ruby.taobao.org/"
gemfile = bundled_app("Gemfile").read
str = "gem 'bootstrap', '> 0', :source => 'https://rubygems.org'"
expect(gemfile).to match(/str/)
str = "gem 'bootstrap', '> 0', :source => 'https://ruby.taobao.org/'"
expect(gemfile).to include str
end
end

it "add gem with group in gemfile" do
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 match(/str/)
end

it "add gem with source and group in gemfile" do
bundle "inject 'rails' '>0' --source=https://rubygems.org --group=development"
gemfile = bundled_app("Gemfile").read
str = "gem 'rails', '> 0', :group => [:development], :source => 'https://rubygems.org'"
expect(gemfile).to match(/str/)
expect(gemfile).to include str
end
end

Expand Down

0 comments on commit dd31394

Please sign in to comment.