mirror of
https://github.com/ruby/ruby.git
synced 2025-09-21 03:24:00 +02:00
Merge RubyGems-3.3.14 and Bundler-2.3.14
This commit is contained in:
parent
ffd3d83ea8
commit
d7862a5de4
76 changed files with 245 additions and 153 deletions
|
@ -19,7 +19,7 @@ require_relative "bundler/build_metadata"
|
|||
#
|
||||
# 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
|
||||
#
|
||||
# require 'bundler/setup'
|
||||
|
|
|
@ -13,7 +13,7 @@ module Bundler
|
|||
Installer.ambiguous_gems = []
|
||||
end
|
||||
|
||||
attr_reader :post_install_messages
|
||||
attr_reader :post_install_messages, :definition
|
||||
|
||||
# Begins the installation process for Bundler.
|
||||
# For more information see the #run method on this class.
|
||||
|
|
|
@ -51,7 +51,20 @@ module Bundler
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
def out_of_space_message
|
||||
|
|
|
@ -94,7 +94,7 @@ module Bundler
|
|||
(spec.required_ruby_version.satisfied_by?(Gem.ruby_version) &&
|
||||
spec.required_rubygems_version.satisfied_by?(Gem.rubygems_version))
|
||||
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
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\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\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-require\fR, \fB\-r\fR
|
||||
Adds require path to gem\. Provide false, or a path as a string\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-git\fR
|
||||
Specify the git source for the added gem\.
|
||||
.
|
||||
|
@ -66,9 +70,9 @@ Adds the gem to the Gemfile but does not install it\.
|
|||
.
|
||||
.TP
|
||||
\fB\-\-optimistic\fR
|
||||
Adds optimistic declaration of version
|
||||
Adds optimistic declaration of version\.
|
||||
.
|
||||
.TP
|
||||
\fB\-\-strict\fR
|
||||
Adds strict declaration of version
|
||||
Adds strict declaration of version\.
|
||||
|
||||
|
|
|
@ -30,6 +30,9 @@ bundle add rails --group "development, test"
|
|||
* `--source`, , `-s`:
|
||||
Specify the source for the added gem.
|
||||
|
||||
* `--require`, `-r`:
|
||||
Adds require path to gem. Provide false, or a path as a string.
|
||||
|
||||
* `--git`:
|
||||
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.
|
||||
|
||||
* `--optimistic`:
|
||||
Adds optimistic declaration of version
|
||||
Adds optimistic declaration of version.
|
||||
|
||||
* `--strict`:
|
||||
Adds strict declaration of version
|
||||
Adds strict declaration of version.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-binstubs\fR \- Install the binstubs of the listed gems
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-cache\fR \- Package your needed \fB\.gem\fR files into your application
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-check\fR \- Verifies if dependencies are satisfied by installed gems
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-clean\fR \- Cleans up unused gems in your bundler directory
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-config\fR \- Set bundler configuration options
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-doctor\fR \- Checks the bundle for common problems
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-exec\fR \- Execute a command in the context of the bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-gem\fR \- Generate a project skeleton for creating a rubygem
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-info\fR \- Show information for the given gem in your bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-init\fR \- Generates a Gemfile into the current working directory
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-inject\fR \- Add named gem(s) with version requirements to Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-install\fR \- Install the dependencies specified in your Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-list\fR \- List all the gems in the bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-lock\fR \- Creates / Updates a lockfile without installing
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-open\fR \- Opens the source directory for a gem in your bundle
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-outdated\fR \- List installed gems with newer versions available
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-platform\fR \- Displays platform compatibility information
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-pristine\fR \- Restores installed gems to their pristine condition
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-remove\fR \- Removes gems from the Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-show\fR \- Shows all the gems in your bundle, or the path to a gem
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-update\fR \- Update your gems to the latest available versions
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.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"
|
||||
\fBbundle\-viz\fR \- Generates a visual dependency graph for your Gemfile
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "BUNDLE" "1" "March 2022" "" ""
|
||||
.TH "BUNDLE" "1" "May 2022" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBbundle\fR \- Ruby Dependency Management
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
.\" generated with Ronn/v0.7.3
|
||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||
.
|
||||
.TH "GEMFILE" "5" "March 2022" "" ""
|
||||
.TH "GEMFILE" "5" "May 2022" "" ""
|
||||
.
|
||||
.SH "NAME"
|
||||
\fBGemfile\fR \- A format for describing gem dependencies for Ruby programs
|
||||
|
|
|
@ -20,10 +20,6 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def version_message(spec)
|
||||
"#{spec.name} #{spec.version}"
|
||||
end
|
||||
|
||||
def root
|
||||
Plugin.root
|
||||
end
|
||||
|
|
|
@ -4,10 +4,6 @@ module Bundler
|
|||
module Plugin
|
||||
class Installer
|
||||
class Rubygems < Bundler::Source::Rubygems
|
||||
def version_message(spec)
|
||||
"#{spec.name} #{spec.version}"
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def requires_sudo?
|
||||
|
|
|
@ -15,13 +15,12 @@ module Bundler
|
|||
specs.unmet_dependency_names
|
||||
end
|
||||
|
||||
def version_message(spec)
|
||||
def version_message(spec, locked_spec = nil)
|
||||
message = "#{spec.name} #{spec.version}"
|
||||
message += " (#{spec.platform})" if spec.platform != Gem::Platform::RUBY && !spec.platform.nil?
|
||||
|
||||
if Bundler.locked_gems
|
||||
locked_spec = Bundler.locked_gems.specs.find {|s| s.name == spec.name }
|
||||
locked_spec_version = locked_spec.version if locked_spec
|
||||
if locked_spec
|
||||
locked_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))
|
||||
end
|
||||
|
|
|
@ -181,7 +181,7 @@ module Bundler
|
|||
def install(spec, options = {})
|
||||
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
|
||||
Bundler.ui.debug " * Checking out revision: #{ref}"
|
||||
|
|
|
@ -82,7 +82,7 @@ module Bundler
|
|||
end
|
||||
|
||||
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?
|
||||
print_using_message using_message
|
||||
generate_bin(spec, :disable_extensions => true)
|
||||
|
|
|
@ -135,9 +135,9 @@ module Bundler
|
|||
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)
|
||||
|
@ -162,7 +162,7 @@ module Bundler
|
|||
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)
|
||||
|
@ -173,7 +173,7 @@ module Bundler
|
|||
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
|
||||
|
||||
|
@ -198,7 +198,7 @@ module Bundler
|
|||
: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
|
||||
|
@ -458,7 +458,7 @@ module Bundler
|
|||
end
|
||||
end
|
||||
|
||||
def fetch_gem(spec)
|
||||
def fetch_gem(spec, previous_spec = nil)
|
||||
return false unless spec.remote
|
||||
|
||||
spec.fetch_platform
|
||||
|
@ -476,7 +476,7 @@ module Bundler
|
|||
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|
|
||||
|
@ -521,9 +521,12 @@ module Bundler
|
|||
# @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
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ module Bundler
|
|||
|
||||
specs_for_dep = spec_for_dependency(dep, match_current_platform)
|
||||
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|
|
||||
next if d.type == :development
|
||||
|
@ -40,6 +40,8 @@ module Bundler
|
|||
specs << spec
|
||||
end
|
||||
|
||||
specs.uniq! unless match_current_platform
|
||||
|
||||
check ? true : specs
|
||||
end
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# frozen_string_literal: false
|
||||
|
||||
module Bundler
|
||||
VERSION = "2.3.13".freeze
|
||||
VERSION = "2.3.14".freeze
|
||||
|
||||
def self.bundler_major_version
|
||||
@bundler_major_version ||= VERSION.split(".").first.to_i
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
require 'rbconfig'
|
||||
|
||||
module Gem
|
||||
VERSION = "3.3.13".freeze
|
||||
VERSION = "3.3.14".freeze
|
||||
end
|
||||
|
||||
# Must be first since it unloads the prelude from 1.9.2
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
require "bundler/installer/gem_installer"
|
||||
|
||||
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) { 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
|
||||
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
|
||||
end
|
||||
end
|
||||
|
@ -22,7 +23,7 @@ RSpec.describe Bundler::GemInstaller do
|
|||
allow(Bundler.settings).to receive(:[]).with(:inline)
|
||||
allow(Bundler.settings).to receive(:[]).with(:forget_cli_options)
|
||||
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
|
||||
end
|
||||
end
|
||||
|
@ -33,7 +34,13 @@ RSpec.describe Bundler::GemInstaller do
|
|||
allow(Bundler.settings).to receive(:[]).with(:inline)
|
||||
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")
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -30,17 +30,7 @@ RSpec.describe Bundler::Source do
|
|||
end
|
||||
|
||||
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
|
||||
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
|
||||
let(:locked_gem) { double(:locked_gem, :name => "nokogiri", :version => nil) }
|
||||
|
||||
|
@ -62,7 +52,7 @@ RSpec.describe Bundler::Source do
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
|
@ -74,7 +64,7 @@ RSpec.describe Bundler::Source do
|
|||
end
|
||||
|
||||
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
|
||||
|
@ -89,7 +79,7 @@ RSpec.describe Bundler::Source do
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
|
@ -101,7 +91,7 @@ RSpec.describe Bundler::Source do
|
|||
end
|
||||
|
||||
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
|
||||
|
@ -116,7 +106,7 @@ RSpec.describe Bundler::Source do
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
|
@ -128,27 +118,11 @@ RSpec.describe Bundler::Source do
|
|||
end
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
|
|
|
@ -493,27 +493,25 @@ RSpec.describe "bundle lock" do
|
|||
end
|
||||
|
||||
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_gem "raygun-apm", "1.0.78" do |s|
|
||||
s.platform = "x86_64-linux"
|
||||
s.required_ruby_version = "< #{next_minor}.dev"
|
||||
s.required_ruby_version = "< #{next_ruby_minor}.dev"
|
||||
end
|
||||
|
||||
build_gem "raygun-apm", "1.0.78" do |s|
|
||||
s.platform = "universal-darwin"
|
||||
s.required_ruby_version = "< #{next_minor}.dev"
|
||||
s.required_ruby_version = "< #{next_ruby_minor}.dev"
|
||||
end
|
||||
|
||||
build_gem "raygun-apm", "1.0.78" do |s|
|
||||
s.platform = "x64-mingw32"
|
||||
s.required_ruby_version = "< #{next_minor}.dev"
|
||||
s.required_ruby_version = "< #{next_ruby_minor}.dev"
|
||||
end
|
||||
|
||||
build_gem "raygun-apm", "1.0.78" do |s|
|
||||
s.platform = "x64-mingw-ucrt"
|
||||
s.required_ruby_version = "< #{next_minor}.dev"
|
||||
s.required_ruby_version = "< #{next_ruby_minor}.dev"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -245,6 +245,43 @@ RSpec.describe "bundle install with install-time dependencies" do
|
|||
expect(the_bundle).to include_gems("rack 1.2")
|
||||
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
|
||||
build_repo4 do
|
||||
build_gem "rack", "9001.0.0" do |s|
|
||||
|
|
|
@ -66,7 +66,7 @@ RSpec.context "when using gem before installing" do
|
|||
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_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("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
|
||||
|
@ -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("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("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
|
||||
|
|
|
@ -239,6 +239,40 @@ RSpec.describe "bundler/inline#gemfile" do
|
|||
expect(err).to be_empty
|
||||
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
|
||||
script <<-RUBY, :env => { "BUNDLE_FROZEN" => "true" }
|
||||
gemfile do
|
||||
|
|
|
@ -471,6 +471,14 @@ module Spec
|
|||
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
|
||||
# https://github.com/rubygems/rubygems/commit/929e92d752baad3a08f3ac92eaec162cb96aedd1
|
||||
def rubygems_version_failing_to_activate_bundler_prereleases
|
||||
|
|
|
@ -18,6 +18,12 @@ module Spec
|
|||
gem_load_and_activate(gem_name, bin_container)
|
||||
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)
|
||||
gem_activate(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}'`"
|
||||
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)
|
||||
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
|
||||
end
|
||||
|
||||
|
|
|
@ -72,4 +72,4 @@ DEPENDENCIES
|
|||
webrick (~> 1.6)
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.13
|
||||
2.3.14
|
||||
|
|
|
@ -60,4 +60,4 @@ DEPENDENCIES
|
|||
test-unit
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.13
|
||||
2.3.14
|
||||
|
|
|
@ -66,4 +66,4 @@ DEPENDENCIES
|
|||
test-unit
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.13
|
||||
2.3.14
|
||||
|
|
|
@ -41,4 +41,4 @@ DEPENDENCIES
|
|||
webrick (= 1.7.0)
|
||||
|
||||
BUNDLED WITH
|
||||
2.3.13
|
||||
2.3.14
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue