summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rodriguez <deivid.rodriguez@riseup.net>2021-10-20 19:02:21 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2021-10-25 20:48:50 +0900
commit38542cfffc02216eb9de7e470f3e1574dee1aeea (patch)
tree7e0c1919f0ffc59990b4893c2cadb162b23c9445
parentedc1813190b83169e4cf1ed9cc1419ccb5c3b594 (diff)
downloadruby-38542cfffc02216eb9de7e470f3e1574dee1aeea.tar.gz
[rubygems/rubygems] Extract a `default_cache_path` helper
https://github.com/rubygems/rubygems/commit/8319305d58
-rw-r--r--lib/bundler/source/rubygems.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/bundler/source/rubygems.rb b/lib/bundler/source/rubygems.rb
index dca1d72577..fb5234cbb4 100644
--- a/lib/bundler/source/rubygems.rb
+++ b/lib/bundler/source/rubygems.rb
@@ -461,7 +461,7 @@ module Bundler
download_path = requires_sudo? ? Bundler.tmp(spec.full_name) : rubygems_dir
download_cache_path = "#{download_path}/cache"
- gem_path = "#{rubygems_dir}/cache/#{spec.full_name}.gem"
+ gem_path = "#{default_cache_path}/#{spec.full_name}.gem"
SharedHelpers.filesystem_access(download_cache_path) do |p|
FileUtils.mkdir_p(p)
@@ -469,7 +469,7 @@ module Bundler
download_gem(spec, download_cache_path)
if requires_sudo?
- SharedHelpers.filesystem_access("#{rubygems_dir}/cache") do |p|
+ SharedHelpers.filesystem_access(default_cache_path) do |p|
Bundler.mkdir_p(p)
end
Bundler.sudo "mv #{download_cache_path}/#{spec.full_name}.gem #{gem_path}"
@@ -492,6 +492,10 @@ module Bundler
Bundler.rubygems.gem_dir
end
+ def default_cache_path
+ "#{rubygems_dir}/cache"
+ end
+
def cache_path
Bundler.app_cache
end