Skip to content
Browse files

Stop infinite recursion in locked bundles that include Bundler

Closes #276
  • Loading branch information...
1 parent 45baf3d commit 0753a247d516346c8a0804915267f9fa93d692db @indirect indirect committed Apr 14, 2010
Showing with 15 additions and 2 deletions.
  1. +4 −2 lib/bundler.rb
  2. +11 −0 spec/runtime/environment_rb_spec.rb
View
6 lib/bundler.rb
@@ -66,7 +66,7 @@ def bundle_path
end
end
- def setup(*groups)
+ def gem_setup(*groups)
return @setup if @setup
begin
@@ -87,10 +87,12 @@ def setup(*groups)
exit!
end
end
+ alias setup gem_setup unless Bundler.respond_to?(:setup)
- def require(*groups)
+ def gem_require(*groups)
setup(*groups).require(*groups)
end
+ alias require gem_require unless Bundler.respond_to?(:require)
def load
@load ||= begin
View
11 spec/runtime/environment_rb_spec.rb
@@ -198,4 +198,15 @@ def Bundler.require(path)
end
end
+ describe "when Bundler is bundled" do
+ it "doesn't blow up" do
+ install_gemfile <<-G
+ gem "bundler", :path => "#{File.expand_path("..", lib)}"
+ G
+ bundle :lock
+
+ bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
+ err.should == ""
+ end
+ end
end

0 comments on commit 0753a24

Please sign in to comment.
Something went wrong with that request. Please try again.