summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2010-04-14 21:02:22 -0700
committerAndre Arko <andre@arko.net>2010-04-14 21:20:47 -0700
commit0753a247d516346c8a0804915267f9fa93d692db (patch)
tree4c5d8fc99884a84e741cc625ad2f39b0f71c3a74
parent45baf3d4711522ec5b8df137dde857a83fff45be (diff)
downloadbundler-0753a247d516346c8a0804915267f9fa93d692db.tar.gz
Stop infinite recursion in locked bundles that include Bundler
Closes #276
-rw-r--r--lib/bundler.rb6
-rw-r--r--spec/runtime/environment_rb_spec.rb11
2 files changed, 15 insertions, 2 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 7ac0954082..6477775139 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -66,7 +66,7 @@ module Bundler
end
end
- def setup(*groups)
+ def gem_setup(*groups)
return @setup if @setup
begin
@@ -87,10 +87,12 @@ module Bundler
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
diff --git a/spec/runtime/environment_rb_spec.rb b/spec/runtime/environment_rb_spec.rb
index 5005d53907..6db3189f71 100644
--- a/spec/runtime/environment_rb_spec.rb
+++ b/spec/runtime/environment_rb_spec.rb
@@ -198,4 +198,15 @@ describe "environment.rb file" do
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