aboutsummaryrefslogtreecommitdiffstats
path: root/spec/bundler/support/helpers.rb
diff options
context:
space:
mode:
authorDavid Rodríguez <deivid.rodriguez@riseup.net>2023-11-08 13:30:41 +0100
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2023-11-09 10:34:48 +0900
commit28356c2870e1a9606cff998e2b888bd5bd517b37 (patch)
tree4d5c10353ec832b3a6eb2a988d8b561281a35c7b /spec/bundler/support/helpers.rb
parentf67a80cdc098783aae9ce84d9e141d2280978a49 (diff)
downloadruby-28356c2870e1a9606cff998e2b888bd5bd517b37.tar.gz
[rubygems/rubygems] Explicitly pass install-dir when installing system gems in Bundler specs
We want to avoid any "user home" fallbacks, since that won't work with Bundler. So if there's a permissions issue during specs, it's best to raise immediately. https://github.com/rubygems/rubygems/commit/767a3e7533
Diffstat (limited to 'spec/bundler/support/helpers.rb')
-rw-r--r--spec/bundler/support/helpers.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/spec/bundler/support/helpers.rb b/spec/bundler/support/helpers.rb
index 73621685ba..f4dd6fc89b 100644
--- a/spec/bundler/support/helpers.rb
+++ b/spec/bundler/support/helpers.rb
@@ -293,29 +293,29 @@ module Spec
def system_gems(*gems)
gems = gems.flatten
options = gems.last.is_a?(Hash) ? gems.pop : {}
- path = options.fetch(:path, system_gem_path)
+ install_dir = options.fetch(:path, system_gem_path)
default = options.fetch(:default, false)
- with_gem_path_as(path) do
+ with_gem_path_as(install_dir) do
gem_repo = options.fetch(:gem_repo, gem_repo1)
gems.each do |g|
gem_name = g.to_s
if gem_name.start_with?("bundler")
version = gem_name.match(/\Abundler-(?<version>.*)\z/)[:version] if gem_name != "bundler"
- with_built_bundler(version) {|gem_path| install_gem(gem_path, default) }
+ with_built_bundler(version) {|gem_path| install_gem(gem_path, install_dir, default) }
elsif %r{\A(?:[a-zA-Z]:)?/.*\.gem\z}.match?(gem_name)
- install_gem(gem_name, default)
+ install_gem(gem_name, install_dir, default)
else
- install_gem("#{gem_repo}/gems/#{gem_name}.gem", default)
+ install_gem("#{gem_repo}/gems/#{gem_name}.gem", install_dir, default)
end
end
end
end
- def install_gem(path, default = false)
+ def install_gem(path, install_dir, default = false)
raise "OMG `#{path}` does not exist!" unless File.exist?(path)
- args = "--no-document --ignore-dependencies --verbose --local"
- args += " --default --install-dir #{system_gem_path}" if default
+ args = "--no-document --ignore-dependencies --verbose --local --install-dir #{install_dir}"
+ args += " --default" if default
gem_command "install #{args} '#{path}'"
end