diff options
author | Andre Arko <andre@arko.net> | 2011-05-31 13:52:03 -0700 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2011-05-31 13:52:03 -0700 |
commit | daff916275a3efa0298677dd90d6f5ae9b0555e6 (patch) | |
tree | f63221c8a43d13d4bc45a3a301eadaaac137f21b /lib | |
parent | f87201bcbc075607c2c3c85cb1b54a80ab8a36db (diff) | |
download | bundler-daff916275a3efa0298677dd90d6f5ae9b0555e6.tar.gz |
Update rubygems integration for upcoming 1.8.5 bugfix
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 888f77ec..d4aa8255 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -270,10 +270,12 @@ module Bundler def find_name(name) Gem::Specification.find_all_by_name name end + end - # Rubygems 1.8 changes Gem.dir when you call Gem::Installer#install with - # an :install_path option. I guess this makes sense for them, but we have - # to change it back for our sudo mode to work. + class AlmostModern < Modern + # Rubygems [>= 1.8.0, < 1.8.5] has a bug that changes Gem.dir whenever + # you call Gem::Installer#install with an :install_dir set. We have to + # change it back for our sudo mode to work. def preserve_paths old_dir, old_path = gem_dir, gem_path yield @@ -283,16 +285,13 @@ module Bundler end - if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.7.0') - if Gem::Specification.respond_to? :all= - # >= 1.8 - @rubygems = RubygemsIntegration::Modern.new - else - # 1.7.x - @rubygems = RubygemsIntegration::Transitional.new - end - else - # < 1.7.0 + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.5') + @rubygems = RubygemsIntegration::Modern.new + elsif Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.8.0') + @rubygems = RubygemsIntegration::AlmostModern.new + elsif Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.7.0') + @rubygems = RubygemsIntegration::Transitional.new + else # Rubygems 1.3.6 through 1.6.2 @rubygems = RubygemsIntegration::Legacy.new end |