summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2022-05-02 19:42:57 +0900
committernagachika <nagachika@ruby-lang.org>2022-05-18 10:02:42 +0900
commit2e291e3ffdea1cba747119ff58cf253f4c4a87c8 (patch)
treeac8024cb8e7d92295c259ef4cecf1e5ccc09ea94
parent8ba584ff3c085251865c11c5d7deef0ddfc6d0ff (diff)
Merge RubyGems-3.3.12 and Bundler-2.3.12
-rw-r--r--lib/bundler/current_ruby.rb1
-rw-r--r--lib/bundler/definition.rb19
-rw-r--r--lib/bundler/dependency.rb18
-rw-r--r--lib/bundler/resolver.rb87
-rw-r--r--lib/bundler/resolver/spec_group.rb4
-rw-r--r--lib/bundler/ruby_version.rb13
-rw-r--r--lib/bundler/rubygems_ext.rb17
-rw-r--r--lib/bundler/source/metadata.rb2
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb2
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/errors.rb58
-rw-r--r--lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb2
-rw-r--r--lib/bundler/vendor/tsort/lib/tsort.rb637
-rw-r--r--lib/bundler/version.rb2
-rw-r--r--lib/rubygems.rb14
-rw-r--r--lib/rubygems/installer.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse.rb77
-rw-r--r--lib/rubygems/optparse/lib/optparse/ac.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse/date.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse/kwargs.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse/shellwords.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse/time.rb2
-rw-r--r--lib/rubygems/optparse/lib/optparse/uri.rb2
-rw-r--r--lib/rubygems/specification.rb10
-rw-r--r--spec/bundler/bundler/dsl_spec.rb5
-rw-r--r--spec/bundler/bundler/ruby_version_spec.rb26
-rw-r--r--spec/bundler/install/gems/resolving_spec.rb37
-rw-r--r--test/rubygems/helper.rb7
-rw-r--r--test/rubygems/test_gem.rb20
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder.rb4
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock4
-rw-r--r--test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock4
-rw-r--r--test/rubygems/test_gem_installer.rb8
-rw-r--r--tool/bundler/dev_gems.rb.lock2
-rw-r--r--tool/bundler/rubocop_gems.rb.lock2
-rw-r--r--tool/bundler/standard_gems.rb.lock2
-rw-r--r--tool/bundler/test_gems.rb.lock2
36 files changed, 602 insertions, 498 deletions
diff --git a/lib/bundler/current_ruby.rb b/lib/bundler/current_ruby.rb
index f84d68e262..27997982c0 100644
--- a/lib/bundler/current_ruby.rb
+++ b/lib/bundler/current_ruby.rb
@@ -21,6 +21,7 @@ module Bundler
2.6
2.7
3.0
+ 3.1
].freeze
KNOWN_MAJOR_VERSIONS = KNOWN_MINOR_VERSIONS.map {|v| v.split(".", 2).first }.uniq.freeze
diff --git a/lib/bundler/definition.rb b/lib/bundler/definition.rb
index 442f4484fb..21949bc85c 100644
--- a/lib/bundler/definition.rb
+++ b/lib/bundler/definition.rb
@@ -732,30 +732,13 @@ module Bundler
def metadata_dependencies
@metadata_dependencies ||= begin
- ruby_versions = ruby_version_requirements(@ruby_version)
[
- Dependency.new("Ruby\0", ruby_versions),
+ Dependency.new("Ruby\0", RubyVersion.system.gem_version),
Dependency.new("RubyGems\0", Gem::VERSION),
]
end
end
- def ruby_version_requirements(ruby_version)
- return [] unless ruby_version
- if ruby_version.patchlevel
- [ruby_version.to_gem_version_with_patchlevel]
- else
- ruby_version.versions.map do |version|
- requirement = Gem::Requirement.new(version)
- if requirement.exact?
- "~> #{version}.0"
- else
- requirement
- end
- end
- end
- end
-
def expand_dependencies(dependencies, remote = false)
deps = []
dependencies.each do |dep|
diff --git a/lib/bundler/dependency.rb b/lib/bundler/dependency.rb
index 94e85053dd..d12b120bba 100644
--- a/lib/bundler/dependency.rb
+++ b/lib/bundler/dependency.rb
@@ -20,6 +20,9 @@ module Bundler
: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,
@@ -30,6 +33,9 @@ module Bundler
: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,
@@ -45,6 +51,9 @@ module Bundler
: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,
@@ -54,6 +63,9 @@ module Bundler
: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,
@@ -64,6 +76,9 @@ module Bundler
: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,
@@ -72,6 +87,9 @@ module Bundler
: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
def initialize(name, version, options = {}, &blk)
diff --git a/lib/bundler/resolver.rb b/lib/bundler/resolver.rb
index be0751d9d2..433a5e53e1 100644
--- a/lib/bundler/resolver.rb
+++ b/lib/bundler/resolver.rb
@@ -312,29 +312,66 @@ module Bundler
e = Molinillo::VersionConflict.new(conflicts, e.specification_provider) unless conflicts.empty?
- solver_name = "Bundler"
- possibility_type = "gem"
e.message_with_trees(
- :solver_name => solver_name,
- :possibility_type => possibility_type,
- :reduce_trees => lambda do |trees|
+ :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
+
# called first, because we want to reduce the amount of work required to find maximal empty sets
trees = trees.uniq {|t| t.flatten.map {|dep| [dep.name, dep.requirement] } }
# bail out if tree size is too big for Array#combination to make any sense
- return trees if trees.size > 15
- maximal = 1.upto(trees.size).map do |size|
- trees.map(&:last).flatten(1).combination(size).to_a
- end.flatten(1).select do |deps|
- Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
- end.min_by(&:size)
-
- trees.reject! {|t| !maximal.include?(t.last) } if maximal
-
- trees.sort_by {|t| t.reverse.map(&:name) }
- end,
- :printable_requirement => lambda {|req| SharedHelpers.pretty_dependency(req) },
- :additional_message_for_conflict => lambda do |o, name, conflict|
+ if trees.size <= 15
+ maximal = 1.upto(trees.size).map do |size|
+ trees.map(&:last).flatten(1).combination(size).to_a
+ end.flatten(1).select do |deps|
+ Bundler::VersionRanges.empty?(*Bundler::VersionRanges.for_many(deps.map(&:requirement)))
+ end.min_by(&:size)
+
+ trees.reject! {|t| !maximal.include?(t.last) } if maximal
+
+ trees.sort_by! {|t| t.reverse.map(&:name) }
+ end
+
+ metadata_requirements = {}
+
+ 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")
+ metadata_requirements[base_tree_name] = base_tree
+ 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")
+
if name == "bundler"
o << %(\n Current Bundler version:\n bundler (#{Bundler::VERSION}))
@@ -355,11 +392,13 @@ module Bundler
o << "Your bundle requires a different version of Bundler than the one you're running, and that version could not be found.\n"
end
end
+ elsif name.end_with?("\0")
+ o << %(\n Current #{name} version:\n #{SharedHelpers.pretty_dependency(metadata_requirements[name])}\n\n)
elsif conflict.locked_requirement
o << "\n"
o << %(Running `bundle update` will rebuild your snapshot from scratch, using only\n)
o << %(the gems in your Gemfile, which may resolve the conflict.\n)
- elsif !conflict.existing && !name.end_with?("\0")
+ elsif !conflict.existing
o << "\n"
relevant_source = conflict.requirement.source || source_for(name)
@@ -372,14 +411,8 @@ module Bundler
o << gem_not_found_message(name, conflict.requirement, relevant_source, extra_message)
end
- end,
- :version_for_spec => lambda {|spec| spec.version },
- :incompatible_version_message_for_conflict => lambda do |name, _conflict|
- if name.end_with?("\0")
- %(#{solver_name} found conflicting requirements for the #{name} version:)
- else
- %(#{solver_name} could not find compatible versions for #{possibility_type} "#{name}":)
- end
+
+ o
end
)
end
diff --git a/lib/bundler/resolver/spec_group.rb b/lib/bundler/resolver/spec_group.rb
index 232520de77..18ab5a52a3 100644
--- a/lib/bundler/resolver/spec_group.rb
+++ b/lib/bundler/resolver/spec_group.rb
@@ -97,10 +97,10 @@ module Bundler
spec = @specs[platform].first
return [] if spec.is_a?(LazySpecification)
dependencies = []
- if !spec.required_ruby_version.nil? && !spec.required_ruby_version.none?
+ unless spec.required_ruby_version.none?
dependencies << DepProxy.get_proxy(Gem::Dependency.new("Ruby\0", spec.required_ruby_version), platform)
end
- if !spec.required_rubygems_version.nil? && !spec.required_rubygems_version.none?
+ unless spec.required_rubygems_version.none?
dependencies << DepProxy.get_proxy(Gem::Dependency.new("RubyGems\0", spec.required_rubygems_version), platform)
end
dependencies
diff --git a/lib/bundler/ruby_version.rb b/lib/bundler/ruby_version.rb
index d3b7963920..3f51cf4528 100644
--- a/lib/bundler/ruby_version.rb
+++ b/lib/bundler/ruby_version.rb
@@ -110,19 +110,6 @@ module Bundler
@ruby_version ||= RubyVersion.new(ruby_version, patchlevel, ruby_engine, ruby_engine_version)
end
- def to_gem_version_with_patchlevel
- @gem_version_with_patch ||= begin
- Gem::Version.create("#{@gem_version}.#{@patchlevel}")
- rescue ArgumentError
- @gem_version
- end
- end
-
- def exact?
- return @exact if defined?(@exact)
- @exact = versions.all? {|v| Gem::Requirement.create(v).exact? }
- end
-
private
def matches?(requirements, version)
diff --git a/lib/bundler/rubygems_ext.rb b/lib/bundler/rubygems_ext.rb
index 78422ceb76..b0e35e005e 100644
--- a/lib/bundler/rubygems_ext.rb
+++ b/lib/bundler/rubygems_ext.rb
@@ -67,6 +67,23 @@ module Gem
full_gem_path
end
+ unless const_defined?(:LATEST_RUBY_WITHOUT_PATCH_VERSIONS)
+ LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
+
+ alias_method :rg_required_ruby_version=, :required_ruby_version=
+ def required_ruby_version=(req)
+ self.rg_required_ruby_version = req
+
+ @required_ruby_version.requirements.map! do |op, v|
+ if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
+ [op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
+ else
+ [op, v]
+ end
+ end
+ end
+ end
+
def groups
@groups ||= []
end
diff --git a/lib/bundler/source/metadata.rb b/lib/bundler/source/metadata.rb
index 524afd750a..185fe70824 100644
--- a/lib/bundler/source/metadata.rb
+++ b/lib/bundler/source/metadata.rb
@@ -5,7 +5,7 @@ module Bundler
class Metadata < Source
def specs
@specs ||= Index.build do |idx|
- idx << Gem::Specification.new("Ruby\0", RubyVersion.system.to_gem_version_with_patchlevel)
+ idx << Gem::Specification.new("Ruby\0", RubyVersion.system.gem_version)
idx << Gem::Specification.new("RubyGems\0", Gem::VERSION) do |s|
s.required_rubygems_version = Gem::Requirement.default
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb
index 10a25d2f08..4d577213b9 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/dependency_graph.rb
@@ -32,7 +32,7 @@ module Bundler::Molinillo
# all belong to the same graph.
# @return [Array<Vertex>] The sorted vertices.
def self.tsort(vertices)
- TSort.tsort(
+ Bundler::TSort.tsort(
lambda { |b| vertices.each(&b) },
lambda { |v, &b| (v.successors & vertices).each(&b) }
)
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb b/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb
index e210202b69..8c8cafb447 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/errors.rb
@@ -107,36 +107,42 @@ module Bundler::Molinillo
end
end
- conflicts.sort.reduce(''.dup) do |o, (name, conflict)|
- o << "\n" << incompatible_version_message_for_conflict.call(name, conflict) << "\n"
- if conflict.locked_requirement
- o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
- o << %( #{printable_requirement.call(conflict.locked_requirement)}\n)
- o << %(\n)
- end
- o << %( In #{name_for_explicit_dependency_source}:\n)
- trees = reduce_trees.call(conflict.requirement_trees)
-
- o << trees.map do |tree|
- t = ''.dup
- depth = 2
- tree.each do |req|
- t << ' ' * depth << printable_requirement.call(req)
- unless tree.last == req
- if spec = conflict.activated_by_name[name_for(req)]
- t << %( was resolved to #{version_for_spec.call(spec)}, which)
+ full_message_for_conflict = opts.delete(:full_message_for_conflict) do
+ proc do |name, conflict|
+ o = "\n".dup << incompatible_version_message_for_conflict.call(name, conflict) << "\n"
+ if conflict.locked_requirement
+ o << %( In snapshot (#{name_for_locking_dependency_source}):\n)
+ o << %( #{printable_requirement.call(conflict.locked_requirement)}\n)
+ o << %(\n)
+ end
+ o << %( In #{name_for_explicit_dependency_source}:\n)
+ trees = reduce_trees.call(conflict.requirement_trees)
+
+ o << trees.map do |tree|
+ t = ''.dup
+ depth = 2
+ tree.each do |req|
+ t << ' ' * depth << printable_requirement.call(req)
+ unless tree.last == req
+ if spec = conflict.activated_by_name[name_for(req)]
+ t << %( was resolved to #{version_for_spec.call(spec)}, which)
+ end
+ t << %( depends on)
end
- t << %( depends on)
+ t << %(\n)
+ depth += 1
end
- t << %(\n)
- depth += 1
- end
- t
- end.join("\n")
+ t
+ end.join("\n")
- additional_message_for_conflict.call(o, name, conflict)
+ additional_message_for_conflict.call(o, name, conflict)
- o
+ o
+ end
+ end
+
+ conflicts.sort.reduce(''.dup) do |o, (name, conflict)|
+ o << full_message_for_conflict.call(name, conflict)
end.strip
end
end
diff --git a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb
index e13a781a50..a0cfc21672 100644
--- a/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb
+++ b/lib/bundler/vendor/molinillo/lib/molinillo/gem_metadata.rb
@@ -2,5 +2,5 @@
module Bundler::Molinillo
# The version of Bundler::Molinillo.
- VERSION = '0.7.0'.freeze
+ VERSION = '0.8.0'.freeze
end
diff --git a/lib/bundler/vendor/tsort/lib/tsort.rb b/lib/bundler/vendor/tsort/lib/tsort.rb
index 8454583295..4a0e1a4e25 100644
--- a/lib/bundler/vendor/tsort/lib/tsort.rb
+++ b/lib/bundler/vendor/tsort/lib/tsort.rb
@@ -6,24 +6,24 @@
#
#
-# TSort implements topological sorting using Tarjan's algorithm for
+# Bundler::TSort implements topological sorting using Tarjan's algorithm for
# strongly connected components.
#
-# TSort is designed to be able to be used with any object which can be
+# Bundler::TSort is designed to be able to be used with any object which can be
# interpreted as a directed graph.
#
-# TSort requires two methods to interpret an object as a graph,
+# Bundler::TSort requires two methods to interpret an object as a graph,
# tsort_each_node and tsort_each_child.
#
# * tsort_each_node is used to iterate for all nodes over a graph.
# * tsort_each_child is used to iterate for child nodes of a given node.
#
# The equality of nodes are defined by eql? and hash since
-# TSort uses Hash internally.
+# Bundler::TSort uses Hash internally.
#
# == A Simple Example
#
-# The following example demonstrates how to mix the TSort module into an
+# The following example demonstrates how to mix the Bundler::TSort module into an
# existing class (in this case, Hash). Here, we're treating each key in
# the hash as a node in the graph, and so we simply alias the required
# #tsort_each_node method to Hash's #each_key method. For each key in the
@@ -32,10 +32,10 @@
# method, which fetches the array of child nodes and then iterates over that
# array using the user-supplied block.
#
-# require 'tsort'
+# require 'bundler/vendor/tsort/lib/tsort'
#
# class Hash
-# include TSort
+# include Bundler::TSort
# alias tsort_each_node each_key
# def tsort_each_child(node, &block)
# fetch(node).each(&block)
@@ -52,7 +52,7 @@
#
# A very simple `make' like tool can be implemented as follows:
#
-# require 'tsort'
+# require 'bundler/vendor/tsort/lib/tsort'
#
# class Make
# def initialize
@@ -70,7 +70,7 @@
# each_strongly_connected_component_from(target) {|ns|
# if ns.length != 1
# fs = ns.delete_if {|n| Array === n}
-# raise TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
+# raise Bundler::TSort::Cyclic.new("cyclic dependencies: #{fs.join ', '}")
# end
# n = ns.first
# if Array === n
@@ -93,7 +93,7 @@
# def tsort_each_child(node, &block)
# @dep[node].each(&block)
# end
-# include TSort
+# include Bundler::TSort
# end
#
# def command(arg)
@@ -120,334 +120,333 @@
# R. E. Tarjan, "Depth First Search and Linear Graph Algorithms",
# <em>SIAM Journal on Computing</em>, Vol. 1, No. 2, pp. 146-160, June 1972.
#
-module Bundler
- module TSort
- class Cyclic < StandardError
- end
- # Returns a topologically sorted array of nodes.
- # The array is sorted from children to parents, i.e.
- # the first element has no child and the last node has no parent.
- #
- # If there is a cycle, TSort::Cyclic is raised.
- #
- # class G
- # include TSort
- # def initialize(g)
- # @g = g
- # end
- # def tsort_each_child(n, &b) @g[n].each(&b) end
- # def tsort_each_node(&b) @g.each_key(&b) end
- # end
- #
- # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
- # p graph.tsort #=> [4, 2, 3, 1]
- #
- # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
- # p graph.tsort # raises TSort::Cyclic
- #
- def tsort
- each_node = method(:tsort_each_node)
- each_child = method(:tsort_each_child)
- TSort.tsort(each_node, each_child)
- end
+module Bundler::TSort
+ class Cyclic < StandardError
+ end
- # Returns a topologically sorted array of nodes.
- # The array is sorted from children to parents, i.e.
- # the first element has no child and the last node has no parent.
- #
- # The graph is represented by _each_node_ and _each_child_.
- # _each_node_ should have +call+ method which yields for each node in the graph.
- # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
- #
- # If there is a cycle, TSort::Cyclic is raised.
- #
- # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
- # each_node = lambda {|&b| g.each_key(&b) }
- # each_child = lambda {|n, &b| g[n].each(&b) }
- # p TSort.tsort(each_node, each_child) #=> [4, 2, 3, 1]
- #
- # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
- # each_node = lambda {|&b| g.each_key(&b) }
- # each_child = lambda {|n, &b| g[n].each(&b) }
- # p TSort.tsort(each_node, each_child) # raises TSort::Cyclic
- #
- def TSort.tsort(each_node, each_child)
- TSort.tsort_each(each_node, each_child).to_a
- end
+ # Returns a topologically sorted array of nodes.
+ # The array is sorted from children to parents, i.e.
+ # the first element has no child and the last node has no parent.
+ #
+ # If there is a cycle, Bundler::TSort::Cyclic is raised.
+ #
+ # class G
+ # include Bundler::TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # p graph.tsort #=> [4, 2, 3, 1]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # p graph.tsort # raises Bundler::TSort::Cyclic
+ #
+ def tsort
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ Bundler::TSort.tsort(each_node, each_child)
+ end
- # The iterator version of the #tsort method.
- # <tt><em>obj</em>.tsort_each</tt> is similar to <tt><em>obj</em>.tsort.each</tt>, but
- # modification of _obj_ during the iteration may lead to unexpected results.
- #
- # #tsort_each returns +nil+.
- # If there is a cycle, TSort::Cyclic is raised.
- #
- # class G
- # include TSort
- # def initialize(g)
- # @g = g
- # end
- # def tsort_each_child(n, &b) @g[n].each(&b) end
- # def tsort_each_node(&b) @g.each_key(&b) end
- # end
- #
- # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
- # graph.tsort_each {|n| p n }
- # #=> 4
- # # 2
- # # 3
- # # 1
- #
- def tsort_each(&block) # :yields: node
- each_node = method(:tsort_each_node)
- each_child = method(:tsort_each_child)
- TSort.tsort_each(each_node, each_child, &block)
- end
+ # Returns a topologically sorted array of nodes.
+ # The array is sorted from children to parents, i.e.
+ # the first element has no child and the last node has no parent.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # If there is a cycle, Bundler::TSort::Cyclic is raised.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p Bundler::TSort.tsort(each_node, each_child) #=> [4, 2, 3, 1]
+ #
+ # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p Bundler::TSort.tsort(each_node, each_child) # raises Bundler::TSort::Cyclic
+ #
+ def self.tsort(each_node, each_child)
+ tsort_each(each_node, each_child).to_a
+ end
- # The iterator version of the TSort.tsort method.
- #
- # The graph is represented by _each_node_ and _each_child_.
- # _each_node_ should have +call+ method which yields for each node in the graph.
- # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
- #
- # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
- # each_node = lambda {|&b| g.each_key(&b) }
- # each_child = lambda {|n, &b| g[n].each(&b) }
- # TSort.tsort_each(each_node, each_child) {|n| p n }
- # #=> 4
- # # 2
- # # 3
- # # 1
- #
- def TSort.tsort_each(each_node, each_child) # :yields: node
- return to_enum(__method__, each_node, each_child) unless block_given?
+ # The iterator version of the #tsort method.
+ # <tt><em>obj</em>.tsort_each</tt> is similar to <tt><em>obj</em>.tsort.each</tt>, but
+ # modification of _obj_ during the iteration may lead to unexpected results.
+ #
+ # #tsort_each returns +nil+.
+ # If there is a cycle, Bundler::TSort::Cyclic is raised.
+ #
+ # class G
+ # include Bundler::TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # graph.tsort_each {|n| p n }
+ # #=> 4
+ # # 2
+ # # 3
+ # # 1
+ #
+ def tsort_each(&block) # :yields: node
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ Bundler::TSort.tsort_each(each_node, each_child, &block)
+ end
- TSort.each_strongly_connected_component(each_node, each_child) {|component|
- if component.size == 1
- yield component.first
- else
- raise Cyclic.new("topological sort failed: #{component.inspect}")
- end
- }
- end
+ # The iterator version of the Bundler::TSort.tsort method.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # Bundler::TSort.tsort_each(each_node, each_child) {|n| p n }
+ # #=> 4
+ # # 2
+ # # 3
+ # # 1
+ #
+ def self.tsort_each(each_node, each_child) # :yields: node
+ return to_enum(__method__, each_node, each_child) unless block_given?
- # Returns strongly connected components as an array of arrays of nodes.
- # The array is sorted from children to parents.
- # Each elements of the array represents a strongly connected component.
- #
- # class G
- # include TSort
- # def initialize(g)
- # @g = g
- # end
- # def tsort_each_child(n, &b) @g[n].each(&b) end
- # def tsort_each_node(&b) @g.each_key(&b) end
- # end
- #
- # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
- # p graph.strongly_connected_components #=> [[4], [2], [3], [1]]
- #
- # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
- # p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
- #
- def strongly_connected_components
- each_node = method(:tsort_each_node)
- each_child = method(:tsort_each_child)
- TSort.strongly_connected_components(each_node, each_child)
- end
+ each_strongly_connected_component(each_node, each_child) {|component|
+ if component.size == 1
+ yield component.first
+ else
+ raise Cyclic.new("topological sort failed: #{component.inspect}")
+ end
+ }
+ end
- # Returns strongly connected components as an array of arrays of nodes.
- # The array is sorted from children to parents.
- # Each elements of the array represents a strongly connected component.
- #
- # The graph is represented by _each_node_ and _each_child_.
- # _each_node_ should have +call+ method which yields for each node in the graph.
- # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
- #
- # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
- # each_node = lambda {|&b| g.each_key(&b) }
- # each_child = lambda {|n, &b| g[n].each(&b) }
- # p TSort.strongly_connected_components(each_node, each_child)
- # #=> [[4], [2], [3], [1]]
- #
- # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
- # each_node = lambda {|&b| g.each_key(&b) }
- # each_child = lambda {|n, &b| g[n].each(&b) }
- # p TSort.strongly_connected_components(each_node, each_child)
- # #=> [[4], [2, 3], [1]]
- #
- def TSort.strongly_connected_components(each_node, each_child)
- TSort.each_strongly_connected_component(each_node, each_child).to_a
- end
+ # Returns strongly connected components as an array of arrays of nodes.
+ # The array is sorted from children to parents.
+ # Each elements of the array represents a strongly connected component.
+ #
+ # class G
+ # include Bundler::TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # p graph.strongly_connected_components #=> [[4], [2], [3], [1]]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # p graph.strongly_connected_components #=> [[4], [2, 3], [1]]
+ #
+ def strongly_connected_components
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ Bundler::TSort.strongly_connected_components(each_node, each_child)
+ end
- # The iterator version of the #strongly_connected_components method.
- # <tt><em>obj</em>.each_strongly_connected_component</tt> is similar to
- # <tt><em>obj</em>.strongly_connected_components.each</tt>, but
- # modification of _obj_ during the iteration may lead to unexpected results.
- #
- # #each_strongly_connected_component returns +nil+.
- #
- # class G
- # include TSort
- # def initialize(g)
- # @g = g
- # end
- # def tsort_each_child(n, &b) @g[n].each(&b) end
- # def tsort_each_node(&b) @g.each_key(&b) end
- # end
- #
- # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
- # graph.each_strongly_connected_component {|scc| p scc }
- # #=> [4]
- # # [2]
- # # [3]
- # # [1]
- #
- # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
- # graph.each_strongly_connected_component {|scc| p scc }
- # #=> [4]
- # # [2, 3]
- # # [1]
- #
- def each_strongly_connected_component(&block) # :yields: nodes
- each_node = method(:tsort_each_node)
- each_child = method(:tsort_each_child)
- TSort.each_strongly_connected_component(each_node, each_child, &block)
- end
+ # Returns strongly connected components as an array of arrays of nodes.
+ # The array is sorted from children to parents.
+ # Each elements of the array represents a strongly connected component.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p Bundler::TSort.strongly_connected_components(each_node, each_child)
+ # #=> [[4], [2], [3], [1]]
+ #
+ # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # p Bundler::TSort.strongly_connected_components(each_node, each_child)
+ # #=> [[4], [2, 3], [1]]
+ #
+ def self.strongly_connected_components(each_node, each_child)
+ each_strongly_connected_component(each_node, each_child).to_a
+ end
- # The iterator version of the TSort.strongly_connected_components method.
- #
- # The graph is represented by _each_node_ and _each_child_.
- # _each_node_ should have +call+ method which yields for each node in the graph.
- # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
- #
- # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
- # each_node = lambda {|&b| g.each_key(&b) }
- # each_child = lambda {|n, &b| g[n].each(&b) }
- # TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
- # #=> [4]
- # # [2]
- # # [3]
- # # [1]
- #
- # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
- # each_node = lambda {|&b| g.each_key(&b) }
- # each_child = lambda {|n, &b| g[n].each(&b) }
- # TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
- # #=> [4]
- # # [2, 3]
- # # [1]
- #
- def TSort.each_strongly_connected_component(each_node, each_child) # :yields: nodes
- return to_enum(__method__, each_node, each_child) unless block_given?
+ # The iterator version of the #strongly_connected_components method.
+ # <tt><em>obj</em>.each_strongly_connected_component</tt> is similar to
+ # <tt><em>obj</em>.strongly_connected_components.each</tt>, but
+ # modification of _obj_ during the iteration may lead to unexpected results.
+ #
+ # #each_strongly_connected_component returns +nil+.
+ #
+ # class G
+ # include Bundler::TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # graph.each_strongly_connected_component {|scc| p scc }
+ # #=> [4]
+ # # [2]
+ # # [3]
+ # # [1]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # graph.each_strongly_connected_component {|scc| p scc }
+ # #=> [4]
+ # # [2, 3]
+ # # [1]
+ #
+ def each_strongly_connected_component(&block) # :yields: nodes
+ each_node = method(:tsort_each_node)
+ each_child = method(:tsort_each_child)
+ Bundler::TSort.each_strongly_connected_component(each_node, each_child, &block)
+ end
- id_map = {}
- stack = []
- each_node.call {|node|
- unless id_map.include? node
- TSort.each_strongly_connected_component_from(node, each_child, id_map, stack) {|c|
- yield c
- }
- end
- }
- nil
- end
+ # The iterator version of the Bundler::TSort.strongly_connected_components method.
+ #
+ # The graph is represented by _each_node_ and _each_child_.
+ # _each_node_ should have +call+ method which yields for each node in the graph.
+ # _each_child_ should have +call+ method which takes a node argument and yields for each child node.
+ #
+ # g = {1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # Bundler::TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
+ # #=> [4]
+ # # [2]
+ # # [3]
+ # # [1]
+ #
+ # g = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_node = lambda {|&b| g.each_key(&b) }
+ # each_child = lambda {|n, &b| g[n].each(&b) }
+ # Bundler::TSort.each_strongly_connected_component(each_node, each_child) {|scc| p scc }
+ # #=> [4]
+ # # [2, 3]
+ # # [1]
+ #
+ def self.each_strongly_connected_component(each_node, each_child) # :yields: nodes
+ return to_enum(__method__, each_node, each_child) unless block_given?
- # Iterates over strongly connected component in the subgraph reachable from
- # _node_.
- #
- # Return value is unspecified.
- #
- # #each_strongly_connected_component_from doesn't call #tsort_each_node.
- #
- # class G
- # include TSort
- # def initialize(g)
- # @g = g
- # end
- # def tsort_each_child(n, &b) @g[n].each(&b) end
- # def tsort_each_node(&b) @g.each_key(&b) end
- # end
- #
- # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
- # graph.each_strongly_connected_component_from(2) {|scc| p scc }
- # #=> [4]
- # # [2]
- #
- # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
- # graph.each_strongly_connected_component_from(2) {|scc| p scc }
- # #=> [4]
- # # [2, 3]
- #
- def each_strongly_connected_component_from(node, id_map={}, stack=[], &block) # :yields: nodes
- TSort.each_strongly_connected_component_from(node, method(:tsort_each_child), id_map, stack, &block)
- end
+ id_map = {}
+ stack = []
+ each_node.call {|node|
+ unless id_map.include? node
+ each_strongly_connected_component_from(node, each_child, id_map, stack) {|c|
+ yield c
+ }
+ end
+ }
+ nil
+ end
- # Iterates over strongly connected components in a graph.
- # The graph is represented by _node_ and _each_child_.
- #
- # _node_ is the first node.
- # _each_child_ should have +call+ method which takes a node argument
- # and yields for each child node.
- #
- # Return value is unspecified.
- #
- # #TSort.each_strongly_connected_component_from is a class method and
- # it doesn't need a class to represent a graph which includes TSort.
- #
- # graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
- # each_child = lambda {|n, &b| graph[n].each(&b) }
- # TSort.each_strongly_connected_component_from(1, each_child) {|scc|
- # p scc
- # }
- # #=> [4]
- # # [2, 3]
- # # [1]
- #
- def TSort.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
- return to_enum(__method__, node, each_child, id_map, stack) unless block_given?
+ # Iterates over strongly connected component in the subgraph reachable from
+ # _node_.
+ #
+ # Return value is unspecified.
+ #
+ # #each_strongly_connected_component_from doesn't call #tsort_each_node.
+ #
+ # class G
+ # include Bundler::TSort
+ # def initialize(g)
+ # @g = g
+ # end
+ # def tsort_each_child(n, &b) @g[n].each(&b) end
+ # def tsort_each_node(&b) @g.each_key(&b) end
+ # end
+ #
+ # graph = G.new({1=>[2, 3], 2=>[4], 3=>[2, 4], 4=>[]})
+ # graph.each_strongly_connected_component_from(2) {|scc| p scc }
+ # #=> [4]
+ # # [2]
+ #
+ # graph = G.new({1=>[2], 2=>[3, 4], 3=>[2], 4=>[]})
+ # graph.each_strongly_connected_component_from(2) {|scc| p scc }
+ # #=> [4]
+ # # [2, 3]
+ #
+ def each_strongly_connected_component_from(node, id_map={}, stack=[], &block) # :yields: nodes
+ Bundler::TSort.each_strongly_connected_component_from(node, method(:tsort_each_child), id_map, stack, &block)
+ end
- minimum_id = node_id = id_map[node] = id_map.size
- stack_length = stack.length
- stack << node
+ # Iterates over strongly connected components in a graph.
+ # The graph is represented by _node_ and _each_child_.
+ #
+ # _node_ is the first node.
+ # _each_child_ should have +call+ method which takes a node argument
+ # and yields for each child node.
+ #
+ # Return value is unspecified.
+ #
+ # #Bundler::TSort.each_strongly_connected_component_from is a class method and
+ # it doesn't need a class to represent a graph which includes Bundler::TSort.
+ #
+ # graph = {1=>[2], 2=>[3, 4], 3=>[2], 4=>[]}
+ # each_child = lambda {|n, &b| graph[n].each(&b) }
+ # Bundler::TSort.each_strongly_connected_component_from(1, each_child) {|scc|
+ # p scc
+ # }
+ # #=> [4]
+ # # [2, 3]
+ # # [1]
+ #
+ def self.each_strongly_connected_component_from(node, each_child, id_map={}, stack=[]) # :yields: nodes
+ return to_enum(__method__, node, each_child, id_map, stack) unless block_given?
- each_child.call(node) {|child|
- if id_map.include? child
- child_id = id_map[child]
- minimum_id = child_id if child_id && child_id < minimum_id
- else
- sub_minimum_id =
- TSort.each_strongly_connected_component_from(child, each_child, id_map, stack) {|c|
- yield c
- }
- minimum_id = sub_minimum_id if sub_minimum_id < minimum_id
- end
- }
+ minimum_id = node_id = id_map[node] = id_map.size
+ stack_length = stack.length
+ stack << node
- if node_id == minimum_id
- component = stack.slice!(stack_length .. -1)
- component.each {|n| id_map[n] = nil}
- yield component
+ each_child.call(node) {|child|
+ if id_map.include? child
+ child_id = id_map[child]
+ minimum_id = child_id if child_id && child_id < minimum_id
+ else
+ sub_minimum_id =
+ each_strongly_connected_component_from(child, each_child, id_map, stack) {|c|
+ yield c
+ }
+ minimum_id = sub_minimum_id if sub_minimum_id < minimum_id
end
+ }
- minimum_id
+ if node_id == minimum_id
+ component = stack.slice!(stack_length .. -1)
+ component.each {|n| id_map[n] = nil}
+ yield component
end
- # Should be implemented by a extended class.
- #
- # #tsort_each_node is used to iterate for all nodes over a graph.
- #
- def tsort_each_node # :yields: node
- raise NotImplementedError.new
- end
+ minimum_id
+ end
- # Should be implemented by a extended class.
- #
- # #tsort_each_child is used to iterate for child nodes of _node_.
- #
- def tsort_each_child(node) # :yields: child
- raise NotImplementedError.new
- end
+ # Should be implemented by a extended class.
+ #
+ # #tsort_each_node is used to iterate for all nodes over a graph.
+ #
+ def tsort_each_node # :yields: node
+ raise NotImplementedError.new
+ end
+
+ # Should be implemented by a extended class.
+ #
+ # #tsort_each_child is used to iterate for child nodes of _node_.
+ #
+ def tsort_each_child(node) # :yields: child
+ raise NotImplementedError.new
end
end
diff --git a/lib/bundler/version.rb b/lib/bundler/version.rb
index f8d69d73e6..8c645c7a49 100644
--- a/lib/bundler/version.rb
+++ b/lib/bundler/version.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
module Bundler
- VERSION = "2.3.11".freeze
+ VERSION = "2.3.12".freeze
def self.bundler_major_version
@bundler_major_version ||= VERSION.split(".").first.to_i
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index a99281fef5..419b6e54b7 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
- VERSION = "3.3.11".freeze
+ VERSION = "3.3.12".freeze
end
# Must be first since it unloads the prelude from 1.9.2
@@ -48,7 +48,7 @@ require_relative 'rubygems/errors'
# special location and loaded on boot.
#
# For an example plugin, see the {Graph gem}[https://github.com/seattlerb/graph]
-# which adds a `gem graph` command.
+# which adds a <tt>gem graph</tt> command.
#
# == RubyGems Defaults, Packaging
#
@@ -581,8 +581,8 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
end
##
- # The number of paths in the `$LOAD_PATH` from activated gems. Used to
- # prioritize `-I` and `ENV['RUBYLIB`]` entries during `require`.
+ # The number of paths in the +$LOAD_PATH+ from activated gems. Used to
+ # prioritize +-I+ and +ENV['RUBYLIB']+ entries during +require+.
def self.activated_gem_paths
@activated_gem_paths ||= 0
@@ -864,9 +864,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
return @ruby_version if defined? @ruby_version
version = RUBY_VERSION.dup
- if defined?(RUBY_PATCHLEVEL) && RUBY_PATCHLEVEL != -1
- version << ".#{RUBY_PATCHLEVEL}"
- elsif defined?(RUBY_DESCRIPTION)
+ if defined?(RUBY_DESCRIPTION)
if RUBY_ENGINE == "ruby"
desc = RUBY_DESCRIPTION[/\Aruby #{Regexp.quote(RUBY_VERSION)}([^ ]+) /, 1]
else
@@ -1120,7 +1118,7 @@ An Array (#{env.inspect}) was passed in from #{caller[3]}
##
# If the SOURCE_DATE_EPOCH environment variable is set, returns it's value.
- # Otherwise, returns the time that `Gem.source_date_epoch_string` was
+ # Otherwise, returns the time that +Gem.source_date_epoch_string+ was
# first called in the same format as SOURCE_DATE_EPOCH.
#
# NOTE(@duckinator): The implementation is a tad weird because we want to:
diff --git a/lib/rubygems/installer.rb b/lib/rubygems/installer.rb
index 4cda09f200..5c1674f2e8 100644
--- a/lib/rubygems/installer.rb
+++ b/lib/rubygems/installer.rb
@@ -285,8 +285,6 @@ class Gem::Installer
def spec
@package.spec
- rescue Gem::Package::Error => e
- raise Gem::InstallError, "invalid gem: #{e.message}"
end
##
diff --git a/lib/rubygems/optparse/lib/optparse.rb b/lib/rubygems/optparse/lib/optparse.rb
index e4b1c61f79..98865612ba 100644
--- a/lib/rubygems/optparse/lib/optparse.rb
+++ b/lib/rubygems/optparse/lib/optparse.rb
@@ -50,7 +50,7 @@
#
# === New to \Gem::OptionParser?
#
-# See the {Tutorial}[./doc/optparse/tutorial_rdoc.html].
+# See the {Tutorial}[optparse/tutorial.rdoc].
#
# === Introduction
#
@@ -420,7 +420,7 @@
# === Further documentation
#
# The above examples, along with the accompanying
-# {Tutorial}[./doc/optparse/tutorial_rdoc.html],
+# {Tutorial}[optparse/tutorial.rdoc],
# should be enough to learn how to use this class.
# If you have any questions, file a ticket at http://bugs.ruby-lang.org.
#
@@ -674,6 +674,29 @@ class Gem::OptionParser
end
end
+ def pretty_print_contents(q) # :nodoc:
+ if @block
+ q.text ":" + @block.source_location.join(":") + ":"
+ first = false
+ else
+ first = true
+ end
+ [@short, @long].each do |list|
+ list.each do |opt|
+ if first
+ q.text ":"
+ first = false
+ end
+ q.breakable
+ q.text opt
+ end
+ end
+ end
+
+ def pretty_print(q) # :nodoc:
+ q.object_group(self) {pretty_print_contents(q)}
+ end
+
#
# Switch that takes no arguments.
#
@@ -693,6 +716,10 @@ class Gem::OptionParser
def self.pattern
Object
end
+
+ def pretty_head # :nodoc:
+ "NoArgument"
+ end
end
#
@@ -710,6 +737,10 @@ class Gem::OptionParser
end
conv_arg(*parse_arg(arg, &method(:raise)))
end
+
+ def pretty_head # :nodoc:
+ "Required"
+ end
end
#
@@ -727,6 +758,10 @@ class Gem::OptionParser
conv_arg(arg)
end
end
+
+ def pretty_head # :nodoc:
+ "Optional"
+ end
end
#
@@ -750,6 +785,10 @@ class Gem::OptionParser
end
val
end
+
+ def pretty_head # :nodoc:
+ "Placed"
+ end
end
end
@@ -781,6 +820,17 @@ class Gem::OptionParser
@list = []
end
+ def pretty_print(q) # :nodoc:
+ q.group(1, "(", ")") do
+ @list.each do |sw|
+ next unless Switch === sw
+ q.group(1, "(" + sw.pretty_head, ")") do
+ sw.pretty_print_contents(q)
+ end
+ end
+ end
+ end
+
#
# See Gem::OptionParser.accept.
#
@@ -1293,6 +1343,29 @@ XXX
def help; summarize("#{banner}".sub(/\n?\z/, "\n")) end
alias to_s help
+ def pretty_print(q) # :nodoc:
+ q.object_group(self) do
+ first = true
+ if @stack.size > 2
+ @stack.each_with_index do |s, i|
+ next if i < 2
+ next if s.list.empty?
+ if first
+ first = false
+ q.text ":"
+ end
+ q.breakable
+ s.pretty_print(q)
+ end
+ end
+ end
+ end
+
+ def inspect # :nodoc:
+ require 'pp'
+ pretty_print_inspect
+ end
+
#
# Returns option summary list.
#
diff --git a/lib/rubygems/optparse/lib/optparse/ac.rb b/lib/rubygems/optparse/lib/optparse/ac.rb
index ff2f4c2dc3..e84d01bf91 100644
--- a/lib/rubygems/optparse/lib/optparse/ac.rb
+++ b/lib/rubygems/optparse/lib/optparse/ac.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: false
-require 'rubygems/optparse/lib/optparse'
+require_relative '../optparse'
class Gem::OptionParser::AC < Gem::OptionParser
private
diff --git a/lib/rubygems/optparse/lib/optparse/date.rb b/lib/rubygems/optparse/lib/optparse/date.rb
index 11131e92c2..d9a9f4f48a 100644
--- a/lib/rubygems/optparse/lib/optparse/date.rb
+++ b/lib/rubygems/optparse/lib/optparse/date.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: false
-require 'rubygems/optparse/lib/optparse'
+require_relative '../optparse'
require 'date'
Gem::OptionParser.accept(DateTime) do |s,|
diff --git a/lib/rubygems/optparse/lib/optparse/kwargs.rb b/lib/rubygems/optparse/lib/optparse/kwargs.rb
index 9290344c39..6987a5ed62 100644
--- a/lib/rubygems/optparse/lib/optparse/kwargs.rb
+++ b/lib/rubygems/optparse/lib/optparse/kwargs.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: true
-require 'rubygems/optparse/lib/optparse'
+require_relative '../optparse'
class Gem::OptionParser
# :call-seq:
diff --git a/lib/rubygems/optparse/lib/optparse/shellwords.rb b/lib/rubygems/optparse/lib/optparse/shellwords.rb
index 60dd91990c..d47ad60255 100644
--- a/lib/rubygems/optparse/lib/optparse/shellwords.rb
+++ b/lib/rubygems/optparse/lib/optparse/shellwords.rb
@@ -2,6 +2,6 @@
# -*- ruby -*-
require 'shellwords'
-require 'rubygems/optparse/lib/optparse'
+require_relative '../optparse'
Gem::OptionParser.accept(Shellwords) {|s,| Shellwords.shellwords(s)}
diff --git a/lib/rubygems/optparse/lib/optparse/time.rb b/lib/rubygems/optparse/lib/optparse/time.rb
index cb19f6e998..c59e1e4ced 100644
--- a/lib/rubygems/optparse/lib/optparse/time.rb
+++ b/lib/rubygems/optparse/lib/optparse/time.rb
@@ -1,5 +1,5 @@
# frozen_string_literal: false
-require 'rubygems/optparse/lib/optparse'
+require_relative '../optparse'
require 'time'
Gem::OptionParser.accept(Time) do |s,|
diff --git a/lib/rubygems/optparse/lib/optparse/uri.rb b/lib/rubygems/optparse/lib/optparse/uri.rb
index 088f309992..664d7f2af4 100644
--- a/lib/rubygems/optparse/lib/optparse/uri.rb
+++ b/lib/rubygems/optparse/lib/optparse/uri.rb
@@ -1,7 +1,7 @@
# frozen_string_literal: false
# -*- ruby -*-
-require 'rubygems/optparse/lib/optparse'
+require_relative '../optparse'
require 'uri'
Gem::OptionParser.accept(URI) {|s,| URI.parse(s) if s}
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 0d72cee51d..7e7599f7db 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -657,6 +657,8 @@ class Gem::Specification < Gem::BasicSpecification
@rdoc_options ||= []
end
+ LATEST_RUBY_WITHOUT_PATCH_VERSIONS = Gem::Version.new("2.1")
+
##
# The version of Ruby required by this gem. The ruby version can be
# specified to the patch-level:
@@ -683,6 +685,14 @@ class Gem::Specification < Gem::BasicSpecification
def required_ruby_version=(req)
@required_ruby_version = Gem::Requirement.create req
+
+ @required_ruby_version.requirements.map! do |op, v|
+ if v >= LATEST_RUBY_WITHOUT_PATCH_VERSIONS && v.release.segments.size == 4
+ [op == "~>" ? "=" : op, Gem::Version.new(v.segments.tap {|s| s.delete_at(3) }.join("."))]
+ else
+ [op, v]
+ end
+ end
end
##
diff --git a/spec/bundler/bundler/dsl_spec.rb b/spec/bundler/bundler/dsl_spec.rb
index a44a12924c..4802b62a58 100644
--- a/spec/bundler/bundler/dsl_spec.rb
+++ b/spec/bundler/bundler/dsl_spec.rb
@@ -137,8 +137,9 @@ RSpec.describe Bundler::Dsl do
end
describe "#gem" do
- [:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :mri, :mri_18, :mri_19,
- :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26, :jruby, :rbx, :truffleruby].each do |platform|
+ [:ruby, :ruby_18, :ruby_19, :ruby_20, :ruby_21, :ruby_22, :ruby_23, :ruby_24, :ruby_25, :ruby_26, :ruby_27,
+ :ruby_30, :ruby_31, :mri, :mri_18, :mri_19, :mri_20, :mri_21, :mri_22, :mri_23, :mri_24, :mri_25, :mri_26,
+ :mri_27, :mri_30, :mri_31, :jruby, :rbx, :truffleruby].each do |platform|
it "allows #{platform} as a valid platform" do
subject.gem("foo", :platform => platform)
end
diff --git a/spec/bundler/bundler/ruby_version_spec.rb b/spec/bundler/bundler/ruby_version_spec.rb
index 8c6c071d7f..3e3850031c 100644
--- a/spec/bundler/bundler/ruby_version_spec.rb
+++ b/spec/bundler/bundler/ruby_version_spec.rb
@@ -498,31 +498,5 @@ RSpec.describe "Bundler::RubyVersion and its subclasses" do
end
end
end
-
- describe "#to_gem_version_with_patchlevel" do
- shared_examples_for "the patchlevel is omitted" do
- it "does not include a patch level" do
- expect(subject.to_gem_version_with_patchlevel.to_s).to eq(version)
- end
- end
-
- context "with nil patch number" do
- let(:patchlevel) { nil }
-
- it_behaves_like "the patchlevel is omitted"
- end
-
- context "with negative patch number" do
- let(:patchlevel) { -1 }
-
- it_behaves_like "the patchlevel is omitted"
- end
-
- context "with a valid patch number" do
- it "uses the specified patchlevel as patchlevel" do
- expect(subject.to_gem_version_with_patchlevel.to_s).to eq("#{version}.#{patchlevel}")
- end
- end
- end
end
end
diff --git a/spec/bundler/install/gems/resolving_spec.rb b/spec/bundler/install/gems/resolving_spec.rb
index 209996f61f..83f1e60806 100644
--- a/spec/bundler/install/gems/resolving_spec.rb
+++ b/spec/bundler/install/gems/resolving_spec.rb
@@ -301,7 +301,28 @@ RSpec.describe "bundle install with install-time dependencies" do
end
let(:ruby_requirement) { %("#{RUBY_VERSION}") }
- let(:error_message_requirement) { "~> #{RUBY_VERSION}.0" }
+ let(:error_message_requirement) { "= #{RUBY_VERSION}" }
+
+ it "raises a proper error that mentions the current Ruby version during resolution" do
+ install_gemfile <<-G, :artifice => "compact_index", :env => { "BUNDLER_SPEC_GEM_REPO" => gem_repo2.to_s }, :raise_on_error => false
+ source "http://localgemserver.test/"
+ gem 'require_ruby'
+ G
+
+ expect(out).to_not include("Gem::InstallError: require_ruby requires Ruby version > 9000")
+
+ nice_error = strip_whitespace(<<-E).strip
+ Bundler found conflicting requirements for the Ruby\0 version:
+ In Gemfile:
+ require_ruby was resolved to 1.0, which depends on
+ Ruby\0 (> 9000)
+
+ Current Ruby\0 version:
+ Ruby\0 (#{error_message_requirement})
+
+ E
+ expect(err).to end_with(nice_error)
+ end
shared_examples_for "ruby version conflicts" do
it "raises an error during resolution" do
@@ -316,10 +337,12 @@ RSpec.describe "bundle install with install-time dependencies" do
nice_error = strip_whitespace(<<-E).strip
Bundler found conflicting requirements for the Ruby\0 version:
In Gemfile:
- Ruby\0 (#{error_message_requirement})
-
require_ruby was resolved to 1.0, which depends on
Ruby\0 (> 9000)
+
+ Current Ruby\0 version:
+ Ruby\0 (#{error_message_requirement})
+
E
expect(err).to end_with(nice_error)
end
@@ -329,7 +352,6 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a < requirement" do
let(:ruby_requirement) { %("< 5000") }
- let(:error_message_requirement) { "< 5000" }
it_behaves_like "ruby version conflicts"
end
@@ -337,7 +359,6 @@ RSpec.describe "bundle install with install-time dependencies" do
describe "with a compound requirement" do
let(:reqs) { ["> 0.1", "< 5000"] }
let(:ruby_requirement) { reqs.map(&:dump).join(", ") }
- let(:error_message_requirement) { Gem::Requirement.new(reqs).to_s }
it_behaves_like "ruby version conflicts"
end
@@ -361,10 +382,12 @@ RSpec.describe "bundle install with install-time dependencies" do
nice_error = strip_whitespace(<<-E).strip
Bundler found conflicting requirements for the RubyGems\0 version:
In Gemfile:
- RubyGems\0 (= #{Gem::VERSION})
-
require_rubygems was resolved to 1.0, which depends on
RubyGems\0 (> 9000)
+
+ Current RubyGems\0 version:
+ RubyGems\0 (= #{Gem::VERSION})
+
E
expect(err).to end_with(nice_error)
end
diff --git a/test/rubygems/helper.rb b/test/rubygems/helper.rb
index be9016b831..946a792854 100644
--- a/test/rubygems/helper.rb
+++ b/test/rubygems/helper.rb
@@ -1098,13 +1098,12 @@ Also, a list:
Zlib::Deflate.deflate data
end
- def util_set_RUBY_VERSION(version, patchlevel = nil, revision = nil, description = nil, engine = "ruby", engine_version = nil)
+ def util_set_RUBY_VERSION(version, revision = nil, description = nil, engine = "ruby", engine_version = nil)
if Gem.instance_variables.include? :@ruby_version
Gem.send :remove_instance_variable, :@ruby_version
end
@RUBY_VERSION = RUBY_VERSION
- @RUBY_PATCHLEVEL = RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
@RUBY_REVISION = RUBY_REVISION if defined?(RUBY_REVISION)
@RUBY_DESCRIPTION = RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
@RUBY_ENGINE = RUBY_ENGINE
@@ -1113,7 +1112,6 @@ Also, a list:
util_clear_RUBY_VERSION
Object.const_set :RUBY_VERSION, version
- Object.const_set :RUBY_PATCHLEVEL, patchlevel if patchlevel
Object.const_set :RUBY_REVISION, revision if revision
Object.const_set :RUBY_DESCRIPTION, description if description
Object.const_set :RUBY_ENGINE, engine
@@ -1124,8 +1122,6 @@ Also, a list:
util_clear_RUBY_VERSION
Object.const_set :RUBY_VERSION, @RUBY_VERSION
- Object.const_set :RUBY_PATCHLEVEL, @RUBY_PATCHLEVEL if
- defined?(@RUBY_PATCHLEVEL)
Object.const_set :RUBY_REVISION, @RUBY_REVISION if
defined?(@RUBY_REVISION)
Object.const_set :RUBY_DESCRIPTION, @RUBY_DESCRIPTION if
@@ -1137,7 +1133,6 @@ Also, a list:
def util_clear_RUBY_VERSION
Object.send :remove_const, :RUBY_VERSION
- Object.send :remove_const, :RUBY_PATCHLEVEL if defined?(RUBY_PATCHLEVEL)
Object.send :remove_const, :RUBY_REVISION if defined?(RUBY_REVISION)
Object.send :remove_const, :RUBY_DESCRIPTION if defined?(RUBY_DESCRIPTION)
Object.send :remove_const, :RUBY_ENGINE
diff --git a/test/rubygems/test_gem.rb b/test/rubygems/test_gem.rb
index a8be078046..8b267817a4 100644
--- a/test/rubygems/test_gem.rb
+++ b/test/rubygems/test_gem.rb
@@ -1114,16 +1114,8 @@ class TestGem < Gem::TestCase
util_restore_RUBY_VERSION
end
- def test_self_ruby_version_with_release
- util_set_RUBY_VERSION '1.8.6', 287
-
- assert_equal Gem::Version.new('1.8.6.287'), Gem.ruby_version
- ensure
- util_restore_RUBY_VERSION
- end
-
def test_self_ruby_version_with_non_mri_implementations
- util_set_RUBY_VERSION '2.5.0', 0, 60928, 'jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]'
+ util_set_RUBY_VERSION '2.5.0', 60928, 'jruby 9.2.0.0 (2.5.0) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]'
assert_equal Gem::Version.new('2.5.0'), Gem.ruby_version
ensure
@@ -1131,7 +1123,7 @@ class TestGem < Gem::TestCase
end
def test_self_ruby_version_with_svn_prerelease
- util_set_RUBY_VERSION '2.6.0', -1, 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
+ util_set_RUBY_VERSION '2.6.0', 63539, 'ruby 2.6.0preview2 (2018-05-31 trunk 63539) [x86_64-linux]'
assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
ensure
@@ -1139,7 +1131,7 @@ class TestGem < Gem::TestCase
end
def test_self_ruby_version_with_git_prerelease
- util_set_RUBY_VERSION '2.7.0', -1, 'b563439274a402e33541f5695b1bfd4ac1085638', 'ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]'
+ util_set_RUBY_VERSION '2.7.0', 'b563439274a402e33541f5695b1bfd4ac1085638', 'ruby 2.7.0preview3 (2019-11-23 master b563439274) [x86_64-linux]'
assert_equal Gem::Version.new('2.7.0.preview3'), Gem.ruby_version
ensure
@@ -1147,7 +1139,7 @@ class TestGem < Gem::TestCase
end
def test_self_ruby_version_with_non_mri_implementations_with_mri_prerelase_compatibility
- util_set_RUBY_VERSION '2.6.0', -1, 63539, 'weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]', 'weirdjruby', '9.2.0.0'
+ util_set_RUBY_VERSION '2.6.0', 63539, 'weirdjruby 9.2.0.0 (2.6.0preview2) 2018-05-24 81156a8 OpenJDK 64-Bit Server VM 25.171-b11 on 1.8.0_171-8u171-b11-0ubuntu0.16.04.1-b11 [linux-x86_64]', 'weirdjruby', '9.2.0.0'
assert_equal Gem::Version.new('2.6.0.preview2'), Gem.ruby_version
ensure
@@ -1155,7 +1147,7 @@ class TestGem < Gem::TestCase
end
def test_self_ruby_version_with_svn_trunk
- util_set_RUBY_VERSION '1.9.2', -1, 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
+ util_set_RUBY_VERSION '1.9.2', 23493, 'ruby 1.9.2dev (2009-05-20 trunk 23493) [x86_64-linux]'
assert_equal Gem::Version.new('1.9.2.dev'), Gem.ruby_version
ensure
@@ -1163,7 +1155,7 @@ class TestGem < Gem::TestCase
end
def test_self_ruby_version_with_git_master
- util_set_RUBY_VERSION '2.7.0', -1, '5de284ec78220e75643f89b454ce999da0c1c195', 'ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]'
+ util_set_RUBY_VERSION '2.7.0', '5de284ec78220e75643f89b454ce999da0c1c195', 'ruby 2.7.0dev (2019-12-23T01:37:30Z master 5de284ec78) [x86_64-linux]'
assert_equal Gem::Version.new('2.7.0.dev'), Gem.ruby_version
ensure
diff --git a/test/rubygems/test_gem_ext_cargo_builder.rb b/test/rubygems/test_gem_ext_cargo_builder.rb
index 0c8de2ff6c..bc9ff3a268 100644
--- a/test/rubygems/test_gem_ext_cargo_builder.rb
+++ b/test/rubygems/test_gem_ext_cargo_builder.rb
@@ -4,7 +4,7 @@ require 'rubygems/ext'
class TestGemExtCargoBuilder < Gem::TestCase
def setup
- @orig_env = ENV.to_hash
+ super
@rust_envs = {
'CARGO_HOME' => File.join(@orig_env['HOME'], '.cargo'),
@@ -13,8 +13,6 @@ class TestGemExtCargoBuilder < Gem::TestCase
system(@rust_envs, 'cargo', '-V', out: IO::NULL, err: [:child, :out])
pend 'cargo not present' unless $?.success?
-
- super
end
def setup_rust_gem(name)
diff --git a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
index efee4b2f2c..b1b94017b5 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
+++ b/test/rubygems/test_gem_ext_cargo_builder/custom_name/Cargo.lock
@@ -271,9 +271,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.5.4"
+version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
+checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [
"aho-corasick",
"memchr",
diff --git a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
index 9248f7101c..accff220e5 100644
--- a/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
+++ b/test/rubygems/test_gem_ext_cargo_builder/rust_ruby_example/Cargo.lock
@@ -264,9 +264,9 @@ dependencies = [
[[package]]
name = "regex"
-version = "1.5.4"
+version = "1.5.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
+checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
dependencies = [
"aho-corasick",
"memchr",
diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb
index c90fdab283..46bb6965c7 100644
--- a/test/rubygems/test_gem_installer.rb
+++ b/test/rubygems/test_gem_installer.rb
@@ -1221,15 +1221,13 @@ gem 'other', version
def test_install_missing_dirs
installer = setup_base_installer
- FileUtils.rm_f File.join(Gem.dir, 'cache')
- FileUtils.rm_f File.join(Gem.dir, 'doc')
- FileUtils.rm_f File.join(Gem.dir, 'specifications')
+ FileUtils.rm_rf File.join(Gem.dir, 'doc')
+ FileUtils.rm_rf File.join(Gem.dir, 'specifications')
use_ui @ui do
installer.install
end
- assert_directory_exists File.join(Gem.dir, 'cache')
assert_directory_exists File.join(Gem.dir, 'doc')
assert_directory_exists File.join(Gem.dir, 'specifications')
@@ -2237,7 +2235,7 @@ gem 'other', version
def test_default_gem_without_wrappers
installer = setup_base_installer
- FileUtils.rm_f File.join(Gem.dir, 'specifications')
+ FileUtils.rm_rf File.join(Gem.default_dir, 'specifications')
installer.wrappers = false
installer.options[:install_as_default] = true
diff --git a/tool/bundler/dev_gems.rb.lock b/tool/bundler/dev_gems.rb.lock
index 11bda60254..92ac64ac32 100644
--- a/tool/bundler/dev_gems.rb.lock
+++ b/tool/bundler/dev_gems.rb.lock
@@ -72,4 +72,4 @@ DEPENDENCIES
webrick (~> 1.6)
BUNDLED WITH
- 2.3.11
+ 2.3.12
diff --git a/tool/bundler/rubocop_gems.rb.lock b/tool/bundler/rubocop_gems.rb.lock
index 1510eb67ac..96dbe40e17 100644
--- a/tool/bundler/rubocop_gems.rb.lock
+++ b/tool/bundler/rubocop_gems.rb.lock
@@ -61,4 +61,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
- 2.3.11
+ 2.3.12
diff --git a/tool/bundler/standard_gems.rb.lock b/tool/bundler/standard_gems.rb.lock
index 1b749a35f5..3bf7859545 100644
--- a/tool/bundler/standard_gems.rb.lock
+++ b/tool/bundler/standard_gems.rb.lock
@@ -67,4 +67,4 @@ DEPENDENCIES
test-unit
BUNDLED WITH
- 2.3.11
+ 2.3.12
diff --git a/tool/bundler/test_gems.rb.lock b/tool/bundler/test_gems.rb.lock
index 9269e56bc1..9cac5030a6 100644
--- a/tool/bundler/test_gems.rb.lock
+++ b/tool/bundler/test_gems.rb.lock
@@ -41,4 +41,4 @@ DEPENDENCIES
webrick (= 1.7.0)
BUNDLED WITH
- 2.3.11
+ 2.3.12