Merge RubyGems-3.3.14 and Bundler-2.3.14

This commit is contained in:
Hiroshi SHIBATA 2022-07-13 14:36:57 +09:00 committed by nagachika
parent ffd3d83ea8
commit d7862a5de4
76 changed files with 245 additions and 153 deletions

View file

@ -19,7 +19,7 @@ require_relative "bundler/build_metadata"
# #
# Since Ruby 2.6, Bundler is a part of Ruby's standard library. # Since Ruby 2.6, Bundler is a part of Ruby's standard library.
# #
# Bunder is used by creating _gemfiles_ listing all the project dependencies # Bundler is used by creating _gemfiles_ listing all the project dependencies
# and (optionally) their versions and then using # and (optionally) their versions and then using
# #
# require 'bundler/setup' # require 'bundler/setup'

View file

@ -13,7 +13,7 @@ module Bundler
Installer.ambiguous_gems = [] Installer.ambiguous_gems = []
end end
attr_reader :post_install_messages attr_reader :post_install_messages, :definition
# Begins the installation process for Bundler. # Begins the installation process for Bundler.
# For more information see the #run method on this class. # For more information see the #run method on this class.

View file

@ -51,7 +51,20 @@ module Bundler
end end
def install def install
spec.source.install(spec, :force => force, :ensure_builtin_gems_cached => standalone, :build_args => Array(spec_settings)) spec.source.install(
spec,
:force => force,
:ensure_builtin_gems_cached => standalone,
:build_args => Array(spec_settings),
:previous_spec => previous_spec,
)
end
def previous_spec
locked_gems = installer.definition.locked_gems
return unless locked_gems
locked_gems.specs.find {|s| s.name == spec.name }
end end
def out_of_space_message def out_of_space_message

View file

@ -94,7 +94,7 @@ module Bundler
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) && (spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version)) spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
end end
search = installable_candidates.last search = installable_candidates.last || same_platform_candidates.last
search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification)) search.dependencies = dependencies if search && (search.is_a?(RemoteSpecification) || search.is_a?(EndpointSpecification))
search search
end end

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-ADD" "1" "March 2022" "" "" .TH "BUNDLE\-ADD" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install \fBbundle\-add\fR \- Add gem to the Gemfile and run bundle install
@ -45,6 +45,10 @@ Specify the group(s) for the added gem\. Multiple groups should be separated by
Specify the source for the added gem\. Specify the source for the added gem\.
. .
.TP .TP
\fB\-\-require\fR, \fB\-r\fR
Adds require path to gem\. Provide false, or a path as a string\.
.
.TP
\fB\-\-git\fR \fB\-\-git\fR
Specify the git source for the added gem\. Specify the git source for the added gem\.
. .
@ -66,9 +70,9 @@ Adds the gem to the Gemfile but does not install it\.
. .
.TP .TP
\fB\-\-optimistic\fR \fB\-\-optimistic\fR
Adds optimistic declaration of version Adds optimistic declaration of version\.
. .
.TP .TP
\fB\-\-strict\fR \fB\-\-strict\fR
Adds strict declaration of version Adds strict declaration of version\.

View file

@ -30,6 +30,9 @@ bundle add rails --group "development, test"
* `--source`, , `-s`: * `--source`, , `-s`:
Specify the source for the added gem. Specify the source for the added gem.
* `--require`, `-r`:
Adds require path to gem. Provide false, or a path as a string.
* `--git`: * `--git`:
Specify the git source for the added gem. Specify the git source for the added gem.
@ -46,7 +49,7 @@ bundle add rails --group "development, test"
Adds the gem to the Gemfile but does not install it. Adds the gem to the Gemfile but does not install it.
* `--optimistic`: * `--optimistic`:
Adds optimistic declaration of version Adds optimistic declaration of version.
* `--strict`: * `--strict`:
Adds strict declaration of version Adds strict declaration of version.

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-BINSTUBS" "1" "March 2022" "" "" .TH "BUNDLE\-BINSTUBS" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems \fBbundle\-binstubs\fR \- Install the binstubs of the listed gems

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CACHE" "1" "March 2022" "" "" .TH "BUNDLE\-CACHE" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application \fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CHECK" "1" "March 2022" "" "" .TH "BUNDLE\-CHECK" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems \fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CLEAN" "1" "March 2022" "" "" .TH "BUNDLE\-CLEAN" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory \fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-CONFIG" "1" "March 2022" "" "" .TH "BUNDLE\-CONFIG" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options \fBbundle\-config\fR \- Set bundler configuration options

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-DOCTOR" "1" "March 2022" "" "" .TH "BUNDLE\-DOCTOR" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-doctor\fR \- Checks the bundle for common problems \fBbundle\-doctor\fR \- Checks the bundle for common problems

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-EXEC" "1" "March 2022" "" "" .TH "BUNDLE\-EXEC" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-exec\fR \- Execute a command in the context of the bundle \fBbundle\-exec\fR \- Execute a command in the context of the bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-GEM" "1" "March 2022" "" "" .TH "BUNDLE\-GEM" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem \fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INFO" "1" "March 2022" "" "" .TH "BUNDLE\-INFO" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-info\fR \- Show information for the given gem in your bundle \fBbundle\-info\fR \- Show information for the given gem in your bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INIT" "1" "March 2022" "" "" .TH "BUNDLE\-INIT" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory \fBbundle\-init\fR \- Generates a Gemfile into the current working directory

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INJECT" "1" "March 2022" "" "" .TH "BUNDLE\-INJECT" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile \fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-INSTALL" "1" "March 2022" "" "" .TH "BUNDLE\-INSTALL" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile \fBbundle\-install\fR \- Install the dependencies specified in your Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-LIST" "1" "March 2022" "" "" .TH "BUNDLE\-LIST" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-list\fR \- List all the gems in the bundle \fBbundle\-list\fR \- List all the gems in the bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-LOCK" "1" "March 2022" "" "" .TH "BUNDLE\-LOCK" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing \fBbundle\-lock\fR \- Creates / Updates a lockfile without installing

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-OPEN" "1" "March 2022" "" "" .TH "BUNDLE\-OPEN" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle \fBbundle\-open\fR \- Opens the source directory for a gem in your bundle

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-OUTDATED" "1" "March 2022" "" "" .TH "BUNDLE\-OUTDATED" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-outdated\fR \- List installed gems with newer versions available \fBbundle\-outdated\fR \- List installed gems with newer versions available

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-PLATFORM" "1" "March 2022" "" "" .TH "BUNDLE\-PLATFORM" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-platform\fR \- Displays platform compatibility information \fBbundle\-platform\fR \- Displays platform compatibility information

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-PRISTINE" "1" "March 2022" "" "" .TH "BUNDLE\-PRISTINE" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition \fBbundle\-pristine\fR \- Restores installed gems to their pristine condition

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-REMOVE" "1" "March 2022" "" "" .TH "BUNDLE\-REMOVE" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-remove\fR \- Removes gems from the Gemfile \fBbundle\-remove\fR \- Removes gems from the Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-SHOW" "1" "March 2022" "" "" .TH "BUNDLE\-SHOW" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem \fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-UPDATE" "1" "March 2022" "" "" .TH "BUNDLE\-UPDATE" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-update\fR \- Update your gems to the latest available versions \fBbundle\-update\fR \- Update your gems to the latest available versions

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE\-VIZ" "1" "March 2022" "" "" .TH "BUNDLE\-VIZ" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile \fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BUNDLE" "1" "March 2022" "" "" .TH "BUNDLE" "1" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\fR \- Ruby Dependency Management \fBbundle\fR \- Ruby Dependency Management

View file

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "GEMFILE" "5" "March 2022" "" "" .TH "GEMFILE" "5" "May 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs \fBGemfile\fR \- A format for describing gem dependencies for Ruby programs

View file

@ -20,10 +20,6 @@ module Bundler
end end
end end
def version_message(spec)
"#{spec.name} #{spec.version}"
end
def root def root
Plugin.root Plugin.root
end end

View file

@ -4,10 +4,6 @@ module Bundler
module Plugin module Plugin
class Installer class Installer
class Rubygems < Bundler::Source::Rubygems class Rubygems < Bundler::Source::Rubygems
def version_message(spec)
"#{spec.name} #{spec.version}"
end
private private
def requires_sudo? def requires_sudo?

View file

@ -15,13 +15,12 @@ module Bundler
specs.unmet_dependency_names specs.unmet_dependency_names
end end
def version_message(spec) def version_message(spec, locked_spec = nil)
message = "#{spec.name} #{spec.version}" message = "#{spec.name} #{spec.version}"
message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil? message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
if Bundler.locked_gems if locked_spec
locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name } locked_spec_version = locked_spec.version
locked_spec_version = locked_spec.version if locked_spec
if locked_spec_version && spec.version != locked_spec_version if locked_spec_version && spec.version != locked_spec_version
message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version)) message += Bundler.ui.add_color(" (was #{locked_spec_version})", version_color(spec.version, locked_spec_version))
end end

View file

@ -181,7 +181,7 @@ module Bundler
def install(spec, options = {}) def install(spec, options = {})
force = options[:force] force = options[:force]
print_using_message "Using #{version_message(spec)} from #{self}" print_using_message "Using #{version_message(spec, options[:previous_spec])} from #{self}"
if (requires_checkout? && !@copied) || force if (requires_checkout? && !@copied) || force
Bundler.ui.debug " * Checking out revision: #{ref}" Bundler.ui.debug " * Checking out revision: #{ref}"

View file

@ -82,7 +82,7 @@ module Bundler
end end
def install(spec, options = {}) def install(spec, options = {})
using_message = "Using #{version_message(spec)} from #{self}" using_message = "Using #{version_message(spec, options[:previous_spec])} from #{self}"
using_message += " and installing its executables" unless spec.executables.empty? using_message += " and installing its executables" unless spec.executables.empty?
print_using_message using_message print_using_message using_message
generate_bin(spec, :disable_extensions => true) generate_bin(spec, :disable_extensions => true)

View file

@ -135,9 +135,9 @@ module Bundler
end end
end end
def install(spec, opts = {}) def install(spec, options = {})
force = opts[:force] force = options[:force]
ensure_builtin_gems_cached = opts[:ensure_builtin_gems_cached] ensure_builtin_gems_cached = options[:ensure_builtin_gems_cached]
if ensure_builtin_gems_cached && spec.default_gem? if ensure_builtin_gems_cached && spec.default_gem?
if !cached_path(spec) if !cached_path(spec)
@ -162,7 +162,7 @@ module Bundler
uris.uniq! uris.uniq!
Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1 Installer.ambiguous_gems << [spec.name, *uris] if uris.length > 1
path = fetch_gem(spec) path = fetch_gem(spec, options[:previous_spec])
begin begin
s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"]) s = Bundler.rubygems.spec_from_gem(path, Bundler.settings["trust-policy"])
spec.__swap__(s) spec.__swap__(s)
@ -173,7 +173,7 @@ module Bundler
end end
unless Bundler.settings[:no_install] 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? message += " with native extensions" if spec.extensions.any?
Bundler.ui.confirm message Bundler.ui.confirm message
@ -198,7 +198,7 @@ module Bundler
:ignore_dependencies => true, :ignore_dependencies => true,
:wrappers => true, :wrappers => true,
:env_shebang => true, :env_shebang => true,
:build_args => opts[:build_args], :build_args => options[:build_args],
:bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum, :bundler_expected_checksum => spec.respond_to?(:checksum) && spec.checksum,
:bundler_extension_cache_path => extension_cache_path(spec) :bundler_extension_cache_path => extension_cache_path(spec)
).install ).install
@ -458,7 +458,7 @@ module Bundler
end end
end end
def fetch_gem(spec) def fetch_gem(spec, previous_spec = nil)
return false unless spec.remote return false unless spec.remote
spec.fetch_platform spec.fetch_platform
@ -476,7 +476,7 @@ module Bundler
SharedHelpers.filesystem_access(download_cache_path) do |p| SharedHelpers.filesystem_access(download_cache_path) do |p|
FileUtils.mkdir_p(p) FileUtils.mkdir_p(p)
end end
download_gem(spec, download_cache_path) download_gem(spec, download_cache_path, previous_spec)
if requires_sudo? if requires_sudo?
SharedHelpers.filesystem_access(cache_path) do |p| SharedHelpers.filesystem_access(cache_path) do |p|
@ -521,9 +521,12 @@ module Bundler
# @param [String] download_cache_path # @param [String] download_cache_path
# the local directory the .gem will end up in. # 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 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) Bundler.rubygems.download_gem(spec, uri, download_cache_path)
end end

View file

@ -24,7 +24,7 @@ module Bundler
specs_for_dep = spec_for_dependency(dep, match_current_platform) specs_for_dep = spec_for_dependency(dep, match_current_platform)
if specs_for_dep.any? if specs_for_dep.any?
match_current_platform ? specs += specs_for_dep : specs |= specs_for_dep specs.concat(specs_for_dep)
specs_for_dep.first.dependencies.each do |d| specs_for_dep.first.dependencies.each do |d|
next if d.type == :development next if d.type == :development
@ -40,6 +40,8 @@ module Bundler
specs << spec specs << spec
end end
specs.uniq! unless match_current_platform
check ? true : specs check ? true : specs
end end

View file

@ -1,7 +1,7 @@
# frozen_string_literal: false # frozen_string_literal: false
module Bundler module Bundler
VERSION = "2.3.13".freeze VERSION = "2.3.14".freeze
def self.bundler_major_version def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i @bundler_major_version ||= VERSION.split(".").first.to_i

View file

@ -8,7 +8,7 @@
require 'rbconfig' require 'rbconfig'
module Gem module Gem
VERSION = "3.3.13".freeze VERSION = "3.3.14".freeze
end end
# Must be first since it unloads the prelude from 1.9.2 # Must be first since it unloads the prelude from 1.9.2

View file

@ -3,7 +3,8 @@
require "bundler/installer/gem_installer" require "bundler/installer/gem_installer"
RSpec.describe Bundler::GemInstaller do RSpec.describe Bundler::GemInstaller do
let(:installer) { instance_double("Installer") } let(:definition) { instance_double("Definition", :locked_gems => nil) }
let(:installer) { instance_double("Installer", :definition => definition) }
let(:spec_source) { instance_double("SpecSource") } let(:spec_source) { instance_double("SpecSource") }
let(:spec) { instance_double("Specification", :name => "dummy", :version => "0.0.1", :loaded_from => "dummy", :source => spec_source) } let(:spec) { instance_double("Specification", :name => "dummy", :version => "0.0.1", :loaded_from => "dummy", :source => spec_source) }
@ -11,7 +12,7 @@ RSpec.describe Bundler::GemInstaller do
context "spec_settings is nil" do context "spec_settings is nil" do
it "invokes install method with empty build_args" do it "invokes install method with empty build_args" do
allow(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => []) allow(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => [], :previous_spec => nil)
subject.install_from_spec subject.install_from_spec
end end
end end
@ -22,7 +23,7 @@ RSpec.describe Bundler::GemInstaller do
allow(Bundler.settings).to receive(:[]).with(:inline) allow(Bundler.settings).to receive(:[]).with(:inline)
allow(Bundler.settings).to receive(:[]).with(:forget_cli_options) allow(Bundler.settings).to receive(:[]).with(:forget_cli_options)
allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy") allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy")
expect(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy"]) expect(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy"], :previous_spec => nil)
subject.install_from_spec subject.install_from_spec
end end
end end
@ -33,7 +34,13 @@ RSpec.describe Bundler::GemInstaller do
allow(Bundler.settings).to receive(:[]).with(:inline) allow(Bundler.settings).to receive(:[]).with(:inline)
allow(Bundler.settings).to receive(:[]).with(:forget_cli_options) allow(Bundler.settings).to receive(:[]).with(:forget_cli_options)
allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy --with-another-dummy-config") allow(Bundler.settings).to receive(:[]).with("build.dummy").and_return("--with-dummy-config=dummy --with-another-dummy-config")
expect(spec_source).to receive(:install).with(spec, :force => false, :ensure_builtin_gems_cached => false, :build_args => ["--with-dummy-config=dummy", "--with-another-dummy-config"]) expect(spec_source).to receive(:install).with(
spec,
:force => false,
:ensure_builtin_gems_cached => false,
:build_args => ["--with-dummy-config=dummy", "--with-another-dummy-config"],
:previous_spec => nil
)
subject.install_from_spec subject.install_from_spec
end end
end end

View file

@ -30,17 +30,7 @@ RSpec.describe Bundler::Source do
end end
context "when there are locked gems" do context "when there are locked gems" do
let(:locked_gems) { double(:locked_gems) }
before { allow(Bundler).to receive(:locked_gems).and_return(locked_gems) }
context "that contain the relevant gem spec" do context "that contain the relevant gem spec" do
before do
specs = double(:specs)
allow(locked_gems).to receive(:specs).and_return(specs)
allow(specs).to receive(:find).and_return(locked_gem)
end
context "without a version" do context "without a version" do
let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => nil) } let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => nil) }
@ -62,7 +52,7 @@ RSpec.describe Bundler::Source do
end end
it "should return a string with the spec name and version and locked spec version" do it "should return a string with the spec name and version and locked spec version" do
expect(subject.version_message(spec)).to eq("nokogiri >= 1.6\e[32m (was < 1.5)\e[0m") expect(subject.version_message(spec, locked_gem)).to eq("nokogiri >= 1.6\e[32m (was < 1.5)\e[0m")
end end
end end
@ -74,7 +64,7 @@ RSpec.describe Bundler::Source do
end end
it "should return a string with the spec name and version and locked spec version" do it "should return a string with the spec name and version and locked spec version" do
expect(subject.version_message(spec)).to eq("nokogiri >= 1.6 (was < 1.5)") expect(subject.version_message(spec, locked_gem)).to eq("nokogiri >= 1.6 (was < 1.5)")
end end
end end
end end
@ -89,7 +79,7 @@ RSpec.describe Bundler::Source do
end end
it "should return a string with the locked spec version in yellow" do it "should return a string with the locked spec version in yellow" do
expect(subject.version_message(spec)).to eq("nokogiri 1.6.1\e[33m (was 1.7.0)\e[0m") expect(subject.version_message(spec, locked_gem)).to eq("nokogiri 1.6.1\e[33m (was 1.7.0)\e[0m")
end end
end end
@ -101,7 +91,7 @@ RSpec.describe Bundler::Source do
end end
it "should return a string with the locked spec version in yellow" do it "should return a string with the locked spec version in yellow" do
expect(subject.version_message(spec)).to eq("nokogiri 1.6.1 (was 1.7.0)") expect(subject.version_message(spec, locked_gem)).to eq("nokogiri 1.6.1 (was 1.7.0)")
end end
end end
end end
@ -116,7 +106,7 @@ RSpec.describe Bundler::Source do
end end
it "should return a string with the locked spec version in green" do it "should return a string with the locked spec version in green" do
expect(subject.version_message(spec)).to eq("nokogiri 1.7.1\e[32m (was 1.7.0)\e[0m") expect(subject.version_message(spec, locked_gem)).to eq("nokogiri 1.7.1\e[32m (was 1.7.0)\e[0m")
end end
end end
@ -128,27 +118,11 @@ RSpec.describe Bundler::Source do
end end
it "should return a string with the locked spec version in yellow" do it "should return a string with the locked spec version in yellow" do
expect(subject.version_message(spec)).to eq("nokogiri 1.7.1 (was 1.7.0)") expect(subject.version_message(spec, locked_gem)).to eq("nokogiri 1.7.1 (was 1.7.0)")
end end
end end
end end
end end
context "that do not contain the relevant gem spec" do
before do
specs = double(:specs)
allow(locked_gems).to receive(:specs).and_return(specs)
allow(specs).to receive(:find).and_return(nil)
end
it_behaves_like "the lockfile specs are not relevant"
end
end
context "when there are no locked gems" do
before { allow(Bundler).to receive(:locked_gems).and_return(nil) }
it_behaves_like "the lockfile specs are not relevant"
end end
end end

View file

@ -493,27 +493,25 @@ RSpec.describe "bundle lock" do
end end
it "does not conflict on ruby requirements when adding new platforms" do it "does not conflict on ruby requirements when adding new platforms" do
next_minor = Gem.ruby_version.segments[0..1].map.with_index {|s, i| i == 1 ? s + 1 : s }.join(".")
build_repo4 do build_repo4 do
build_gem "raygun-apm", "1.0.78" do |s| build_gem "raygun-apm", "1.0.78" do |s|
s.platform = "x86_64-linux" s.platform = "x86_64-linux"
s.required_ruby_version = "< #{next_minor}.dev" s.required_ruby_version = "< #{next_ruby_minor}.dev"
end end
build_gem "raygun-apm", "1.0.78" do |s| build_gem "raygun-apm", "1.0.78" do |s|
s.platform = "universal-darwin" s.platform = "universal-darwin"
s.required_ruby_version = "< #{next_minor}.dev" s.required_ruby_version = "< #{next_ruby_minor}.dev"
end end
build_gem "raygun-apm", "1.0.78" do |s| build_gem "raygun-apm", "1.0.78" do |s|
s.platform = "x64-mingw32" s.platform = "x64-mingw32"
s.required_ruby_version = "< #{next_minor}.dev" s.required_ruby_version = "< #{next_ruby_minor}.dev"
end end
build_gem "raygun-apm", "1.0.78" do |s| build_gem "raygun-apm", "1.0.78" do |s|
s.platform = "x64-mingw-ucrt" s.platform = "x64-mingw-ucrt"
s.required_ruby_version = "< #{next_minor}.dev" s.required_ruby_version = "< #{next_ruby_minor}.dev"
end end
end end

View file

@ -245,6 +245,43 @@ RSpec.describe "bundle install with install-time dependencies" do
expect(the_bundle).to include_gems("rack 1.2") expect(the_bundle).to include_gems("rack 1.2")
end end
it "gives a meaningful error if there's a lockfile using the newer incompatible version" do
build_repo2 do
build_gem "parallel_tests", "3.7.0" do |s|
s.required_ruby_version = ">= #{current_ruby_minor}"
end
build_gem "parallel_tests", "3.8.0" do |s|
s.required_ruby_version = ">= #{next_ruby_minor}"
end
end
gemfile <<-G
source "http://localgemserver.test/"
gem 'parallel_tests'
G
lockfile <<~L
GEM
remote: http://localgemserver.test/
specs:
parallel_tests (3.8.0)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
parallel_tests
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "install --verbose", :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, :raise_on_error => false
expect(err).to include("parallel_tests-3.8.0 requires ruby version >= #{next_ruby_minor}")
expect(err).not_to include("That means the author of parallel_tests (3.8.0) has removed it.")
end
it "installs the older version under rate limiting conditions" do it "installs the older version under rate limiting conditions" do
build_repo4 do build_repo4 do
build_gem "rack", "9001.0.0" do |s| build_gem "rack", "9001.0.0" do |s|

View file

@ -66,7 +66,7 @@ RSpec.context "when using gem before installing" do
bundle :list, :raise_on_error => false bundle :list, :raise_on_error => false
expect(err).to include("Could not find rack-0.9.1 in any of the sources") expect(err).to include("Could not find rack-0.9.1 in any of the sources")
expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.") expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.") expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.") expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
end end
@ -97,7 +97,7 @@ RSpec.context "when using gem before installing" do
expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in any of the sources") expect(err).to include("Could not find rack-0.9.1, rack_middleware-1.0 in any of the sources")
expect(err).to include("Install missing gems with `bundle install`.") expect(err).to include("Install missing gems with `bundle install`.")
expect(err).to_not include("Your bundle is locked to rack (0.9.1), but that version could not be found in any of the sources listed in your Gemfile.") expect(err).to_not include("Your bundle is locked to rack (0.9.1) from")
expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.") expect(err).to_not include("If you haven't changed sources, that means the author of rack (0.9.1) has removed it.")
expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.") expect(err).to_not include("You'll need to update your bundle to a different version of rack (0.9.1) that hasn't been removed in order to install.")
end end

View file

@ -239,6 +239,40 @@ RSpec.describe "bundler/inline#gemfile" do
expect(err).to be_empty expect(err).to be_empty
end end
it "does not leak Gemfile.lock versions to the installation output" do
gemfile <<-G
source "https://notaserver.com"
gem "rake"
G
lockfile <<-G
GEM
remote: https://rubygems.org/
specs:
rake (11.3.0)
PLATFORMS
ruby
DEPENDENCIES
rake
BUNDLED WITH
#{Bundler::VERSION}
G
script <<-RUBY
gemfile(true) do
source "#{file_uri_for(gem_repo1)}"
gem "rake", "~> 13.0"
end
RUBY
expect(out).to include("Installing rake 13.0")
expect(out).not_to include("was 11.3.0")
expect(err).to be_empty
end
it "installs inline gems when frozen is set" do it "installs inline gems when frozen is set" do
script <<-RUBY, :env => { "BUNDLE_FROZEN" => "true" } script <<-RUBY, :env => { "BUNDLE_FROZEN" => "true" }
gemfile do gemfile do

View file

@ -471,6 +471,14 @@ module Spec
end end
end end
def current_ruby_minor
Gem.ruby_version.segments[0..1].join(".")
end
def next_ruby_minor
Gem.ruby_version.segments[0..1].map.with_index {|s, i| i == 1 ? s + 1 : s }.join(".")
end
# versions providing a bundler version finder but not including # versions providing a bundler version finder but not including
# https://github.com/rubygems/rubygems/commit/929e92d752baad3a08f3ac92eaec162cb96aedd1 # https://github.com/rubygems/rubygems/commit/929e92d752baad3a08f3ac92eaec162cb96aedd1
def rubygems_version_failing_to_activate_bundler_prereleases def rubygems_version_failing_to_activate_bundler_prereleases

View file

@ -18,6 +18,12 @@ module Spec
gem_load_and_activate(gem_name, bin_container) gem_load_and_activate(gem_name, bin_container)
end end
def gem_load_and_possibly_install(gem_name, bin_container)
require_relative "switch_rubygems"
gem_load_activate_and_possibly_install(gem_name, bin_container)
end
def gem_require(gem_name) def gem_require(gem_name)
gem_activate(gem_name) gem_activate(gem_name)
require gem_name require gem_name
@ -99,9 +105,21 @@ module Spec
abort "We couldn't activate #{gem_name} (#{e.requirement}). Run `gem install #{gem_name}:'#{e.requirement}'`" abort "We couldn't activate #{gem_name} (#{e.requirement}). Run `gem install #{gem_name}:'#{e.requirement}'`"
end end
def gem_load_activate_and_possibly_install(gem_name, bin_container)
gem_activate_and_possibly_install(gem_name)
load Gem.bin_path(gem_name, bin_container)
end
def gem_activate_and_possibly_install(gem_name)
gem_activate(gem_name)
rescue Gem::LoadError => e
Gem.install(gem_name, e.requirement)
retry
end
def gem_activate(gem_name) def gem_activate(gem_name)
require "bundler" require "bundler"
gem_requirement = Bundler::LockfileParser.new(File.read(dev_lockfile)).dependencies[gem_name]&.requirement gem_requirement = Bundler::LockfileParser.new(File.read(dev_lockfile)).specs.find {|spec| spec.name == gem_name }.version
gem gem_name, gem_requirement gem gem_name, gem_requirement
end end

View file

@ -72,4 +72,4 @@ DEPENDENCIES
webrick (~> 1.6) webrick (~> 1.6)
BUNDLED WITH BUNDLED WITH
2.3.13 2.3.14

View file

@ -60,4 +60,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.13 2.3.14

View file

@ -66,4 +66,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.13 2.3.14

View file

@ -41,4 +41,4 @@ DEPENDENCIES
webrick (= 1.7.0) webrick (= 1.7.0)
BUNDLED WITH BUNDLED WITH
2.3.13 2.3.14