lib/bundler/source/rubygems.rb in bundler-2.3.13 vs lib/bundler/source/rubygems.rb in bundler-2.3.14
- old
+ new
@@ -133,13 +133,13 @@
idx.use(installed_specs, :override_dupes) if @allow_local
idx
end
end
- def install(spec, opts = {})
- force = opts[:force]
- ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached]
+ def install(spec, options = {})
+ force = options[:force]
+ ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
if ensure_builtin_gems_cached && spec.default_gem?
if !cached_path(spec)
cached_built_in_gem(spec) unless spec.remote
force = true
@@ -160,22 +160,22 @@
uris = [spec.remote.anonymized_uri]
uris += remotes_for_spec(spec).map(&:anonymized_uri)
uris.uniq!
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
- path = fetch_gem(spec)
+ path = fetch_gem(spec, options[:previous_spec])
begin
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
spec.__swap__(s)
rescue Gem::Package::FormatError
Bundler.rm_rf(path)
raise
end
end
unless Bundler.settings[:no_install]
- message = "Installing #{version_message(spec)}"
+ message = "Installing #{version_message(spec, options[:previous_spec])}"
message += " with native extensions" if spec.extensions.any?
Bundler.ui.confirm message
path = cached_gem(spec)
raise GemNotFound, "Could not find #{spec.file_name} for installation" unless path
@@ -196,11 +196,11 @@
:install_dir => install_path.to_s,
:bin_dir => bin_path.to_s,
:ignore_dependencies => true,
:wrappers => true,
:env_shebang => true,
- :build_args => opts[:build_args],
+ :build_args => options[:build_args],
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
:bundler_extension_cache_path => extension_cache_path(spec)
).install
spec.full_gem_path = installed_spec.full_gem_path
@@ -456,11 +456,11 @@
index.use f.specs_with_retry(nil, self), override_dupes
end
end
end
- def fetch_gem(spec)
+ def fetch_gem(spec, previous_spec = nil)
return false unless spec.remote
spec.fetch_platform
cache_path = download_cache_path(spec) || default_cache_path_for(rubygems_dir)
@@ -474,11 +474,11 @@
end
SharedHelpers.filesystem_access(download_cache_path) do |p|
FileUtils.mkdir_p(p)
end
- download_gem(spec, download_cache_path)
+ download_gem(spec, download_cache_path, previous_spec)
if requires_sudo?
SharedHelpers.filesystem_access(cache_path) do |p|
Bundler.mkdir_p(p)
end
@@ -519,12 +519,15 @@
# the spec we want to download or retrieve from the cache.
#
# @param [String] download_cache_path
# the local directory the .gem will end up in.
#
- def download_gem(spec, download_cache_path)
+ # @param [Specification] previous_spec
+ # the spec previously locked
+ #
+ def download_gem(spec, download_cache_path, previous_spec = nil)
uri = spec.remote.uri
- Bundler.ui.confirm("Fetching #{version_message(spec)}")
+ Bundler.ui.confirm("Fetching #{version_message(spec, previous_spec)}")
Bundler.rubygems.download_gem(spec, uri, download_cache_path)
end
# Returns the global cache path of the calling Rubygems::Source object.
#