aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2011-05-24 12:45:32 -0700
committerAndre Arko <andre@arko.net>2011-05-24 12:45:32 -0700
commit09b98f75e497f2bdc079e9b8f7c92bc8d3ed4782 (patch)
tree2f4085da8ee33a4f690a9910dcb5c9f14503703c /lib/bundler
parent74679e6b4c8e5a782b9b31b952424575d204a8a1 (diff)
downloadbundler-09b98f75e497f2bdc079e9b8f7c92bc8d3ed4782.tar.gz
note which versions each rubygems integration corresponds to
Diffstat (limited to 'lib/bundler')
-rw-r--r--lib/bundler/rubygems_integration.rb43
1 files changed, 25 insertions, 18 deletions
diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb
index c95a35b0..4da6ef00 100644
--- a/lib/bundler/rubygems_integration.rb
+++ b/lib/bundler/rubygems_integration.rb
@@ -224,44 +224,48 @@ module Bundler
Gem.clear_paths
end
- class Modern < RubygemsIntegration
+ # Rubygems versions 1.3.6 through 1.6.2
+ class Legacy < RubygemsIntegration
def stub_rubygems(specs)
- Gem::Specification.all = specs
-
- Gem.post_reset {
- Gem::Specification.all = specs
- }
-
- stub_source_index170(specs)
+ stub_source_index137(specs)
end
def all_specs
- Gem::Specification.to_a
+ Gem.source_index.gems.values
end
def find_name(name)
- Gem::Specification.find_all_by_name name
+ Gem.source_index.find_name(name)
end
+ end
+ # Rubygems 1.7
+ class Transitional < Legacy
+ def stub_rubygems(specs)
+ stub_source_index170(specs)
+ end
end
- class Legacy < RubygemsIntegration
+ # Rubygems 1.8
+ class Modern < RubygemsIntegration
def stub_rubygems(specs)
- stub_source_index137(specs)
+ Gem::Specification.all = specs
+
+ Gem.post_reset {
+ Gem::Specification.all = specs
+ }
+
+ stub_source_index170(specs)
end
def all_specs
- Gem.source_index.gems.values
+ Gem::Specification.to_a
end
def find_name(name)
- Gem.source_index.find_name(name)
+ Gem::Specification.find_all_by_name name
end
- end
- class Transitional < Legacy
- def stub_rubygems(specs)
- stub_source_index170(specs)
end
end
@@ -269,11 +273,14 @@ module Bundler
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
@rubygems = RubygemsIntegration::Legacy.new
end