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

Commit

Permalink
Merge pull request #2538 from ndbroadbent/allow_require_true
Browse files Browse the repository at this point in the history
Allow `require: true` as an alias for `require: <name>`
  • Loading branch information
Hemant Kumar committed Jul 18, 2013
2 parents b65fcc0 + 95d251a commit d2678b1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/bundler/runtime.rb
Expand Up @@ -68,6 +68,8 @@ def require(*groups)
# dependency. If there are none, use the dependency's name
# as the autorequire.
Array(dep.autorequire || dep.name).each do |file|
# Allow `require: true` as an alias for `require: <name>`
file = dep.name if file == true
required_file = file
Kernel.require file
end
Expand Down
9 changes: 9 additions & 0 deletions spec/runtime/require_spec.rb
Expand Up @@ -33,6 +33,10 @@
s.write "lib/seven.rb", "puts 'seven'"
end

build_lib "eight", "1.0.0" do |s|
s.write "lib/eight.rb", "puts 'eight'"
end

gemfile <<-G
path "#{lib_path}"
gem "one", :group => :bar, :require => %w(baz qux)
Expand All @@ -42,6 +46,7 @@
gem "five"
gem "six", :group => "string"
gem "seven", :group => :not
gem "eight", :require => true, :group => :require_true
G
end

Expand Down Expand Up @@ -69,6 +74,10 @@
# required in resolver order instead of gemfile order
run("Bundler.require(:not)")
expect(out.split("\n").sort).to eq(['seven', 'three'])

# test require: true
run "Bundler.require(:require_true)"
expect(out).to eq("eight")
end

it "allows requiring gems with non standard names explicitly" do
Expand Down

0 comments on commit d2678b1

Please sign in to comment.