Merge RubyGems-3.3.22 and Bundler-2.3.22

This commit is contained in:
Hiroshi SHIBATA 2022-09-16 16:06:06 +09:00 committed by nagachika
parent b3969f769a
commit afb5971031
87 changed files with 943 additions and 434 deletions

View file

@ -22,14 +22,12 @@ Gem::Specification.new do |s|
s.summary = "The best way to manage your application's dependencies" s.summary = "The best way to manage your application's dependencies"
s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably" s.description = "Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably"
if s.respond_to?(:metadata=) s.metadata = {
s.metadata = { "bug_tracker_uri" => "https://github.com/rubygems/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler",
"bug_tracker_uri" => "https://github.com/rubygems/rubygems/issues?q=is%3Aopen+is%3Aissue+label%3ABundler", "changelog_uri" => "https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md",
"changelog_uri" => "https://github.com/rubygems/rubygems/blob/master/bundler/CHANGELOG.md", "homepage_uri" => "https://bundler.io/",
"homepage_uri" => "https://bundler.io/", "source_code_uri" => "https://github.com/rubygems/rubygems/tree/master/bundler",
"source_code_uri" => "https://github.com/rubygems/rubygems/", }
}
end
s.required_ruby_version = ">= 2.3.0" s.required_ruby_version = ">= 2.3.0"
s.required_rubygems_version = ">= 2.5.2" s.required_rubygems_version = ">= 2.5.2"

View file

@ -372,6 +372,7 @@ module Bundler
method_option "group", :aliases => "-g", :type => :string method_option "group", :aliases => "-g", :type => :string
method_option "source", :aliases => "-s", :type => :string method_option "source", :aliases => "-s", :type => :string
method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string." method_option "require", :aliases => "-r", :type => :string, :banner => "Adds require path to gem. Provide false, or a path as a string."
method_option "path", :type => :string
method_option "git", :type => :string method_option "git", :type => :string
method_option "github", :type => :string method_option "github", :type => :string
method_option "branch", :type => :string method_option "branch", :type => :string
@ -516,7 +517,7 @@ module Bundler
end end
end end
desc "version", "Prints the bundler's version information" desc "version", "Prints Bundler version information"
def version def version
cli_help = current_command.name == "cli_help" cli_help = current_command.name == "cli_help"
if cli_help || ARGV.include?("version") if cli_help || ARGV.include?("version")

View file

@ -36,17 +36,18 @@ module Bundler
rbx rbx
ruby ruby
truffleruby truffleruby
windows
x64_mingw x64_mingw
].freeze ].freeze
def ruby? def ruby?
return true if Bundler::GemHelpers.generic_local_platform == Gem::Platform::RUBY return true if Bundler::GemHelpers.generic_local_platform == Gem::Platform::RUBY
!mswin? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby") !windows? && (RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx" || RUBY_ENGINE == "maglev" || RUBY_ENGINE == "truffleruby")
end end
def mri? def mri?
!mswin? && RUBY_ENGINE == "ruby" !windows? && RUBY_ENGINE == "ruby"
end end
def rbx? def rbx?
@ -65,16 +66,24 @@ module Bundler
RUBY_ENGINE == "truffleruby" RUBY_ENGINE == "truffleruby"
end end
def mswin? def windows?
Gem.win_platform? Gem.win_platform?
end end
def mswin?
# For backwards compatibility
windows?
# TODO: This should correctly be:
# windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin32" && Bundler.local_platform.cpu == "x86"
end
def mswin64? def mswin64?
Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64" windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mswin64" && Bundler.local_platform.cpu == "x64"
end end
def mingw? def mingw?
Gem.win_platform? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64" windows? && Bundler.local_platform != Gem::Platform::RUBY && Bundler.local_platform.os == "mingw32" && Bundler.local_platform.cpu != "x64"
end end
def x64_mingw? def x64_mingw?

View file

@ -484,15 +484,13 @@ module Bundler
def resolver def resolver
@resolver ||= begin @resolver ||= begin
last_resolve = converge_locked_specs last_resolve = converge_locked_specs
Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve, platforms) remove_ruby_from_platforms_if_necessary!(dependencies)
Resolver.new(source_requirements, last_resolve, gem_version_promoter, additional_base_requirements_for_resolve(last_resolve), platforms)
end end
end end
def expanded_dependencies def expanded_dependencies
@expanded_dependencies ||= begin @expanded_dependencies ||= expand_dependencies(dependencies + metadata_dependencies, true)
remove_ruby_from_platforms_if_necessary!(dependencies)
expand_dependencies(dependencies + metadata_dependencies, true)
end
end end
def filter_specs(specs, deps) def filter_specs(specs, deps)
@ -880,9 +878,9 @@ module Bundler
end end
end end
def additional_base_requirements_for_resolve def additional_base_requirements_for_resolve(last_resolve)
return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources) return [] unless @locked_gems && unlocking? && !sources.expired_sources?(@locked_gems.sources)
converge_specs(@originally_locked_specs).map do |locked_spec| converge_specs(@originally_locked_specs - last_resolve).map do |locked_spec|
Dependency.new(locked_spec.name, ">= #{locked_spec.version}") Dependency.new(locked_spec.name, ">= #{locked_spec.version}")
end.uniq end.uniq
end end
@ -896,7 +894,6 @@ module Bundler
remove_platform(Gem::Platform::RUBY) remove_platform(Gem::Platform::RUBY)
add_current_platform add_current_platform
resolver.platforms = @platforms
end end
def source_map def source_map

View file

@ -7,92 +7,24 @@ require_relative "rubygems_ext"
module Bundler module Bundler
class Dependency < Gem::Dependency class Dependency < Gem::Dependency
attr_reader :autorequire attr_reader :autorequire
attr_reader :groups, :platforms, :gemfile, :git, :github, :branch, :ref, :force_ruby_platform attr_reader :groups, :platforms, :gemfile, :path, :git, :github, :branch, :ref, :force_ruby_platform
# rubocop:disable Naming/VariableNumber ALL_RUBY_VERSIONS = ((18..27).to_a + (30..31).to_a).freeze
PLATFORM_MAP = { PLATFORM_MAP = {
:ruby => Gem::Platform::RUBY, :ruby => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
:ruby_18 => Gem::Platform::RUBY, :mri => [Gem::Platform::RUBY, ALL_RUBY_VERSIONS],
:ruby_19 => Gem::Platform::RUBY, :rbx => [Gem::Platform::RUBY],
:ruby_20 => Gem::Platform::RUBY, :truffleruby => [Gem::Platform::RUBY],
:ruby_21 => Gem::Platform::RUBY, :jruby => [Gem::Platform::JAVA, [18, 19]],
:ruby_22 => Gem::Platform::RUBY, :windows => [Gem::Platform::WINDOWS, ALL_RUBY_VERSIONS],
:ruby_23 => Gem::Platform::RUBY, :mswin => [Gem::Platform::MSWIN, ALL_RUBY_VERSIONS],
:ruby_24 => Gem::Platform::RUBY, :mswin64 => [Gem::Platform::MSWIN64, ALL_RUBY_VERSIONS - [18]],
:ruby_25 => Gem::Platform::RUBY, :mingw => [Gem::Platform::MINGW, ALL_RUBY_VERSIONS],
:ruby_26 => Gem::Platform::RUBY, :x64_mingw => [Gem::Platform::X64_MINGW, ALL_RUBY_VERSIONS - [18, 19]],
:ruby_27 => Gem::Platform::RUBY, }.each_with_object({}) do |(platform, spec), hash|
:ruby_30 => Gem::Platform::RUBY, hash[platform] = spec[0]
:ruby_31 => Gem::Platform::RUBY, spec[1]&.each {|version| hash[:"#{platform}_#{version}"] = spec[0] }
:mri => Gem::Platform::RUBY, end.freeze
:mri_18 => Gem::Platform::RUBY,
:mri_19 => Gem::Platform::RUBY,
:mri_20 => Gem::Platform::RUBY,
:mri_21 => Gem::Platform::RUBY,
:mri_22 => Gem::Platform::RUBY,
:mri_23 => Gem::Platform::RUBY,
:mri_24 => Gem::Platform::RUBY,
:mri_25 => Gem::Platform::RUBY,
:mri_26 => Gem::Platform::RUBY,
:mri_27 => Gem::Platform::RUBY,
:mri_30 => Gem::Platform::RUBY,
:mri_31 => Gem::Platform::RUBY,
:rbx => Gem::Platform::RUBY,
:truffleruby => Gem::Platform::RUBY,
:jruby => Gem::Platform::JAVA,
:jruby_18 => Gem::Platform::JAVA,
:jruby_19 => Gem::Platform::JAVA,
:mswin => Gem::Platform::MSWIN,
:mswin_18 => Gem::Platform::MSWIN,
:mswin_19 => Gem::Platform::MSWIN,
:mswin_20 => Gem::Platform::MSWIN,
:mswin_21 => Gem::Platform::MSWIN,
:mswin_22 => Gem::Platform::MSWIN,
:mswin_23 => Gem::Platform::MSWIN,
:mswin_24 => Gem::Platform::MSWIN,
:mswin_25 => Gem::Platform::MSWIN,
:mswin_26 => Gem::Platform::MSWIN,
:mswin_27 => Gem::Platform::MSWIN,
:mswin_30 => Gem::Platform::MSWIN,
:mswin_31 => Gem::Platform::MSWIN,
:mswin64 => Gem::Platform::MSWIN64,
:mswin64_19 => Gem::Platform::MSWIN64,
:mswin64_20 => Gem::Platform::MSWIN64,
:mswin64_21 => Gem::Platform::MSWIN64,
:mswin64_22 => Gem::Platform::MSWIN64,
:mswin64_23 => Gem::Platform::MSWIN64,
:mswin64_24 => Gem::Platform::MSWIN64,
:mswin64_25 => Gem::Platform::MSWIN64,
:mswin64_26 => Gem::Platform::MSWIN64,
:mswin64_27 => Gem::Platform::MSWIN64,
:mswin64_30 => Gem::Platform::MSWIN64,
:mswin64_31 => Gem::Platform::MSWIN64,
:mingw => Gem::Platform::MINGW,
:mingw_18 => Gem::Platform::MINGW,
:mingw_19 => Gem::Platform::MINGW,
:mingw_20 => Gem::Platform::MINGW,
:mingw_21 => Gem::Platform::MINGW,
:mingw_22 => Gem::Platform::MINGW,
:mingw_23 => Gem::Platform::MINGW,
:mingw_24 => Gem::Platform::MINGW,
:mingw_25 => Gem::Platform::MINGW,
:mingw_26 => Gem::Platform::MINGW,
:mingw_27 => Gem::Platform::MINGW,
:mingw_30 => Gem::Platform::MINGW,
:mingw_31 => Gem::Platform::MINGW,
:x64_mingw => Gem::Platform::X64_MINGW,
:x64_mingw_20 => Gem::Platform::X64_MINGW,
:x64_mingw_21 => Gem::Platform::X64_MINGW,
:x64_mingw_22 => Gem::Platform::X64_MINGW,
:x64_mingw_23 => Gem::Platform::X64_MINGW,
:x64_mingw_24 => Gem::Platform::X64_MINGW,
:x64_mingw_25 => Gem::Platform::X64_MINGW,
:x64_mingw_26 => Gem::Platform::X64_MINGW,
:x64_mingw_27 => Gem::Platform::X64_MINGW,
:x64_mingw_30 => Gem::Platform::X64_MINGW,
:x64_mingw_31 => Gem::Platform::X64_MINGW,
}.freeze
# rubocop:enable Naming/VariableNumber
def initialize(name, version, options = {}, &blk) def initialize(name, version, options = {}, &blk)
type = options["type"] || :runtime type = options["type"] || :runtime
@ -101,6 +33,7 @@ module Bundler
@autorequire = nil @autorequire = nil
@groups = Array(options["group"] || :default).map(&:to_sym) @groups = Array(options["group"] || :default).map(&:to_sym)
@source = options["source"] @source = options["source"]
@path = options["path"]
@git = options["git"] @git = options["git"]
@github = options["github"] @github = options["github"]
@branch = options["branch"] @branch = options["branch"]
@ -151,7 +84,7 @@ module Bundler
def to_lock def to_lock
out = super out = super
out << "!" if source out << "!" if source
out << "\n" out
end end
def specific? def specific?

View file

@ -12,7 +12,7 @@ module Bundler
super() super()
@name = name @name = name
@version = Gem::Version.create version @version = Gem::Version.create version
@platform = platform @platform = Gem::Platform.new(platform)
@spec_fetcher = spec_fetcher @spec_fetcher = spec_fetcher
@dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) } @dependencies = dependencies.map {|dep, reqs| build_dependency(dep, reqs) }

View file

@ -39,7 +39,6 @@ module Bundler
settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? } settings_flag(:setup_makes_kernel_gem_public) { !bundler_3_mode? }
settings_flag(:suppress_install_using_messages) { bundler_3_mode? } settings_flag(:suppress_install_using_messages) { bundler_3_mode? }
settings_flag(:update_requires_all_flag) { bundler_4_mode? } settings_flag(:update_requires_all_flag) { bundler_4_mode? }
settings_flag(:use_gem_version_promoter_for_major_updates) { bundler_3_mode? }
settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install } settings_option(:default_cli_command) { bundler_3_mode? ? :cli_help : :install }

View file

@ -55,19 +55,17 @@ module Bundler
@level = v @level = v
end end
# Given a Dependency and an Array of SpecGroups of available versions for a # Given a Dependency and an Array of Specifications of available versions for a
# gem, this method will return the Array of SpecGroups sorted (and possibly # gem, this method will return the Array of Specifications sorted (and possibly
# truncated if strict is true) in an order to give preference to the current # truncated if strict is true) in an order to give preference to the current
# level (:major, :minor or :patch) when resolution is deciding what versions # level (:major, :minor or :patch) when resolution is deciding what versions
# best resolve all dependencies in the bundle. # best resolve all dependencies in the bundle.
# @param dep [Dependency] The Dependency of the gem. # @param dep [Dependency] The Dependency of the gem.
# @param spec_groups [SpecGroup] An array of SpecGroups for the same gem # @param spec_groups [Specification] An array of Specifications for the same gem
# named in the @dep param. # named in the @dep param.
# @return [SpecGroup] A new instance of the SpecGroup Array sorted and # @return [Specification] A new instance of the Specification Array sorted and
# possibly filtered. # possibly filtered.
def sort_versions(dep, spec_groups) def sort_versions(dep, spec_groups)
before_result = "before sort_versions: #{debug_format_result(dep, spec_groups).inspect}" if DEBUG
@sort_versions[dep] ||= begin @sort_versions[dep] ||= begin
gem_name = dep.name gem_name = dep.name
@ -79,11 +77,6 @@ module Bundler
filter_dep_specs(spec_groups, locked_spec) filter_dep_specs(spec_groups, locked_spec)
else else
sort_dep_specs(spec_groups, locked_spec) sort_dep_specs(spec_groups, locked_spec)
end.tap do |specs|
if DEBUG
puts before_result
puts " after sort_versions: #{debug_format_result(dep, specs).inspect}"
end
end end
end end
end end
@ -183,12 +176,5 @@ module Bundler
move, keep = result.partition {|s| s.version.to_s == version.to_s } move, keep = result.partition {|s| s.version.to_s == version.to_s }
keep.concat(move) keep.concat(move)
end end
def debug_format_result(dep, spec_groups)
a = [dep.to_s,
spec_groups.map {|sg| [sg.version, sg.dependencies_for_activated_platforms.map {|dp| [dp.name, dp.requirement.to_s] }] }]
last_map = a.last.map {|sg_data| [sg_data.first.version, sg_data.last.map {|aa| aa.join(" ") }] }
[a.first, last_map, level, strict ? :strict : :not_strict]
end
end end
end end

View file

@ -115,13 +115,14 @@ module Bundler
end end
source = ", :source => \"#{d.source}\"" unless d.source.nil? source = ", :source => \"#{d.source}\"" unless d.source.nil?
path = ", :path => \"#{d.path}\"" unless d.path.nil?
git = ", :git => \"#{d.git}\"" unless d.git.nil? git = ", :git => \"#{d.git}\"" unless d.git.nil?
github = ", :github => \"#{d.github}\"" unless d.github.nil? github = ", :github => \"#{d.github}\"" unless d.github.nil?
branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil? branch = ", :branch => \"#{d.branch}\"" unless d.branch.nil?
ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil? ref = ", :ref => \"#{d.ref}\"" unless d.ref.nil?
require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil? require_path = ", :require => #{convert_autorequire(d.autorequire)}" unless d.autorequire.nil?
%(gem #{name}#{requirement}#{group}#{source}#{git}#{github}#{branch}#{ref}#{require_path}) %(gem #{name}#{requirement}#{group}#{source}#{path}#{git}#{github}#{branch}#{ref}#{require_path})
end.join("\n") end.join("\n")
end end

View file

@ -60,7 +60,7 @@ module Bundler
handled = [] handled = []
definition.dependencies.sort_by(&:to_s).each do |dep| definition.dependencies.sort_by(&:to_s).each do |dep|
next if handled.include?(dep.name) next if handled.include?(dep.name)
out << dep.to_lock out << dep.to_lock << "\n"
handled << dep.name handled << dep.name
end end
end end

View file

@ -1,13 +1,13 @@
.\" 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" "August 2022" "" "" .TH "BUNDLE\-ADD" "1" "September 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
. .
.SH "SYNOPSIS" .SH "SYNOPSIS"
\fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-git=GIT] [\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-skip\-install] [\-\-strict] [\-\-optimistic] \fBbundle add\fR \fIGEM_NAME\fR [\-\-group=GROUP] [\-\-version=VERSION] [\-\-source=SOURCE] [\-\-path=PATH] [\-\-git=GIT] [\-\-github=GITHUB] [\-\-branch=BRANCH] [\-\-ref=REF] [\-\-skip\-install] [\-\-strict] [\-\-optimistic]
. .
.SH "DESCRIPTION" .SH "DESCRIPTION"
Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\. Adds the named gem to the Gemfile and run \fBbundle install\fR\. \fBbundle install\fR can be avoided by using the flag \fB\-\-skip\-install\fR\.
@ -49,6 +49,10 @@ Specify the source for the added gem\.
Adds require path to gem\. Provide false, or a path as a string\. Adds require path to gem\. Provide false, or a path as a string\.
. .
.TP .TP
\fB\-\-path\fR
Specify the file system path for the added gem\.
.
.TP
\fB\-\-git\fR \fB\-\-git\fR
Specify the git source for the added gem\. Specify the git source for the added gem\.
. .

View file

@ -3,7 +3,7 @@ bundle-add(1) -- Add gem to the Gemfile and run bundle install
## SYNOPSIS ## SYNOPSIS
`bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--git=GIT] [--github=GITHUB] [--branch=BRANCH] [--ref=REF] [--skip-install] [--strict] [--optimistic] `bundle add` <GEM_NAME> [--group=GROUP] [--version=VERSION] [--source=SOURCE] [--path=PATH] [--git=GIT] [--github=GITHUB] [--branch=BRANCH] [--ref=REF] [--skip-install] [--strict] [--optimistic]
## DESCRIPTION ## DESCRIPTION
Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`. Adds the named gem to the Gemfile and run `bundle install`. `bundle install` can be avoided by using the flag `--skip-install`.
@ -33,6 +33,9 @@ bundle add rails --group "development, test"
* `--require`, `-r`: * `--require`, `-r`:
Adds require path to gem. Provide false, or a path as a string. Adds require path to gem. Provide false, or a path as a string.
* `--path`:
Specify the file system path for the added gem.
* `--git`: * `--git`:
Specify the git source for the added gem. Specify the git source for the added 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\-BINSTUBS" "1" "August 2022" "" "" .TH "BUNDLE\-BINSTUBS" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-CACHE" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-CHECK" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-CLEAN" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-CONFIG" "1" "September 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-config\fR \- Set bundler configuration options \fBbundle\-config\fR \- Set bundler configuration options

View file

@ -0,0 +1,53 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-CONSOLE" "1" "September 2022" "" ""
.
.SH "NAME"
\fBbundle\-console\fR \- Deprecated way to open an IRB session with the bundle pre\-loaded
.
.SH "SYNOPSIS"
\fBbundle console\fR [GROUP]
.
.SH "DESCRIPTION"
Starts an interactive Ruby console session in the context of the current bundle\.
.
.P
If no \fBGROUP\fR is specified, all gems in the \fBdefault\fR group in the Gemfile(5) \fIhttps://bundler\.io/man/gemfile\.5\.html\fR are preliminarily loaded\.
.
.P
If \fBGROUP\fR is specified, all gems in the given group in the Gemfile in addition to the gems in \fBdefault\fR group are loaded\. Even if the given group does not exist in the Gemfile, IRB console starts without any warning or error\.
.
.P
The environment variable \fBBUNDLE_CONSOLE\fR or \fBbundle config set console\fR can be used to change the shell from the following:
.
.IP "\(bu" 4
\fBirb\fR (default)
.
.IP "\(bu" 4
\fBpry\fR (https://github\.com/pry/pry)
.
.IP "\(bu" 4
\fBripl\fR (https://github\.com/cldwalker/ripl)
.
.IP "" 0
.
.P
\fBbundle console\fR uses irb by default\. An alternative Pry or Ripl can be used with \fBbundle console\fR by adjusting the \fBconsole\fR Bundler setting\. Also make sure that \fBpry\fR or \fBripl\fR is in your Gemfile\.
.
.SH "EXAMPLE"
.
.nf
$ bundle config set console pry
$ bundle console
Resolving dependencies\.\.\.
[1] pry(main)>
.
.fi
.
.SH "NOTES"
This command was deprecated in Bundler 2\.1 and will be removed in 3\.0\. Use \fBbin/console\fR script, which can be generated by \fBbundle gem <NAME>\fR\.
.
.SH "SEE ALSO"
Gemfile(5) \fIhttps://bundler\.io/man/gemfile\.5\.html\fR

View file

@ -0,0 +1,44 @@
bundle-console(1) -- Deprecated way to open an IRB session with the bundle pre-loaded
=====================================================================================
## SYNOPSIS
`bundle console` [GROUP]
## DESCRIPTION
Starts an interactive Ruby console session in the context of the current bundle.
If no `GROUP` is specified, all gems in the `default` group in the [Gemfile(5)](https://bundler.io/man/gemfile.5.html) are
preliminarily loaded.
If `GROUP` is specified, all gems in the given group in the Gemfile in addition
to the gems in `default` group are loaded. Even if the given group does not
exist in the Gemfile, IRB console starts without any warning or error.
The environment variable `BUNDLE_CONSOLE` or `bundle config set console` can be used to change
the shell from the following:
* `irb` (default)
* `pry` (https://github.com/pry/pry)
* `ripl` (https://github.com/cldwalker/ripl)
`bundle console` uses irb by default. An alternative Pry or Ripl can be used with
`bundle console` by adjusting the `console` Bundler setting. Also make sure that
`pry` or `ripl` is in your Gemfile.
## EXAMPLE
$ bundle config set console pry
$ bundle console
Resolving dependencies...
[1] pry(main)>
## NOTES
This command was deprecated in Bundler 2.1 and will be removed in 3.0.
Use `bin/console` script, which can be generated by `bundle gem <NAME>`.
## SEE ALSO
[Gemfile(5)](https://bundler.io/man/gemfile.5.html)

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" "August 2022" "" "" .TH "BUNDLE\-DOCTOR" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-EXEC" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-GEM" "1" "September 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

@ -0,0 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-HELP" "1" "September 2022" "" ""
.
.SH "NAME"
\fBbundle\-help\fR \- Displays detailed help for each subcommand
.
.SH "SYNOPSIS"
\fBbundle help\fR [COMMAND]
.
.SH "DESCRIPTION"
Displays detailed help for the given subcommand\. You can specify a single \fBCOMMAND\fR at the same time\. When \fBCOMMAND\fR is omitted, help for \fBhelp\fR command will be displayed\.

View file

@ -0,0 +1,12 @@
bundle-help(1) -- Displays detailed help for each subcommand
============================================================
## SYNOPSIS
`bundle help` [COMMAND]
## DESCRIPTION
Displays detailed help for the given subcommand.
You can specify a single `COMMAND` at the same time.
When `COMMAND` is omitted, help for `help` command will be displayed.

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" "August 2022" "" "" .TH "BUNDLE\-INFO" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-INIT" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-INJECT" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-INSTALL" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-LIST" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-LOCK" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-OPEN" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-OUTDATED" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-PLATFORM" "1" "September 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\-PLUGIN" "1" "August 2022" "" "" .TH "BUNDLE\-PLUGIN" "1" "September 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\-plugin\fR \- Manage Bundler plugins \fBbundle\-plugin\fR \- Manage Bundler plugins

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" "August 2022" "" "" .TH "BUNDLE\-PRISTINE" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-REMOVE" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-SHOW" "1" "September 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" "August 2022" "" "" .TH "BUNDLE\-UPDATE" "1" "September 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

@ -0,0 +1,35 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "BUNDLE\-VERSION" "1" "September 2022" "" ""
.
.SH "NAME"
\fBbundle\-version\fR \- Prints Bundler version information
.
.SH "SYNOPSIS"
\fBbundle version\fR
.
.SH "DESCRIPTION"
Prints Bundler version information\.
.
.SH "OPTIONS"
No options\.
.
.SH "EXAMPLE"
Print the version of Bundler with build date and commit hash of the in the Git source\.
.
.IP "" 4
.
.nf
bundle version
.
.fi
.
.IP "" 0
.
.P
shows \fBBundler version 2\.3\.21 (2022\-08\-24 commit d54be5fdd8)\fR for example\.
.
.P
cf\. \fBbundle \-\-version\fR shows \fBBundler version 2\.3\.21\fR\.

View file

@ -0,0 +1,24 @@
bundle-version(1) -- Prints Bundler version information
=======================================================
## SYNOPSIS
`bundle version`
## DESCRIPTION
Prints Bundler version information.
## OPTIONS
No options.
## EXAMPLE
Print the version of Bundler with build date and commit hash of the in the Git source.
bundle version
shows `Bundler version 2.3.21 (2022-08-24 commit d54be5fdd8)` for example.
cf. `bundle --version` shows `Bundler version 2.3.21`.

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" "August 2022" "" "" .TH "BUNDLE\-VIZ" "1" "September 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" "August 2022" "" "" .TH "BUNDLE" "1" "September 2022" "" ""
. .
.SH "NAME" .SH "NAME"
\fBbundle\fR \- Ruby Dependency Management \fBbundle\fR \- Ruby Dependency Management
@ -55,7 +55,7 @@ Execute a script in the current bundle
Specify and read configuration options for Bundler Specify and read configuration options for Bundler
. .
.TP .TP
\fBbundle help(1)\fR \fBbundle help(1)\fR \fIbundle\-help\.1\.html\fR
Display detailed help for each subcommand Display detailed help for each subcommand
. .
.SH "UTILITIES" .SH "UTILITIES"
@ -124,6 +124,10 @@ Removes gems from the Gemfile
\fBbundle plugin(1)\fR \fIbundle\-plugin\.1\.html\fR \fBbundle plugin(1)\fR \fIbundle\-plugin\.1\.html\fR
Manage Bundler plugins Manage Bundler plugins
. .
.TP
\fBbundle version(1)\fR \fIbundle\-version\.1\.html\fR
Prints Bundler version information
.
.SH "PLUGINS" .SH "PLUGINS"
When running a command that isn\'t listed in PRIMARY COMMANDS or UTILITIES, Bundler will try to find an executable on your path named \fBbundler\-<command>\fR and execute it, passing down any extra arguments to it\. When running a command that isn\'t listed in PRIMARY COMMANDS or UTILITIES, Bundler will try to find an executable on your path named \fBbundler\-<command>\fR and execute it, passing down any extra arguments to it\.
. .

View file

@ -46,7 +46,7 @@ We divide `bundle` subcommands into primary commands and utilities:
* [`bundle config(1)`](bundle-config.1.html): * [`bundle config(1)`](bundle-config.1.html):
Specify and read configuration options for Bundler Specify and read configuration options for Bundler
* `bundle help(1)`: * [`bundle help(1)`](bundle-help.1.html):
Display detailed help for each subcommand Display detailed help for each subcommand
## UTILITIES ## UTILITIES
@ -100,6 +100,9 @@ We divide `bundle` subcommands into primary commands and utilities:
* [`bundle plugin(1)`](bundle-plugin.1.html): * [`bundle plugin(1)`](bundle-plugin.1.html):
Manage Bundler plugins Manage Bundler plugins
* [`bundle version(1)`](bundle-version.1.html):
Prints Bundler version information
## PLUGINS ## PLUGINS
When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES, When running a command that isn't listed in PRIMARY COMMANDS or UTILITIES,

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" "August 2022" "" "" .TH "GEMFILE" "5" "September 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
@ -254,19 +254,15 @@ There are a number of \fBGemfile\fR platforms:
. .
.TP .TP
\fBruby\fR \fBruby\fR
C Ruby (MRI), Rubinius or TruffleRuby, but \fBNOT\fR Windows C Ruby (MRI), Rubinius, or TruffleRuby, but not Windows
. .
.TP .TP
\fBmri\fR \fBmri\fR
Same as \fIruby\fR, but only C Ruby (MRI) C Ruby (MRI) only, but not Windows
. .
.TP .TP
\fBmingw\fR \fBwindows\fR
Windows 32 bit \'mingw32\' platform (aka RubyInstaller) Windows C Ruby (MRI), including RubyInstaller 32\-bit and 64\-bit versions
.
.TP
\fBx64_mingw\fR
Windows 64 bit \'mingw32\' platform (aka RubyInstaller x64)
. .
.TP .TP
\fBrbx\fR \fBrbx\fR
@ -280,15 +276,8 @@ JRuby
\fBtruffleruby\fR \fBtruffleruby\fR
TruffleRuby TruffleRuby
. .
.TP
\fBmswin\fR
Windows
.
.P .P
You can restrict further by platform and version for all platforms \fIexcept\fR for \fBrbx\fR, \fBjruby\fR, \fBtruffleruby\fR and \fBmswin\fR\. On platforms \fBruby\fR, \fBmri\fR, and \fBwindows\fR, you may additionally specify a version by appending the major and minor version numbers without a delimiter\. For example, to specify that a gem should only be used on platform \fBruby\fR version 2\.3, use:
.
.P
To specify a version in addition to a platform, append the version number without the delimiter to the platform\. For example, to specify that a gem should only be used on platforms with Ruby 2\.3, use:
. .
.IP "" 4 .IP "" 4
. .
@ -301,26 +290,7 @@ ruby_23
.IP "" 0 .IP "" 0
. .
.P .P
The full list of platforms and supported versions includes: As with groups (above), you may specify one or more platforms:
.
.TP
\fBruby\fR
1\.8, 1\.9, 2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.TP
\fBmri\fR
1\.8, 1\.9, 2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.TP
\fBmingw\fR
1\.8, 1\.9, 2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.TP
\fBx64_mingw\fR
2\.0, 2\.1, 2\.2, 2\.3, 2\.4, 2\.5, 2\.6
.
.P
As with groups, you can specify one or more platforms:
. .
.IP "" 4 .IP "" 4
. .
@ -328,7 +298,7 @@ As with groups, you can specify one or more platforms:
gem "weakling", platforms: :jruby gem "weakling", platforms: :jruby
gem "ruby\-debug", platforms: :mri_18 gem "ruby\-debug", platforms: :mri_18
gem "nokogiri", platforms: [:mri_18, :jruby] gem "nokogiri", platforms: [:windows_26, :jruby]
. .
.fi .fi
. .

View file

@ -190,47 +190,29 @@ platforms.
There are a number of `Gemfile` platforms: There are a number of `Gemfile` platforms:
* `ruby`: * `ruby`:
C Ruby (MRI), Rubinius or TruffleRuby, but `NOT` Windows C Ruby (MRI), Rubinius, or TruffleRuby, but not Windows
* `mri`: * `mri`:
Same as _ruby_, but only C Ruby (MRI) C Ruby (MRI) only, but not Windows
* `mingw`: * `windows`:
Windows 32 bit 'mingw32' platform (aka RubyInstaller) Windows C Ruby (MRI), including RubyInstaller 32-bit and 64-bit versions
* `x64_mingw`:
Windows 64 bit 'mingw32' platform (aka RubyInstaller x64)
* `rbx`: * `rbx`:
Rubinius Rubinius
* `jruby`: * `jruby`:
JRuby JRuby
* `truffleruby`: * `truffleruby`:
TruffleRuby TruffleRuby
* `mswin`:
Windows
You can restrict further by platform and version for all platforms *except* for On platforms `ruby`, `mri`, and `windows`, you may additionally specify a version
`rbx`, `jruby`, `truffleruby` and `mswin`. by appending the major and minor version numbers without a delimiter. For example,
to specify that a gem should only be used on platform `ruby` version 2.3, use:
To specify a version in addition to a platform, append the version number without
the delimiter to the platform. For example, to specify that a gem should only be
used on platforms with Ruby 2.3, use:
ruby_23 ruby_23
The full list of platforms and supported versions includes: As with groups (above), you may specify one or more platforms:
* `ruby`:
1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
* `mri`:
1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
* `mingw`:
1.8, 1.9, 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
* `x64_mingw`:
2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6
As with groups, you can specify one or more platforms:
gem "weakling", platforms: :jruby gem "weakling", platforms: :jruby
gem "ruby-debug", platforms: :mri_18 gem "ruby-debug", platforms: :mri_18
gem "nokogiri", platforms: [:mri_18, :jruby] gem "nokogiri", platforms: [:windows_26, :jruby]
All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`, All operations involving groups ([`bundle install`](bundle-install.1.html), `Bundler.setup`,
`Bundler.require`) behave exactly the same as if any groups not `Bundler.require`) behave exactly the same as if any groups not

View file

@ -6,9 +6,11 @@ bundle-cache(1) bundle-cache.1
bundle-check(1) bundle-check.1 bundle-check(1) bundle-check.1
bundle-clean(1) bundle-clean.1 bundle-clean(1) bundle-clean.1
bundle-config(1) bundle-config.1 bundle-config(1) bundle-config.1
bundle-console(1) bundle-console.1
bundle-doctor(1) bundle-doctor.1 bundle-doctor(1) bundle-doctor.1
bundle-exec(1) bundle-exec.1 bundle-exec(1) bundle-exec.1
bundle-gem(1) bundle-gem.1 bundle-gem(1) bundle-gem.1
bundle-help(1) bundle-help.1
bundle-info(1) bundle-info.1 bundle-info(1) bundle-info.1
bundle-init(1) bundle-init.1 bundle-init(1) bundle-init.1
bundle-inject(1) bundle-inject.1 bundle-inject(1) bundle-inject.1
@ -23,4 +25,5 @@ bundle-pristine(1) bundle-pristine.1
bundle-remove(1) bundle-remove.1 bundle-remove(1) bundle-remove.1
bundle-show(1) bundle-show.1 bundle-show(1) bundle-show.1
bundle-update(1) bundle-update.1 bundle-update(1) bundle-update.1
bundle-version(1) bundle-version.1
bundle-viz(1) bundle-viz.1 bundle-viz(1) bundle-viz.1

View file

@ -2,8 +2,11 @@
module Bundler module Bundler
module FetchMetadata module FetchMetadata
# A fallback is included because the original version of the specification
# API didn't include that field, so some marshalled specs in the index have it
# set to +nil+.
def matches_current_ruby? def matches_current_ruby?
@required_ruby_version ||= _remote_specification.required_ruby_version @required_ruby_version ||= _remote_specification.required_ruby_version || Gem::Requirement.default
super super
end end

View file

@ -3,12 +3,11 @@
module Bundler module Bundler
class Resolver class Resolver
require_relative "vendored_molinillo" require_relative "vendored_molinillo"
require_relative "resolver/base"
require_relative "resolver/spec_group" require_relative "resolver/spec_group"
include GemHelpers include GemHelpers
attr_writer :platforms
# Figures out the best possible configuration of gems that satisfies # Figures out the best possible configuration of gems that satisfies
# the list of passed dependencies and any child dependencies without # the list of passed dependencies and any child dependencies without
# causing any gem activation errors. # causing any gem activation errors.
@ -27,15 +26,13 @@ module Bundler
def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms) def initialize(source_requirements, base, gem_version_promoter, additional_base_requirements, platforms)
@source_requirements = source_requirements @source_requirements = source_requirements
@base = base @base = Resolver::Base.new(base, additional_base_requirements)
@resolver = Molinillo::Resolver.new(self, self) @resolver = Molinillo::Resolver.new(self, self)
@results_for = {} @results_for = {}
@search_for = {} @search_for = {}
@additional_base_requirements = additional_base_requirements
@platforms = platforms @platforms = platforms
@resolving_only_for_ruby = platforms == [Gem::Platform::RUBY] @resolving_only_for_ruby = platforms == [Gem::Platform::RUBY]
@gem_version_promoter = gem_version_promoter @gem_version_promoter = gem_version_promoter
@use_gvp = Bundler.feature_flag.use_gem_version_promoter_for_major_updates? || !@gem_version_promoter.major?
end end
def start(requirements, exclude_specs: []) def start(requirements, exclude_specs: [])
@ -45,18 +42,11 @@ module Bundler
remove_from_candidates(spec) remove_from_candidates(spec)
end end
@base_dg = Molinillo::DependencyGraph.new
@base.each do |ls|
dep = Dependency.new(ls.name, ls.version)
@base_dg.add_vertex(ls.name, DepProxy.get_proxy(dep, ls.platform), true)
end
@additional_base_requirements.each {|d| @base_dg.add_vertex(d.name, d) }
@gem_version_promoter.prerelease_specified = @prerelease_specified = {} @gem_version_promoter.prerelease_specified = @prerelease_specified = {}
requirements.each {|dep| @prerelease_specified[dep.name] ||= dep.prerelease? } requirements.each {|dep| @prerelease_specified[dep.name] ||= dep.prerelease? }
verify_gemfile_dependencies_are_found!(requirements) verify_gemfile_dependencies_are_found!(requirements)
result = @resolver.resolve(requirements, @base_dg). result = @resolver.resolve(requirements).
map(&:payload). map(&:payload).
reject {|sg| sg.name.end_with?("\0") }. reject {|sg| sg.name.end_with?("\0") }.
map(&:to_specs). map(&:to_specs).
@ -64,8 +54,20 @@ module Bundler
SpecSet.new(SpecSet.new(result).for(regular_requirements, false, @platforms)) SpecSet.new(SpecSet.new(result).for(regular_requirements, false, @platforms))
rescue Molinillo::VersionConflict => e rescue Molinillo::VersionConflict => e
conflicts = e.conflicts
deps_to_unlock = conflicts.values.inject([]) do |deps, conflict|
deps |= conflict.requirement_trees.flatten.map {|req| base_requirements[req.name] }.compact
end
if deps_to_unlock.any?
@base.unlock_deps(deps_to_unlock)
reset_spec_cache
retry
end
message = version_conflict_message(e) message = version_conflict_message(e)
raise VersionConflict.new(e.conflicts.keys.uniq, message) raise VersionConflict.new(conflicts.keys.uniq, message)
rescue Molinillo::CircularDependencyError => e rescue Molinillo::CircularDependencyError => e
names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" } names = e.dependencies.sort_by(&:name).map {|d| "gem '#{d.name}'" }
raise CyclicDependencyError, "Your bundle requires gems that depend" \ raise CyclicDependencyError, "Your bundle requires gems that depend" \
@ -120,31 +122,22 @@ module Bundler
dependency = dependency_proxy.dep dependency = dependency_proxy.dep
name = dependency.name name = dependency.name
@search_for[dependency_proxy] ||= begin @search_for[dependency_proxy] ||= begin
results = results_for(dependency) + @base[name].select {|spec| requirement_satisfied_by?(dependency, nil, spec) } locked_results = @base[name].select {|spec| requirement_satisfied_by?(dependency, nil, spec) }
locked_requirement = base_requirements[name]
results = results_for(dependency) + locked_results
results = results.select {|spec| requirement_satisfied_by?(locked_requirement, nil, spec) } if locked_requirement
if vertex = @base_dg.vertex_named(name) if !@prerelease_specified[name] && locked_results.empty?
locked_requirement = vertex.payload.requirement
end
if !@prerelease_specified[name] && (!@use_gvp || locked_requirement.nil?)
# Move prereleases to the beginning of the list, so they're considered # Move prereleases to the beginning of the list, so they're considered
# last during resolution. # last during resolution.
pre, results = results.partition {|spec| spec.version.prerelease? } pre, results = results.partition {|spec| spec.version.prerelease? }
results = pre + results results = pre + results
end end
spec_groups = if results.any? if results.any?
nested = [] results = @gem_version_promoter.sort_versions(dependency, results)
results.each do |spec|
version, specs = nested.last results.group_by(&:version).reduce([]) do |groups, (_, specs)|
if version == spec.version
specs << spec
else
nested << [spec.version, [spec]]
end
end
nested.reduce([]) do |groups, (version, specs)|
next groups if locked_requirement && !locked_requirement.satisfied_by?(version)
next groups unless specs.any? {|spec| spec.match_platform(platform) } next groups unless specs.any? {|spec| spec.match_platform(platform) }
specs_by_platform = Hash.new do |current_specs, current_platform| specs_by_platform = Hash.new do |current_specs, current_platform|
@ -167,13 +160,6 @@ module Bundler
else else
[] []
end end
# GVP handles major itself, but it's still a bit risky to trust it with it
# until we get it settled with new behavior. For 2.x it can take over all cases.
if !@use_gvp
spec_groups
else
@gem_version_promoter.sort_versions(dependency, spec_groups)
end
end end
end end
@ -199,12 +185,6 @@ module Bundler
"Gemfile" "Gemfile"
end end
def name_for_locking_dependency_source
Bundler.default_lockfile.basename.to_s
rescue StandardError
"Gemfile.lock"
end
def requirement_satisfied_by?(requirement, activated, spec) def requirement_satisfied_by?(requirement, activated, spec)
requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec) requirement.matches_spec?(spec) || spec.source.is_a?(Source::Gemspec)
end end
@ -218,7 +198,7 @@ module Bundler
name = name_for(dependency) name = name_for(dependency)
vertex = activated.vertex_named(name) vertex = activated.vertex_named(name)
[ [
@base_dg.vertex_named(name) ? 0 : 1, @base[name].any? ? 0 : 1,
vertex.payload ? 0 : 1, vertex.payload ? 0 : 1,
vertex.root? ? 0 : 1, vertex.root? ? 0 : 1,
amount_constrained(dependency), amount_constrained(dependency),
@ -237,9 +217,12 @@ module Bundler
private private
def base_requirements
@base.base_requirements
end
def remove_from_candidates(spec) def remove_from_candidates(spec)
@base.delete(spec) @base.delete(spec)
@gem_version_promoter.reset
@results_for.keys.each do |dep| @results_for.keys.each do |dep|
next unless dep.name == spec.name next unless dep.name == spec.name
@ -247,7 +230,12 @@ module Bundler
@results_for[dep].reject {|s| s.name == spec.name && s.version == spec.version } @results_for[dep].reject {|s| s.name == spec.name && s.version == spec.version }
end end
reset_spec_cache
end
def reset_spec_cache
@search_for = {} @search_for = {}
@gem_version_promoter.reset
end end
# returns an integer \in (-\infty, 0] # returns an integer \in (-\infty, 0]
@ -339,18 +327,6 @@ module Bundler
e.message_with_trees( e.message_with_trees(
:full_message_for_conflict => lambda do |name, conflict| :full_message_for_conflict => lambda do |name, conflict|
o = if name.end_with?("\0")
String.new("Bundler found conflicting requirements for the #{name} version:")
else
String.new("Bundler could not find compatible versions for gem \"#{name}\":")
end
o << %(\n)
if conflict.locked_requirement
o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
o << %( #{SharedHelpers.pretty_dependency(conflict.locked_requirement)}\n)
o << %(\n)
end
o << %( In #{name_for_explicit_dependency_source}:\n)
trees = conflict.requirement_trees trees = conflict.requirement_trees
# called first, because we want to reduce the amount of work required to find maximal empty sets # called first, because we want to reduce the amount of work required to find maximal empty sets
@ -369,30 +345,41 @@ module Bundler
trees.sort_by! {|t| t.reverse.map(&:name) } trees.sort_by! {|t| t.reverse.map(&:name) }
end end
o << trees.map do |tree| if trees.size > 1 || name == "bundler"
t = "".dup o = if name.end_with?("\0")
depth = 2 String.new("Bundler found conflicting requirements for the #{name} version:")
base_tree = tree.first
base_tree_name = base_tree.name
if base_tree_name.end_with?("\0")
t = nil
else else
tree.each do |req| String.new("Bundler could not find compatible versions for gem \"#{name}\":")
t << " " * depth << SharedHelpers.pretty_dependency(req)
unless tree.last == req
if spec = conflict.activated_by_name[req.name]
t << %( was resolved to #{spec.version}, which)
end
t << %( depends on)
end
t << %(\n)
depth += 1
end
end end
t o << %(\n)
end.compact.join("\n") o << %( In #{name_for_explicit_dependency_source}:\n)
o << trees.map do |tree|
t = "".dup
depth = 2
base_tree = tree.first
base_tree_name = base_tree.name
if base_tree_name.end_with?("\0")
t = nil
else
tree.each do |req|
t << " " * depth << SharedHelpers.pretty_dependency(req)
unless tree.last == req
if spec = conflict.activated_by_name[req.name]
t << %( was resolved to #{spec.version}, which)
end
t << %( depends on)
end
t << %(\n)
depth += 1
end
end
t
end.compact.join("\n")
else
o = String.new
end
if name == "bundler" if name == "bundler"
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION})) o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
@ -416,17 +403,13 @@ module Bundler
end end
elsif name.end_with?("\0") elsif name.end_with?("\0")
o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(@metadata_requirements.find {|req| req.name == name })}\n\n) o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(@metadata_requirements.find {|req| req.name == name })}\n\n)
elsif conflict.locked_requirement
o << "\n"
o << %(Deleting your #{name_for_locking_dependency_source} file and running `bundle install` will rebuild your snapshot from scratch, using only\n)
o << %(the gems in your Gemfile, which may resolve the conflict.\n)
elsif !conflict.existing elsif !conflict.existing
o << "\n" o << "\n"
relevant_source = conflict.requirement.source || source_for(name) relevant_source = conflict.requirement.source || source_for(name)
extra_message = if conflict.requirement_trees.first.size > 1 extra_message = if trees.first.size > 1
", which is required by gem '#{SharedHelpers.pretty_dependency(conflict.requirement_trees.first[-2])}'," ", which is required by gem '#{SharedHelpers.pretty_dependency(trees.first[-2])}',"
else else
"" ""
end end

View file

@ -0,0 +1,50 @@
# frozen_string_literal: true
module Bundler
class Resolver
class Base
def initialize(base, additional_base_requirements)
@base = base
@additional_base_requirements = additional_base_requirements
end
def [](name)
@base[name]
end
def delete(spec)
@base.delete(spec)
end
def base_requirements
@base_requirements ||= build_base_requirements
end
def unlock_deps(deps)
exact, lower_bound = deps.partition(&:specific?)
exact.each do |exact_dep|
@base.delete_by_name_and_version(exact_dep.name, exact_dep.requirement.requirements.first.last)
end
lower_bound.each do |lower_bound_dep|
@additional_base_requirements.delete(lower_bound_dep)
end
@base_requirements = nil
end
private
def build_base_requirements
base_requirements = {}
@base.each do |ls|
dep = Dependency.new(ls.name, ls.version)
base_requirements[ls.name] = DepProxy.get_proxy(dep, ls.platform)
end
@additional_base_requirements.each {|d| base_requirements[d.name] = d }
base_requirements
end
end
end
end

View file

@ -237,8 +237,11 @@ module Gem
MINGW = Gem::Platform.new("x86-mingw32") MINGW = Gem::Platform.new("x86-mingw32")
X64_MINGW = [Gem::Platform.new("x64-mingw32"), X64_MINGW = [Gem::Platform.new("x64-mingw32"),
Gem::Platform.new("x64-mingw-ucrt")].freeze Gem::Platform.new("x64-mingw-ucrt")].freeze
WINDOWS = [MSWIN, MSWIN64, MINGW, X64_MINGW].flatten.freeze
X64_LINUX = Gem::Platform.new("x86_64-linux")
X64_LINUX_MUSL = Gem::Platform.new("x86_64-linux-musl")
if Gem::Platform.new("x86_64-linux-musl") === Gem::Platform.new("x86_64-linux") if X64_LINUX === X64_LINUX_MUSL
remove_method :=== remove_method :===
def ===(other) def ===(other)
@ -258,7 +261,7 @@ module Gem
# version # version
( (
(@os != "linux" && (@version.nil? || other.version.nil?)) || (@os != "linux" && (@version.nil? || other.version.nil?)) ||
(@os == "linux" && ((@version.nil? && ["gnu", "musl"].include?(other.version)) || (@version == "gnu" && other.version.nil?))) || (@os == "linux" && (other.version == "gnu#{@version}" || other.version == "musl#{@version}" || @version == "gnu#{other.version}")) ||
@version == other.version @version == other.version
) )
end end
@ -274,14 +277,21 @@ module Gem
def match_gem?(platform, gem_name) def match_gem?(platform, gem_name)
match_platforms?(platform, Gem.platforms) match_platforms?(platform, Gem.platforms)
end end
end
match_platforms_defined = Gem::Platform.respond_to?(:match_platforms?, true)
if !match_platforms_defined || Gem::Platform.send(:match_platforms?, Gem::Platform::X64_LINUX_MUSL, [Gem::Platform::X64_LINUX])
private private
remove_method :match_platforms? if match_platforms_defined
def match_platforms?(platform, platforms) def match_platforms?(platform, platforms)
platforms.any? do |local_platform| platforms.any? do |local_platform|
platform.nil? || platform.nil? ||
local_platform == platform || local_platform == platform ||
(local_platform != Gem::Platform::RUBY && local_platform =~ platform) (local_platform != Gem::Platform::RUBY && platform =~ local_platform)
end end
end end
end end

View file

@ -45,7 +45,6 @@ module Bundler
silence_root_warning silence_root_warning
suppress_install_using_messages suppress_install_using_messages
update_requires_all_flag update_requires_all_flag
use_gem_version_promoter_for_major_updates
].freeze ].freeze
NUMBER_KEYS = %w[ NUMBER_KEYS = %w[

View file

@ -114,10 +114,20 @@ module Bundler
SpecSet.new(arr) SpecSet.new(arr)
end end
def -(other)
SpecSet.new(to_a - other.to_a)
end
def find_by_name_and_platform(name, platform) def find_by_name_and_platform(name, platform)
@specs.detect {|spec| spec.name == name && spec.match_platform(platform) } @specs.detect {|spec| spec.name == name && spec.match_platform(platform) }
end end
def delete_by_name_and_version(name, version)
@specs.reject! {|spec| spec.name == name && spec.version == version }
@lookup = nil
@sorted = nil
end
def what_required(spec) def what_required(spec)
unless req = find {|s| s.dependencies.any? {|d| d.type == :runtime && d.name == spec.name } } unless req = find {|s| s.dependencies.any? {|d| d.type == :runtime && d.name == spec.name } }
return [spec] return [spec]

View file

@ -1,7 +1,7 @@
# frozen_string_literal: false # frozen_string_literal: false
module Bundler module Bundler
VERSION = "2.3.21".freeze VERSION = "2.3.22".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.21".freeze VERSION = "3.3.22".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

@ -180,7 +180,7 @@ class Gem::Platform
# version # version
( (
(@os != "linux" && (@version.nil? || other.version.nil?)) || (@os != "linux" && (@version.nil? || other.version.nil?)) ||
(@os == "linux" && ((@version.nil? && ["gnu", "musl"].include?(other.version)) || (@version == "gnu" && other.version.nil?))) || (@os == "linux" && (other.version == "gnu#{@version}" || other.version == "musl#{@version}" || @version == "gnu#{other.version}")) ||
@version == other.version @version == other.version
) )
end end

View file

@ -151,7 +151,7 @@ module Gem::QueryUtils
fetcher.detect(specs_type) { true } fetcher.detect(specs_type) { true }
else else
fetcher.detect(specs_type) do |name_tuple| fetcher.detect(specs_type) do |name_tuple|
name === name_tuple.name name === name_tuple.name && options[:version].satisfied_by?(name_tuple.version)
end end
end end
@ -159,7 +159,7 @@ module Gem::QueryUtils
end end
def specs_type def specs_type
if options[:all] if options[:all] || options[:version].specific?
if options[:prerelease] if options[:prerelease]
:complete :complete
else else

View file

@ -0,0 +1,143 @@
# frozen_string_literal: true
RSpec.describe Bundler::Dependency do
let(:options) do
{}
end
let(:dependency) do
described_class.new(
"test_gem",
"1.0.0",
options
)
end
describe "to_lock" do
it "returns formatted string" do
expect(dependency.to_lock).to eq(" test_gem (= 1.0.0)")
end
it "matches format of Gem::Dependency#to_lock" do
gem_dependency = Gem::Dependency.new("test_gem", "1.0.0")
expect(dependency.to_lock).to eq(gem_dependency.to_lock)
end
context "when source is passed" do
let(:options) do
{
"source" => Bundler::Source::Git.new({}),
}
end
it "returns formatted string with exclamation mark" do
expect(dependency.to_lock).to eq(" test_gem (= 1.0.0)!")
end
end
end
describe "PLATFORM_MAP" do
subject { described_class::PLATFORM_MAP }
# rubocop:disable Naming/VariableNumber
let(:platforms) do
{ :ruby => Gem::Platform::RUBY,
:ruby_18 => Gem::Platform::RUBY,
:ruby_19 => Gem::Platform::RUBY,
:ruby_20 => Gem::Platform::RUBY,
:ruby_21 => Gem::Platform::RUBY,
:ruby_22 => Gem::Platform::RUBY,
:ruby_23 => Gem::Platform::RUBY,
:ruby_24 => Gem::Platform::RUBY,
:ruby_25 => Gem::Platform::RUBY,
:ruby_26 => Gem::Platform::RUBY,
:ruby_27 => Gem::Platform::RUBY,
:ruby_30 => Gem::Platform::RUBY,
:ruby_31 => Gem::Platform::RUBY,
:mri => Gem::Platform::RUBY,
:mri_18 => Gem::Platform::RUBY,
:mri_19 => Gem::Platform::RUBY,
:mri_20 => Gem::Platform::RUBY,
:mri_21 => Gem::Platform::RUBY,
:mri_22 => Gem::Platform::RUBY,
:mri_23 => Gem::Platform::RUBY,
:mri_24 => Gem::Platform::RUBY,
:mri_25 => Gem::Platform::RUBY,
:mri_26 => Gem::Platform::RUBY,
:mri_27 => Gem::Platform::RUBY,
:mri_30 => Gem::Platform::RUBY,
:mri_31 => Gem::Platform::RUBY,
:rbx => Gem::Platform::RUBY,
:truffleruby => Gem::Platform::RUBY,
:jruby => Gem::Platform::JAVA,
:jruby_18 => Gem::Platform::JAVA,
:jruby_19 => Gem::Platform::JAVA,
:windows => Gem::Platform::WINDOWS,
:windows_18 => Gem::Platform::WINDOWS,
:windows_19 => Gem::Platform::WINDOWS,
:windows_20 => Gem::Platform::WINDOWS,
:windows_21 => Gem::Platform::WINDOWS,
:windows_22 => Gem::Platform::WINDOWS,
:windows_23 => Gem::Platform::WINDOWS,
:windows_24 => Gem::Platform::WINDOWS,
:windows_25 => Gem::Platform::WINDOWS,
:windows_26 => Gem::Platform::WINDOWS,
:windows_27 => Gem::Platform::WINDOWS,
:windows_30 => Gem::Platform::WINDOWS,
:windows_31 => Gem::Platform::WINDOWS,
:mswin => Gem::Platform::MSWIN,
:mswin_18 => Gem::Platform::MSWIN,
:mswin_19 => Gem::Platform::MSWIN,
:mswin_20 => Gem::Platform::MSWIN,
:mswin_21 => Gem::Platform::MSWIN,
:mswin_22 => Gem::Platform::MSWIN,
:mswin_23 => Gem::Platform::MSWIN,
:mswin_24 => Gem::Platform::MSWIN,
:mswin_25 => Gem::Platform::MSWIN,
:mswin_26 => Gem::Platform::MSWIN,
:mswin_27 => Gem::Platform::MSWIN,
:mswin_30 => Gem::Platform::MSWIN,
:mswin_31 => Gem::Platform::MSWIN,
:mswin64 => Gem::Platform::MSWIN64,
:mswin64_19 => Gem::Platform::MSWIN64,
:mswin64_20 => Gem::Platform::MSWIN64,
:mswin64_21 => Gem::Platform::MSWIN64,
:mswin64_22 => Gem::Platform::MSWIN64,
:mswin64_23 => Gem::Platform::MSWIN64,
:mswin64_24 => Gem::Platform::MSWIN64,
:mswin64_25 => Gem::Platform::MSWIN64,
:mswin64_26 => Gem::Platform::MSWIN64,
:mswin64_27 => Gem::Platform::MSWIN64,
:mswin64_30 => Gem::Platform::MSWIN64,
:mswin64_31 => Gem::Platform::MSWIN64,
:mingw => Gem::Platform::MINGW,
:mingw_18 => Gem::Platform::MINGW,
:mingw_19 => Gem::Platform::MINGW,
:mingw_20 => Gem::Platform::MINGW,
:mingw_21 => Gem::Platform::MINGW,
:mingw_22 => Gem::Platform::MINGW,
:mingw_23 => Gem::Platform::MINGW,
:mingw_24 => Gem::Platform::MINGW,
:mingw_25 => Gem::Platform::MINGW,
:mingw_26 => Gem::Platform::MINGW,
:mingw_27 => Gem::Platform::MINGW,
:mingw_30 => Gem::Platform::MINGW,
:mingw_31 => Gem::Platform::MINGW,
:x64_mingw => Gem::Platform::X64_MINGW,
:x64_mingw_20 => Gem::Platform::X64_MINGW,
:x64_mingw_21 => Gem::Platform::X64_MINGW,
:x64_mingw_22 => Gem::Platform::X64_MINGW,
:x64_mingw_23 => Gem::Platform::X64_MINGW,
:x64_mingw_24 => Gem::Platform::X64_MINGW,
:x64_mingw_25 => Gem::Platform::X64_MINGW,
:x64_mingw_26 => Gem::Platform::X64_MINGW,
:x64_mingw_27 => Gem::Platform::X64_MINGW,
:x64_mingw_30 => Gem::Platform::X64_MINGW,
:x64_mingw_31 => Gem::Platform::X64_MINGW }
end
# rubocop:enable Naming/VariableNumber
it "includes all platforms" do
expect(subject).to eq(platforms)
end
end
end

View file

@ -48,6 +48,33 @@ RSpec.describe Bundler::EndpointSpecification do
end end
end end
describe "#required_ruby_version" do
context "required_ruby_version is already set on endpoint specification" do
existing_value = "already set value"
let(:required_ruby_version) { existing_value }
it "should return the current value when already set on endpoint specification" do
remote_spec = double(:remote_spec, :required_ruby_version => "remote_value", :required_rubygems_version => nil)
expect(spec.required_ruby_version). eql?(existing_value)
end
end
it "should return the remote spec value when not set on endpoint specification and remote spec has one" do
remote_value = "remote_value"
remote_spec = double(:remote_spec, :required_ruby_version => remote_value, :required_rubygems_version => nil)
allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec)
expect(spec.required_ruby_version). eql?(remote_value)
end
it "should use the default Gem Requirement value when not set on endpoint specification and not set on remote spec" do
remote_spec = double(:remote_spec, :required_ruby_version => nil, :required_rubygems_version => nil)
allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec)
expect(spec.required_ruby_version). eql?(Gem::Requirement.default)
end
end
it "supports equality comparison" do it "supports equality comparison" do
remote_spec = double(:remote_spec, :required_ruby_version => nil, :required_rubygems_version => nil) remote_spec = double(:remote_spec, :required_ruby_version => nil, :required_rubygems_version => nil)
allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec) allow(spec_fetcher).to receive(:fetch_spec).and_return(remote_spec)

View file

@ -166,14 +166,5 @@ RSpec.describe Bundler::GemVersionPromoter do
end end
end end
end end
context "debug output" do
it "should not kerblooie on its own debug output" do
gvp = unlocking(:level => :patch)
dep = Bundler::DepProxy.get_proxy(dep("foo", "1.2.0").first, "ruby")
result = gvp.send(:debug_format_result, dep, build_spec_groups("foo", %w[1.2.0 1.3.0]))
expect(result.class).to eq Array
end
end
end end
end end

View file

@ -103,6 +103,15 @@ RSpec.describe "bundle add" do
end end
end end
describe "with --path" do
it "adds dependency with specified path" do
bundle "add 'foo' --path='#{lib_path("foo-2.0")}'"
expect(bundled_app_gemfile.read).to match(/gem "foo", "~> 2.0", :path => "#{lib_path("foo-2.0")}"/)
expect(the_bundle).to include_gems "foo 2.0"
end
end
describe "with --git" do describe "with --git" do
it "adds dependency with specified git source" do it "adds dependency with specified git source" do
bundle "add foo --git=#{lib_path("foo-2.0")}" bundle "add foo --git=#{lib_path("foo-2.0")}"

View file

@ -638,11 +638,6 @@ RSpec.describe "bundle clean" do
s.executables = "irb" s.executables = "irb"
end end
if Gem.win_platform? && RUBY_VERSION < "3.1.0"
default_fiddle_version = ruby "require 'fiddle'; puts Gem.loaded_specs['fiddle'].version"
realworld_system_gems "fiddle --version #{default_fiddle_version}"
end
realworld_system_gems "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1" realworld_system_gems "tsort --version 0.1.0", "pathname --version 0.1.0", "set --version 1.0.1"
install_gemfile <<-G install_gemfile <<-G

View file

@ -23,8 +23,8 @@ RSpec.describe "bundle help" do
end end
it "still outputs the old help for commands that do not have man pages yet" do it "still outputs the old help for commands that do not have man pages yet" do
bundle "help version" bundle "help fund"
expect(out).to include("Prints the bundler's version information") expect(out).to include("Lists information about gems seeking funding assistance")
end end
it "looks for a binary and executes it with --help option if it's named bundler-<task>" do it "looks for a binary and executes it with --help option if it's named bundler-<task>" do

View file

@ -285,7 +285,7 @@ RSpec.describe "bundle install with gem sources" do
end end
it "installs gems for windows" do it "installs gems for windows" do
simulate_platform mswin simulate_platform x86_mswin32
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
@ -293,7 +293,7 @@ RSpec.describe "bundle install with gem sources" do
G G
run "require 'platform_specific' ; puts PLATFORM_SPECIFIC" run "require 'platform_specific' ; puts PLATFORM_SPECIFIC"
expect(out).to eq("1.0.0 MSWIN") expect(out).to eq("1.0 x86-mswin32")
end end
end end

View file

@ -217,7 +217,7 @@ RSpec.describe "bundle lock" do
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
lockfile = Bundler::LockfileParser.new(read_lockfile) lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to match_array([java, mingw, specific_local_platform].uniq) expect(lockfile.platforms).to match_array([java, x86_mingw32, specific_local_platform].uniq)
end end
it "supports adding new platforms with force_ruby_platform = true" do it "supports adding new platforms with force_ruby_platform = true" do
@ -241,7 +241,7 @@ RSpec.describe "bundle lock" do
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
lockfile = Bundler::LockfileParser.new(read_lockfile) lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to contain_exactly(rb, linux, java, mingw) expect(lockfile.platforms).to contain_exactly(rb, linux, java, x86_mingw32)
end end
it "supports adding the `ruby` platform" do it "supports adding the `ruby` platform" do
@ -262,12 +262,12 @@ RSpec.describe "bundle lock" do
allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile) allow(Bundler::SharedHelpers).to receive(:find_gemfile).and_return(bundled_app_gemfile)
lockfile = Bundler::LockfileParser.new(read_lockfile) lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to match_array([java, mingw, specific_local_platform].uniq) expect(lockfile.platforms).to match_array([java, x86_mingw32, specific_local_platform].uniq)
bundle "lock --remove-platform java" bundle "lock --remove-platform java"
lockfile = Bundler::LockfileParser.new(read_lockfile) lockfile = Bundler::LockfileParser.new(read_lockfile)
expect(lockfile.platforms).to match_array([mingw, specific_local_platform].uniq) expect(lockfile.platforms).to match_array([x86_mingw32, specific_local_platform].uniq)
end end
it "errors when removing all platforms" do it "errors when removing all platforms" do
@ -280,7 +280,7 @@ RSpec.describe "bundle lock" do
build_repo4 do build_repo4 do
build_gem "ffi", "1.9.14" build_gem "ffi", "1.9.14"
build_gem "ffi", "1.9.14" do |s| build_gem "ffi", "1.9.14" do |s|
s.platform = mingw s.platform = x86_mingw32
end end
build_gem "gssapi", "0.1" build_gem "gssapi", "0.1"
@ -312,7 +312,7 @@ RSpec.describe "bundle lock" do
gem "gssapi" gem "gssapi"
G G
simulate_platform(mingw) { bundle :lock } simulate_platform(x86_mingw32) { bundle :lock }
expect(lockfile).to eq <<~G expect(lockfile).to eq <<~G
GEM GEM

View file

@ -436,7 +436,7 @@ RSpec.describe "bundle install from an existing gemspec" do
simulate_new_machine simulate_new_machine
simulate_platform("jruby") { bundle "install" } simulate_platform("jruby") { bundle "install" }
simulate_platform(x64_mingw) { bundle "install" } simulate_platform(x64_mingw32) { bundle "install" }
end end
context "on ruby" do context "on ruby" do

View file

@ -475,7 +475,7 @@ RSpec.describe "bundle install with platform conditionals" do
gemfile <<-G gemfile <<-G
source "#{file_uri_for(gem_repo1)}" source "#{file_uri_for(gem_repo1)}"
gem "rack", :platform => [:mingw, :mswin, :x64_mingw, :jruby] gem "rack", :platform => [:windows, :mingw, :mswin, :x64_mingw, :jruby]
G G
bundle "install" bundle "install"
@ -501,7 +501,7 @@ end
RSpec.describe "when a gem has no architecture" do RSpec.describe "when a gem has no architecture" do
it "still installs correctly" do it "still installs correctly" do
simulate_platform mswin simulate_platform x86_mswin32
build_repo2 do build_repo2 do
# The rcov gem is platform mswin32, but has no arch # The rcov gem is platform mswin32, but has no arch

View file

@ -1470,6 +1470,59 @@ RSpec.describe "bundle install with gems on multiple sources" do
end end
end end
context "when default source includes old gems with nil required_ruby_version" do
before do
build_repo2 do
build_gem "ruport", "1.7.0.3" do |s|
s.add_dependency "pdf-writer", "1.1.8"
end
end
build_repo gem_repo4 do
build_gem "pdf-writer", "1.1.8"
end
path = "#{gem_repo4}/#{Gem::MARSHAL_SPEC_DIR}/pdf-writer-1.1.8.gemspec.rz"
spec = Marshal.load(Bundler.rubygems.inflate(File.binread(path)))
spec.instance_variable_set(:@required_ruby_version, nil)
File.open(path, "wb") do |f|
f.write Gem.deflate(Marshal.dump(spec))
end
gemfile <<~G
source "https://localgemserver.test"
gem "ruport", "= 1.7.0.3", :source => "https://localgemserver.test/extra"
G
end
it "handles that fine" do
bundle "install", :artifice => "compact_index_extra", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
expect(lockfile).to eq <<~L
GEM
remote: https://localgemserver.test/
specs:
pdf-writer (1.1.8)
GEM
remote: https://localgemserver.test/extra/
specs:
ruport (1.7.0.3)
pdf-writer (= 1.1.8)
PLATFORMS
#{specific_local_platform}
DEPENDENCIES
ruport (= 1.7.0.3)!
BUNDLED WITH
#{Bundler::VERSION}
L
end
end
context "when default source includes old gems with nil required_rubygems_version" do context "when default source includes old gems with nil required_rubygems_version" do
before do before do
build_repo2 do build_repo2 do

View file

@ -227,9 +227,9 @@ RSpec.describe "bundle install with specific platforms" do
it "adds the foreign platform" do it "adds the foreign platform" do
setup_multiplatform_gem setup_multiplatform_gem
install_gemfile(google_protobuf) install_gemfile(google_protobuf)
bundle "lock --add-platform=#{x64_mingw}" bundle "lock --add-platform=#{x64_mingw32}"
expect(the_bundle.locked_gems.platforms).to eq([x64_mingw, pl("x86_64-darwin-15")]) expect(the_bundle.locked_gems.platforms).to eq([x64_mingw32, pl("x86_64-darwin-15")])
expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[ expect(the_bundle.locked_gems.specs.map(&:full_name)).to eq(%w[
google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin google-protobuf-3.0.0.alpha.5.0.5.1-universal-darwin
google-protobuf-3.0.0.alpha.5.0.5.1-x64-mingw32 google-protobuf-3.0.0.alpha.5.0.5.1-x64-mingw32
@ -445,6 +445,77 @@ RSpec.describe "bundle install with specific platforms" do
L L
end end
it "automatically fixes the lockfile if only RUBY platform is locked and some gem has no RUBY variant available" do
build_repo4 do
build_gem("sorbet-static-and-runtime", "0.5.10160") do |s|
s.add_runtime_dependency "sorbet", "= 0.5.10160"
s.add_runtime_dependency "sorbet-runtime", "= 0.5.10160"
end
build_gem("sorbet", "0.5.10160") do |s|
s.add_runtime_dependency "sorbet-static", "= 0.5.10160"
end
build_gem("sorbet-runtime", "0.5.10160")
build_gem("sorbet-static", "0.5.10160") do |s|
s.platform = Gem::Platform.local
end
end
gemfile <<~G
source "#{file_uri_for(gem_repo4)}"
gem "sorbet-static-and-runtime"
G
lockfile <<~L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
sorbet (0.5.10160)
sorbet-static (= 0.5.10160)
sorbet-runtime (0.5.10160)
sorbet-static (0.5.10160-#{Gem::Platform.local})
sorbet-static-and-runtime (0.5.10160)
sorbet (= 0.5.10160)
sorbet-runtime (= 0.5.10160)
PLATFORMS
ruby
DEPENDENCIES
sorbet-static-and-runtime
BUNDLED WITH
#{Bundler::VERSION}
L
bundle "update"
expect(lockfile).to eq <<~L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
sorbet (0.5.10160)
sorbet-static (= 0.5.10160)
sorbet-runtime (0.5.10160)
sorbet-static (0.5.10160-#{Gem::Platform.local})
sorbet-static-and-runtime (0.5.10160)
sorbet (= 0.5.10160)
sorbet-runtime (= 0.5.10160)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
sorbet-static-and-runtime
BUNDLED WITH
#{Bundler::VERSION}
L
end
it "does not remove ruby if gems for other platforms, and not present in the lockfile, exist in the Gemfile" do it "does not remove ruby if gems for other platforms, and not present in the lockfile, exist in the Gemfile" do
build_repo4 do build_repo4 do
build_gem "nokogiri", "1.13.8" build_gem "nokogiri", "1.13.8"

View file

@ -119,7 +119,7 @@ RSpec.describe "gemcutter's dependency API" do
end end
it "falls back when the API errors out" do it "falls back when the API errors out" do
simulate_platform mswin simulate_platform x86_mswin32
build_repo2 do build_repo2 do
# The rcov gem is platform mswin32, but has no arch # The rcov gem is platform mswin32, but has no arch

View file

@ -190,28 +190,33 @@ RSpec.describe "bundle flex_install" do
expect(err).to match(/could not find gem 'rack-obama/i) expect(err).to match(/could not find gem 'rack-obama/i)
end end
it "suggests deleting the Gemfile.lock file when the Gemfile requires different versions than the lock" do it "discards the locked gems when the Gemfile requires different versions than the lock" do
bundle "config set force_ruby_platform true" bundle "config set force_ruby_platform true"
nice_error = <<-E.strip.gsub(/^ {8}/, "") nice_error = <<-E.strip.gsub(/^ {8}/, "")
Bundler could not find compatible versions for gem "rack": Could not find gem 'rack (= 1.2)', which is required by gem 'rack-obama (= 2.0)', in rubygems repository #{file_uri_for(gem_repo2)}/ or installed locally.
In snapshot (Gemfile.lock):
rack (= 0.9.1)
In Gemfile: The source contains the following gems matching 'rack':
rack-obama (= 2.0) was resolved to 2.0, which depends on * rack-0.9.1
rack (= 1.2) * rack-1.0.0
rack_middleware was resolved to 1.0, which depends on
rack (= 0.9.1)
Deleting your Gemfile.lock file and running `bundle install` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
E E
bundle :install, :retry => 0, :raise_on_error => false bundle :install, :retry => 0, :raise_on_error => false
expect(err).to end_with(nice_error) expect(err).to end_with(nice_error)
end end
it "does not include conflicts with a single requirement tree, because that can't possibly be a conflict" do
bundle "config set force_ruby_platform true"
bad_error = <<-E.strip.gsub(/^ {8}/, "")
Bundler could not find compatible versions for gem "rack-obama":
In Gemfile:
rack-obama (= 2.0)
E
bundle "update rack_middleware", :retry => 0, :raise_on_error => false
expect(err).not_to end_with(bad_error)
end
end end
describe "when running bundle update and Gemfile conflicts with lockfile" do describe "when running bundle update and Gemfile conflicts with lockfile" do
@ -230,22 +235,6 @@ RSpec.describe "bundle flex_install" do
gem "jekyll-feed", "~> 0.12" gem "jekyll-feed", "~> 0.12"
G G
lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo4)}/
specs:
jekyll-feed (0.16.0)
PLATFORMS
#{lockfile_platforms}
DEPENDENCIES
jekyll-feed
BUNDLED WITH
#{Bundler::VERSION}
L
gemfile <<-G gemfile <<-G
source "#{file_uri_for(gem_repo4)}" source "#{file_uri_for(gem_repo4)}"
gem "github-pages", "~> 226" gem "github-pages", "~> 226"
@ -253,24 +242,9 @@ RSpec.describe "bundle flex_install" do
G G
end end
it "suggests deleting the Gemfile.lock file when the Gemfile requires different versions than the lock" do it "discards the conflicting lockfile information and resolves properly" do
nice_error = <<-E.strip.gsub(/^ {8}/, "") bundle :update, :raise_on_error => false, :all => true
Bundler could not find compatible versions for gem "jekyll-feed": expect(err).to be_empty
In snapshot (Gemfile.lock):
jekyll-feed (>= 0.16.0)
In Gemfile:
jekyll-feed (~> 0.12)
github-pages (~> 226) was resolved to 226, which depends on
jekyll-feed (= 0.15.1)
Deleting your Gemfile.lock file and running `bundle install` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
E
bundle :update, :raise_on_error => false
expect(err).to end_with(nice_error)
end end
end end
@ -374,7 +348,7 @@ RSpec.describe "bundle flex_install" do
end end
end end
it "prints the correct error message" do it "resolves them" do
# install Rails 3.0.0.rc # install Rails 3.0.0.rc
install_gemfile <<-G install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}" source "#{file_uri_for(gem_repo2)}"
@ -383,13 +357,12 @@ RSpec.describe "bundle flex_install" do
G G
# upgrade Rails to 3.0.0 and then install again # upgrade Rails to 3.0.0 and then install again
install_gemfile <<-G, :raise_on_error => false install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}" source "#{file_uri_for(gem_repo2)}"
gem "rails", "3.0.0" gem "rails", "3.0.0"
gem "capybara", "0.3.9" gem "capybara", "0.3.9"
G G
expect(err).to be_empty
expect(err).to include("Gemfile.lock")
end end
end end
end end

View file

@ -423,13 +423,13 @@ RSpec.describe "bundle install with install-time dependencies" do
s.required_ruby_version = "> 9000" s.required_ruby_version = "> 9000"
end end
build_gem "rack", "1.2" do |s| build_gem "rack", "1.2" do |s|
s.platform = mingw s.platform = x86_mingw32
s.required_ruby_version = "> 9000" s.required_ruby_version = "> 9000"
end end
build_gem "rack", "1.2" build_gem "rack", "1.2"
end end
simulate_platform mingw do simulate_platform x86_mingw32 do
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s } install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }
ruby "#{Gem.ruby_version}" ruby "#{Gem.ruby_version}"
source "http://localgemserver.test/" source "http://localgemserver.test/"

View file

@ -128,11 +128,6 @@ RSpec.shared_examples "bundle install --standalone" do
skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2 skip "does not work on rubygems versions where `--install_dir` doesn't respect --default" unless Gem::Installer.for_spec(loaded_gemspec, :install_dir => "/foo").default_spec_file == "/foo/specifications/default/bundler-#{Bundler::VERSION}.gemspec" # Since rubygems 3.2.0.rc.2
skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0" skip "does not work on old rubies because the realworld gems that need to be installed don't support them" if RUBY_VERSION < "2.7.0"
if Gem.win_platform? && RUBY_VERSION < "3.1.0"
default_fiddle_version = ruby "require 'fiddle'; puts Gem.loaded_specs['fiddle'].version"
realworld_system_gems "fiddle --version #{default_fiddle_version}"
end
realworld_system_gems "tsort --version 0.1.0" realworld_system_gems "tsort --version 0.1.0"
necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.1"] necessary_system_gems = ["optparse --version 0.1.1", "psych --version 3.3.2", "logger --version 1.4.3", "etc --version 1.2.0", "stringio --version 3.0.1"]

View file

@ -151,7 +151,6 @@ RSpec.describe "The library itself" do
git.allow_insecure git.allow_insecure
inline inline
trust-policy trust-policy
use_gem_version_promoter_for_major_updates
] ]
all_settings = Hash.new {|h, k| h[k] = [] } all_settings = Hash.new {|h, k| h[k] = [] }

View file

@ -4,9 +4,9 @@ RSpec.describe "real world edgecases", :realworld => true do
def rubygems_version(name, requirement) def rubygems_version(name, requirement)
ruby <<-RUBY ruby <<-RUBY
require "#{spec_dir}/support/artifice/vcr" require "#{spec_dir}/support/artifice/vcr"
require "#{entrypoint}" require "bundler"
require "#{entrypoint}/source/rubygems/remote" require "bundler/source/rubygems/remote"
require "#{entrypoint}/fetcher" require "bundler/fetcher"
rubygem = Bundler.ui.silence do rubygem = Bundler.ui.silence do
source = Bundler::Source::Rubygems::Remote.new(Bundler::URI("https://rubygems.org")) source = Bundler::Source::Rubygems::Remote.new(Bundler::URI("https://rubygems.org"))
fetcher = Bundler::Fetcher.new(source) fetcher = Bundler::Fetcher.new(source)
@ -64,7 +64,7 @@ RSpec.describe "real world edgecases", :realworld => true do
it "is able to update a top-level dependency when there is a conflict on a shared transitive child" do it "is able to update a top-level dependency when there is a conflict on a shared transitive child" do
# from https://github.com/rubygems/bundler/issues/5031 # from https://github.com/rubygems/bundler/issues/5031
system_gems "bundler-2.99.0" pristine_system_gems "bundler-1.99.0"
gemfile <<-G gemfile <<-G
source "https://rubygems.org" source "https://rubygems.org"
@ -154,7 +154,7 @@ RSpec.describe "real world edgecases", :realworld => true do
activemodel (= 4.2.7.1) activemodel (= 4.2.7.1)
activerecord (= 4.2.7.1) activerecord (= 4.2.7.1)
activesupport (= 4.2.7.1) activesupport (= 4.2.7.1)
bundler (>= 1.3.0, < 3.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.7.1) railties (= 4.2.7.1)
sprockets-rails sprockets-rails
rails-deprecated_sanitizer (1.0.3) rails-deprecated_sanitizer (1.0.3)
@ -191,7 +191,7 @@ RSpec.describe "real world edgecases", :realworld => true do
rails (~> 4.2.7.1) rails (~> 4.2.7.1)
L L
bundle "lock --update paperclip", :env => { "BUNDLER_VERSION" => "2.99.0" } bundle "lock --update paperclip", :env => { "BUNDLER_VERSION" => "1.99.0" }
expect(lockfile).to include(rubygems_version("paperclip", "~> 5.1.0")) expect(lockfile).to include(rubygems_version("paperclip", "~> 5.1.0"))
end end

View file

@ -449,8 +449,6 @@ RSpec.describe "bundler/inline#gemfile" do
realworld_system_gems "pathname --version 0.2.0" realworld_system_gems "pathname --version 0.2.0"
realworld_system_gems "fiddle" # not sure why, but this is needed on Windows to boot rubygems successfully
realworld_system_gems "timeout uri" # this spec uses net/http which requires these default gems realworld_system_gems "timeout uri" # this spec uses net/http which requires these default gems
script <<-RUBY, :dir => tmp("path_without_gemfile"), :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s } script <<-RUBY, :dir => tmp("path_without_gemfile"), :env => { "BUNDLER_GEM_DEFAULT_DIR" => system_gem_path.to_s }

View file

@ -344,6 +344,23 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
expect(the_bundle).to include_gems "platform_specific 1.0 RUBY" expect(the_bundle).to include_gems "platform_specific 1.0 RUBY"
end end
it "pulls platform specific gems correctly on musl" do
build_repo4 do
build_gem "nokogiri", "1.13.8" do |s|
s.platform = "aarch64-linux"
end
end
simulate_platform "aarch64-linux-musl" do
install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo4.to_s }, :verbose => true
source "https://gems.repo4"
gem "nokogiri"
G
end
expect(out).to include("Fetching nokogiri 1.13.8 (aarch64-linux)")
end
it "allows specifying only-ruby-platform on windows with dependency platforms" do it "allows specifying only-ruby-platform on windows with dependency platforms" do
simulate_windows do simulate_windows do
install_gemfile <<-G install_gemfile <<-G
@ -386,7 +403,7 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
s.add_dependency "platform_specific" s.add_dependency "platform_specific"
end end
end end
simulate_windows x64_mingw do simulate_windows x64_mingw32 do
lockfile <<-L lockfile <<-L
GEM GEM
remote: #{file_uri_for(gem_repo2)}/ remote: #{file_uri_for(gem_repo2)}/
@ -412,4 +429,36 @@ RSpec.describe "Bundler.setup with multi platform stuff" do
expect(the_bundle).to include_gem "platform_specific 1.0 x64-mingw32" expect(the_bundle).to include_gem "platform_specific 1.0 x64-mingw32"
end end
end end
%w[x86-mswin32 x64-mswin64 x86-mingw32 x64-mingw32 x64-mingw-ucrt].each do |arch|
it "allows specifying platform windows on #{arch} arch" do
platform = send(arch.tr("-", "_"))
simulate_windows platform do
lockfile <<-L
GEM
remote: #{file_uri_for(gem_repo1)}/
specs:
platform_specific (1.0-#{platform})
requires_platform_specific (1.0)
platform_specific
PLATFORMS
#{platform}
DEPENDENCIES
requires_platform_specific
L
install_gemfile <<-G
source "#{file_uri_for(gem_repo1)}"
gem "platform_specific", :platforms => [:windows]
G
bundle "install"
expect(the_bundle).to include_gems "platform_specific 1.0 #{platform}"
end
end
end
end end

View file

@ -1335,7 +1335,6 @@ end
else else
%w[io-console openssl] %w[io-console openssl]
end << "bundler" end << "bundler"
exempts << "fiddle" if Gem.win_platform? && Gem.rubygems_version >= Gem::Version.new("2.7")
exempts << "uri" if Gem.ruby_version >= Gem::Version.new("2.7") exempts << "uri" if Gem.ruby_version >= Gem::Version.new("2.7")
exempts << "pathname" if Gem.ruby_version >= Gem::Version.new("3.0") exempts << "pathname" if Gem.ruby_version >= Gem::Version.new("3.0")
exempts << "set" unless Gem.rubygems_version >= Gem::Version.new("3.2.6") exempts << "set" unless Gem.rubygems_version >= Gem::Version.new("3.2.6")

View file

@ -110,19 +110,27 @@ module Spec
build_gem "platform_specific" do |s| build_gem "platform_specific" do |s|
s.platform = "x86-mswin32" s.platform = "x86-mswin32"
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0.0 MSWIN'" s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0 x86-mswin32'"
end
build_gem "platform_specific" do |s|
s.platform = "x64-mswin64"
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0 x64-mswin64'"
end end
build_gem "platform_specific" do |s| build_gem "platform_specific" do |s|
s.platform = "x86-mingw32" s.platform = "x86-mingw32"
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0 x86-mingw32'"
end end
build_gem "platform_specific" do |s| build_gem "platform_specific" do |s|
s.platform = "x64-mingw32" s.platform = "x64-mingw32"
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0 x64-mingw32'"
end end
build_gem "platform_specific" do |s| build_gem "platform_specific" do |s|
s.platform = "x64-mingw-ucrt" s.platform = "x64-mingw-ucrt"
s.write "lib/platform_specific.rb", "PLATFORM_SPECIFIC = '1.0 x64-mingw-ucrt'"
end end
build_gem "platform_specific" do |s| build_gem "platform_specific" do |s|

View file

@ -445,7 +445,7 @@ module Spec
ENV["BUNDLER_SPEC_PLATFORM"] = old if block_given? ENV["BUNDLER_SPEC_PLATFORM"] = old if block_given?
end end
def simulate_windows(platform = mswin) def simulate_windows(platform = x86_mswin32)
old = ENV["BUNDLER_SPEC_WINDOWS"] old = ENV["BUNDLER_SPEC_WINDOWS"]
ENV["BUNDLER_SPEC_WINDOWS"] = "true" ENV["BUNDLER_SPEC_WINDOWS"] = "true"
simulate_platform platform do simulate_platform platform do

View file

@ -24,20 +24,32 @@ module Spec
Gem::Platform.new(["x86", "linux", nil]) Gem::Platform.new(["x86", "linux", nil])
end end
def mswin def x86_mswin32
Gem::Platform.new(["x86", "mswin32", nil]) Gem::Platform.new(["x86", "mswin32", nil])
end end
def mingw def x64_mswin64
Gem::Platform.new(["x64", "mswin64", nil])
end
def x86_mingw32
Gem::Platform.new(["x86", "mingw32", nil]) Gem::Platform.new(["x86", "mingw32", nil])
end end
def x64_mingw def x64_mingw32
Gem::Platform.new(["x64", "mingw32", nil]) Gem::Platform.new(["x64", "mingw32", nil])
end end
def x64_mingw_ucrt
Gem::Platform.new(["x64", "mingw", "ucrt"])
end
def windows_platforms
[x86_mswin32, x64_mswin64, x86_mingw32, x64_mingw32, x64_mingw_ucrt]
end
def all_platforms def all_platforms
[rb, java, linux, mswin, mingw, x64_mingw] [rb, java, linux, windows_platforms].flatten
end end
def local def local
@ -56,14 +68,14 @@ module Spec
if RUBY_PLATFORM == "java" if RUBY_PLATFORM == "java"
:jruby :jruby
elsif ["x64-mingw32", "x64-mingw-ucrt"].include?(RUBY_PLATFORM) elsif ["x64-mingw32", "x64-mingw-ucrt"].include?(RUBY_PLATFORM)
:x64_mingw :windows
else else
:ruby :ruby
end end
end end
def not_local_tag def not_local_tag
[:jruby, :x64_mingw, :ruby].find {|tag| tag != local_tag } [:jruby, :windows, :ruby].find {|tag| tag != local_tag }
end end
def local_ruby_engine def local_ruby_engine
@ -76,7 +88,7 @@ module Spec
def not_local_engine_version def not_local_engine_version
case not_local_tag case not_local_tag
when :ruby, :x64_mingw when :ruby, :windows
not_local_ruby_version not_local_ruby_version
when :jruby when :jruby
"1.6.1" "1.6.1"

View file

@ -334,8 +334,6 @@ class Gem::TestCase < Test::Unit::TestCase
# capture output # capture output
Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new Gem::DefaultUserInteraction.ui = Gem::MockGemUi.new
ENV["TMPDIR"] = @tempdir
@orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE @orig_SYSTEM_WIDE_CONFIG_FILE = Gem::ConfigFile::SYSTEM_WIDE_CONFIG_FILE
Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE Gem::ConfigFile.send :remove_const, :SYSTEM_WIDE_CONFIG_FILE
Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE, Gem::ConfigFile.send :const_set, :SYSTEM_WIDE_CONFIG_FILE,

View file

@ -40,4 +40,30 @@ class TestGemCommandsInfoCommand < Gem::TestCase
assert_match %r{#{@gem.summary}\n}, @ui.output assert_match %r{#{@gem.summary}\n}, @ui.output
assert_match "", @ui.error assert_match "", @ui.error
end end
def test_execute_with_version_flag
spec_fetcher do |fetcher|
fetcher.spec "coolgem", "1.0"
fetcher.spec "coolgem", "2.0"
end
@cmd.handle_options %w[coolgem --remote --version 1.0]
use_ui @ui do
@cmd.execute
end
expected = <<-EOF
*** REMOTE GEMS ***
coolgem (1.0)
Author: A User
Homepage: http://example.com
this is a summary
EOF
assert_equal expected, @ui.output
end
end end

View file

@ -138,6 +138,10 @@ class TestGemPlatform < Gem::TestCase
"x86_64-linux-gnu" => ["x86_64", "linux", "gnu"], "x86_64-linux-gnu" => ["x86_64", "linux", "gnu"],
"x86_64-linux-musl" => ["x86_64", "linux", "musl"], "x86_64-linux-musl" => ["x86_64", "linux", "musl"],
"x86_64-linux-uclibc" => ["x86_64", "linux", "uclibc"], "x86_64-linux-uclibc" => ["x86_64", "linux", "uclibc"],
"arm-linux-eabi" => ["arm", "linux", "eabi"],
"arm-linux-gnueabi" => ["arm", "linux", "gnueabi"],
"arm-linux-musleabi" => ["arm", "linux", "musleabi"],
"arm-linux-uclibceabi" => ["arm", "linux", "uclibceabi"],
"x86_64-openbsd3.9" => ["x86_64", "openbsd", "3.9"], "x86_64-openbsd3.9" => ["x86_64", "openbsd", "3.9"],
"x86_64-openbsd4.0" => ["x86_64", "openbsd", "4.0"], "x86_64-openbsd4.0" => ["x86_64", "openbsd", "4.0"],
"x86_64-openbsd" => ["x86_64", "openbsd", nil], "x86_64-openbsd" => ["x86_64", "openbsd", nil],
@ -301,6 +305,34 @@ class TestGemPlatform < Gem::TestCase
refute(x86_linux_uclibc === x86_linux, "linux-uclibc =~ linux") refute(x86_linux_uclibc === x86_linux, "linux-uclibc =~ linux")
end end
def test_eabi_version_is_stricter_for_linux_os
arm_linux_eabi = Gem::Platform.new "arm-linux-eabi"
arm_linux_gnueabi = Gem::Platform.new "arm-linux-gnueabi"
arm_linux_musleabi = Gem::Platform.new "arm-linux-musleabi"
arm_linux_uclibceabi = Gem::Platform.new "arm-linux-uclibceabi"
# a naked linux runtime is implicit gnu, as it represents the common glibc-linked runtime
assert(arm_linux_eabi === arm_linux_gnueabi, "linux-eabi =~ linux-gnueabi")
assert(arm_linux_gnueabi === arm_linux_eabi, "linux-gnueabi =~ linux-eabi")
# musl and explicit gnu should differ
refute(arm_linux_gnueabi === arm_linux_musleabi, "linux-gnueabi =~ linux-musleabi")
refute(arm_linux_musleabi === arm_linux_gnueabi, "linux-musleabi =~ linux-gnueabi")
# explicit libc differ
refute(arm_linux_uclibceabi === arm_linux_musleabi, "linux-uclibceabi =~ linux-musleabi")
refute(arm_linux_musleabi === arm_linux_uclibceabi, "linux-musleabi =~ linux-uclibceabi")
# musl host runtime accepts libc-generic or statically linked gems...
assert(arm_linux_eabi === arm_linux_musleabi, "linux-eabi =~ linux-musleabi")
# ...but implicit gnu runtime generally does not accept musl-specific gems
refute(arm_linux_musleabi === arm_linux_eabi, "linux-musleabi =~ linux-eabi")
# other libc are not glibc compatible
refute(arm_linux_eabi === arm_linux_uclibceabi, "linux-eabi =~ linux-uclibceabi")
refute(arm_linux_uclibceabi === arm_linux_eabi, "linux-uclibceabi =~ linux-eabi")
end
def test_equals3_cpu_arm def test_equals3_cpu_arm
arm = Gem::Platform.new "arm-linux" arm = Gem::Platform.new "arm-linux"
armv5 = Gem::Platform.new "armv5-linux" armv5 = Gem::Platform.new "armv5-linux"

View file

@ -53,4 +53,4 @@ DEPENDENCIES
webrick (~> 1.6) webrick (~> 1.6)
BUNDLED WITH BUNDLED WITH
2.3.21 2.3.22

View file

@ -44,6 +44,7 @@ GEM
unicode-display_width (2.1.0) unicode-display_width (2.1.0)
PLATFORMS PLATFORMS
aarch64-linux
arm64-darwin-20 arm64-darwin-20
arm64-darwin-21 arm64-darwin-21
universal-java-11 universal-java-11
@ -62,4 +63,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.21 2.3.22

View file

@ -50,6 +50,7 @@ GEM
unicode-display_width (2.1.0) unicode-display_width (2.1.0)
PLATFORMS PLATFORMS
aarch64-linux
arm64-darwin-20 arm64-darwin-20
arm64-darwin-21 arm64-darwin-21
universal-java-11 universal-java-11
@ -68,4 +69,4 @@ DEPENDENCIES
test-unit test-unit
BUNDLED WITH BUNDLED WITH
2.3.21 2.3.22

View file

@ -43,4 +43,4 @@ DEPENDENCIES
webrick (= 1.7.0) webrick (= 1.7.0)
BUNDLED WITH BUNDLED WITH
2.3.21 2.3.22