diff options
author | Samuel Giddins <segiddins@segiddins.me> | 2016-07-14 22:32:35 -0500 |
---|---|---|
committer | Samuel Giddins <segiddins@segiddins.me> | 2016-07-19 17:13:44 -0500 |
commit | bd491f0e44d9f0ba5497f29e24a8ca110f8eec89 (patch) | |
tree | ce39270b0871ed52c25cb4102aaa2a6bd7a9e62a | |
parent | 4fbbfa344b0a2251931a976444a02002adbe18f4 (diff) | |
download | bundler-bd491f0e44d9f0ba5497f29e24a8ca110f8eec89.tar.gz |
[RubygemsIntegration] Move reset and post_reset hooks to instance methods
-rw-r--r-- | lib/bundler.rb | 9 | ||||
-rw-r--r-- | lib/bundler/rubygems_integration.rb | 19 |
2 files changed, 21 insertions, 7 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb index a926ee1dcd..6d64a2eb28 100644 --- a/lib/bundler.rb +++ b/lib/bundler.rb @@ -389,11 +389,10 @@ module Bundler @locked_gems = nil @bundle_path = nil @bin_path = nil - if defined?(@rubygems) && @rubygems - rubygems.undo_replacements - @rubygems = nil - end - Gem::Specification.reset + return unless defined?(@rubygems) && @rubygems + rubygems.undo_replacements + rubygems.reset + @rubygems = nil end private diff --git a/lib/bundler/rubygems_integration.rb b/lib/bundler/rubygems_integration.rb index 53e3a50d4a..37d937cc74 100644 --- a/lib/bundler/rubygems_integration.rb +++ b/lib/bundler/rubygems_integration.rb @@ -136,6 +136,14 @@ module Bundler Gem.path end + def reset + Gem::Specification.reset + end + + def post_reset_hooks + Gem.post_reset_hooks + end + def gem_cache gem_path.map {|p| File.expand_path("cache", p) } end @@ -472,9 +480,9 @@ module Bundler @replaced_methods.each do |(sym, klass), method| redefine_method(klass, sym, method) end - Gem.post_reset_hooks.reject! do |proc| + post_reset_hooks.reject! do |proc| proc.binding.eval("__FILE__") == __FILE__ - end if provides?(">= 1.8") + end @replaced_methods.clear end @@ -530,6 +538,13 @@ module Bundler # which is too strict for the kinds of checks we care about. As a # result, validation is disabled on versions of RubyGems below 1.7. end + + def post_reset_hooks + [] + end + + def reset + end end # Rubygems versions 1.3.6 and 1.3.7 |