diff options
author | Andre Arko <andre@arko.net> | 2010-04-22 08:51:29 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2010-04-22 08:59:38 -0700 |
commit | ec337585f5db20ceeb73beaa6d1138a14438f9c9 (patch) | |
tree | 5ebabba7a872e8f76363333ca6eeacb521612932 | |
parent | 63b145d7942fbeb84f899fb7a301a607525d313f (diff) | |
download | bundler-ec337585f5db20ceeb73beaa6d1138a14438f9c9.tar.gz |
Loading Bundler in a bundle should leave gem's #load_paths alone
-rw-r--r-- | lib/bundler/rubygems_ext.rb | 8 | ||||
-rw-r--r-- | spec/runtime/environment_rb_spec.rb | 15 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb index 52b352ce91..bf74a60562 100644 --- a/lib/bundler/rubygems_ext.rb +++ b/lib/bundler/rubygems_ext.rb @@ -10,7 +10,13 @@ module Gem attr_accessor :source, :location def load_paths - require_paths.map {|p| File.join(full_gem_path, p) } + require_paths.map do |require_path| + if require_path.include?(full_gem_path) + require_path + else + File.join(full_gem_path, require_path) + end + end end def groups diff --git a/spec/runtime/environment_rb_spec.rb b/spec/runtime/environment_rb_spec.rb index 608e4e7159..73a388c5c5 100644 --- a/spec/runtime/environment_rb_spec.rb +++ b/spec/runtime/environment_rb_spec.rb @@ -262,6 +262,21 @@ describe "environment.rb file" do err.should be_empty end + it "does not munge a gem's load_paths when they are already munged" do + install_gemfile <<-G + source "file://#{gem_repo1}" + gem "bundler", :path => "#{File.expand_path("..", lib)}" + gem "rake" + G + bundle :lock + + run <<-RUBY, :lite_runtime => true + require 'bundler' + puts Gem.source_index.find_name("rake").first.load_paths + RUBY + out.should == default_bundle_path("gems/rake-0.8.7/lib").to_s + end + it "does not write out env.rb if env.rb has already been loaded" do install_gemfile <<-G source "file://#{gem_repo1}" |