lib/bundler/source/rubygems.rb in bundler-2.2.4 vs lib/bundler/source/rubygems.rb in bundler-2.2.5
- old
+ new
@@ -143,10 +143,12 @@
bin_path = Bundler.system_bindir
end
Bundler.mkdir_p bin_path, :no_sudo => true unless spec.executables.empty? || Bundler.rubygems.provides?(">= 2.7.5")
+ require_relative "../rubygems_gem_installer"
+
installed_spec = Bundler::RubyGemsGemInstaller.at(
path,
:install_dir => install_path.to_s,
:bin_dir => bin_path.to_s,
:ignore_dependencies => true,
@@ -485,11 +487,18 @@
end
else
uri = spec.remote.uri
Bundler.ui.confirm("Fetching #{version_message(spec)}")
rubygems_local_path = Bundler.rubygems.download_gem(spec, uri, download_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
- FileUtils.mv(rubygems_local_path, local_path)
+ SharedHelpers.filesystem_access(local_path) do
+ FileUtils.mv(rubygems_local_path, local_path)
+ end
end
cache_globally(spec, local_path)
end
end