diff options
author | David Rodriguez <deivid.rodriguez@riseup.net> | 2021-10-20 21:15:52 +0200 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2021-10-25 20:48:51 +0900 |
commit | 4edcda67b321de12d2fdc5005ff1230d8d0a0c3f (patch) | |
tree | 43b64f3050f713ec6346397869c35accf0403405 /lib/bundler/source | |
parent | 03a563b47e0f021f3b7a8dc14b162068071b4d53 (diff) |
[rubygems/rubygems] Simplify gem downloading inside bundler
We can skip most stuff in `Gem::RemoteFetcher#download`, and use
`Gem::RemoteFetcher#update_cache_path` directly.
This has the benefit of allowing us to remove some workarounds to
support several rubygems versions, but also allows us to pass the target
folder where the gem should be downloaded directly and skip the logic
inside `Gem::RemoteFetcher#download` to infer the cache path. This will
be useful later to fix some issues with the `global_gem_cache` feature
flag.
https://github.com/rubygems/rubygems/commit/8fe74a77e4
Diffstat (limited to 'lib/bundler/source')
-rw-r--r-- | lib/bundler/source/rubygems.rb | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb index 12b7a941f1..ae77f41753 100644 --- a/lib/bundler/source/rubygems.rb +++ b/lib/bundler/source/rubygems.rb @@ -521,17 +521,7 @@ module Bundler else uri = spec.remote.uri Bundler.ui.confirm("Fetching #{version_message(spec)}") - rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, File.dirname(download_cache_path)) - - # older rubygems return varying file:// variants depending on version - rubygems_local_path = rubygems_local_path.gsub(/\Afile:/, "") unless Bundler.rubygems.provides?(">= 3.2.0.rc.2") - rubygems_local_path = rubygems_local_path.gsub(%r{\A//}, "") if Bundler.rubygems.provides?("< 3.1.0") - - if rubygems_local_path != local_path - SharedHelpers.filesystem_access(local_path) do - FileUtils.mv(rubygems_local_path, local_path) - end - end + Bundler.rubygems.download_gem(spec, uri, download_cache_path) cache_globally(spec, local_path) end end |