diff options
author | Andre Arko <andre@arko.net> | 2010-11-04 11:33:11 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2010-11-04 11:33:11 -0700 |
commit | 7d0ec385ee92ac7ed5a2ca023e64df72424f73fa (patch) | |
tree | eace110405ac34e5b3a8b3d39ee1efe49b60d997 | |
parent | e060b8735388d2cfdc603eb076f735683004e17f (diff) | |
download | bundler-7d0ec385ee92ac7ed5a2ca023e64df72424f73fa.tar.gz |
p.include? is not a legitimate path comparison
Closes #328
-rw-r--r-- | lib/bundler/shared_helpers.rb | 4 | ||||
-rw-r--r-- | spec/runtime/setup_spec.rb | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/bundler/shared_helpers.rb b/lib/bundler/shared_helpers.rb index 61dd448b46..23e3d01cef 100644 --- a/lib/bundler/shared_helpers.rb +++ b/lib/bundler/shared_helpers.rb @@ -57,9 +57,9 @@ module Bundler if defined?(::Gem) me = File.expand_path("../../", __FILE__) $LOAD_PATH.reject! do |p| - next if File.expand_path(p).include?(me) + next if File.expand_path(p) =~ /^#{me}/ p != File.dirname(__FILE__) && - Gem.path.any? { |gp| p.include?(gp) } + Gem.path.any?{|gp| p =~ /^#{gp}/ } end $LOAD_PATH.uniq! end diff --git a/spec/runtime/setup_spec.rb b/spec/runtime/setup_spec.rb index 73c070813b..1bfa4ca79a 100644 --- a/spec/runtime/setup_spec.rb +++ b/spec/runtime/setup_spec.rb @@ -156,6 +156,14 @@ describe "Bundler.setup" do run "require 'yard'" out.should == "bundler-#{Bundler::VERSION}\nyard-1.0" end + + context "when the ruby stdlib is a substring of Gem.path" do + it "does not reject the stdlib from $LOAD_PATH" do + substring = "/" + $LOAD_PATH.find{|p| p =~ /vendor_ruby/ }.split("/")[2] + run "puts 'worked!'", :env => {"GEM_PATH" => substring} + out.should == "worked!" + end + end end end |