aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2011-05-24 10:36:36 -0700
committerAndre Arko <andre@arko.net>2011-05-24 10:36:36 -0700
commit98ebb10cc173aba07b46989e574f87745ade5786 (patch)
treefc64864f9e90b3d45d586b4187d34a2cab2e06bc /lib
parent322321e9f71c0b5ffdb703ad4e5c29b403ed4682 (diff)
downloadbundler-98ebb10cc173aba07b46989e574f87745ade5786.tar.gz
cache Gem.dir and Gem.bindir because Rubygems 1.8 changes them
specifically, when you call Gem::Installer#install, Rubygems 1.8 overwrites Gem.dir with the :install_path you passed to the Installer
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler/rubygems_integration.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index 76f3c435..91e22a95 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -3,6 +3,11 @@ module Bundler
def initialize
# Work around a RubyGems bug
configuration
+
+ # Cache Gem.dir and Gem.bindir because Rubygems 1.8 treats them as globals,
+ # changing them anytime you use Gem::Installer#install.
+ gem_dir
+ gem_bindir
end
def loaded_specs(name)
@@ -46,11 +51,14 @@ module Bundler
end
def gem_dir
- Gem.dir.to_s
+ # We cache this because Rubygems 1.8 changes Gem.dir every time
+ # a gem is installed, and we need the original.
+ @gem_dir ||= Gem.dir
end
def gem_bindir
- Gem.bindir
+ # We cache this for the same reason we cache gem_dir.
+ @gem_bindir ||= Gem.bindir
end
def user_home