diff options
| author | Anthony Panozzo <panozzaj@gmail.com> | 2026-01-05 13:04:14 -0500 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2026-02-12 17:06:37 +0000 |
| commit | a55874406cb1be41073c6353052bb88d44123217 (patch) | |
| tree | fdba0b3fd2c4e2e02f4cccbc22d87f632df86eec | |
| parent | 2475f67c575b74d733929aa72e779a1f923d187b (diff) | |
[ruby/rubygems] Add backwards compatibility for Bundler with older RubyGems
Guard against missing Gem.global_gem_cache_path method when
Bundler is used with an older RubyGems version that doesn't
have the global cache feature. Falls back to the previous
Bundler.user_cache location.
Suggested by skipkayhil.
https://github.com/ruby/rubygems/commit/a4bb3a20f8
| -rw-r--r-- | lib/bundler/source/rubygems.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 1ad1a74fbd..e679010e97 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -504,7 +504,12 @@ module Bundler return unless remote = spec.remote return unless cache_slug = remote.cache_slug - Pathname.new(Gem.global_gem_cache_path).join(cache_slug) + if Gem.respond_to?(:global_gem_cache_path) + Pathname.new(Gem.global_gem_cache_path).join(cache_slug) + else + # Fall back to old location for older RubyGems versions + Bundler.user_cache.join("gems", cache_slug) + end end def extension_cache_slug(spec) |
