summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-01-14 13:38:47 +0900
committerNARUSE, Yui <nurse@users.noreply.github.com>2021-01-14 16:44:42 +0900
commit29777cb32ad6417c3583a81b01127c93cd667e77 (patch)
tree14d9c552ecbd1e0c8c0e6910364bd796f4840cff /lib
parent93dcf0828dc8e627e0c24497795d927911a9d993 (diff)
Merge RubyGems-3.2.5
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems.rb2
-rw-r--r--lib/rubygems/commands/setup_command.rb4
-rw-r--r--lib/rubygems/specification.rb32
-rw-r--r--lib/rubygems/test_case.rb15
4 files changed, 34 insertions, 19 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb
index 0c3e5858d4..6d72006dd4 100644
--- a/lib/rubygems.rb
+++ b/lib/rubygems.rb
@@ -8,7 +8,7 @@
require 'rbconfig'
module Gem
- VERSION = "3.2.4".freeze
+ VERSION = "3.2.5".freeze
end
# Must be first since it unloads the prelude from 1.9.2
diff --git a/lib/rubygems/commands/setup_command.rb b/lib/rubygems/commands/setup_command.rb
index b5af43d7b7..47e215c149 100644
--- a/lib/rubygems/commands/setup_command.rb
+++ b/lib/rubygems/commands/setup_command.rb
@@ -375,9 +375,7 @@ By default, this RubyGems will install gem as:
specs_dir = File.join(options[:destdir], specs_dir) unless Gem.win_platform?
mkdir_p specs_dir, :mode => 0755
- bundler_spec = Gem::Specification.load("bundler/bundler.gemspec")
- bundler_spec.files = Dir.chdir("bundler") { Dir["{*.md,{lib,exe}/**/*}"] }
- bundler_spec.executables -= %w[bundler bundle_ruby]
+ bundler_spec = Dir.chdir("bundler") { Gem::Specification.load("bundler.gemspec") }
# Remove bundler-*.gemspec in default specification directory.
Dir.entries(specs_dir).
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index d59f57c49f..4e1a3a3801 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -182,6 +182,7 @@ class Gem::Specification < Gem::BasicSpecification
@@default_value[k].nil?
end
+ @@stubs = nil
@@stubs_by_name = {}
# Sentinel object to represent "not found" stubs
@@ -800,10 +801,8 @@ class Gem::Specification < Gem::BasicSpecification
def self.stubs
@@stubs ||= begin
pattern = "*.gemspec"
- stubs = installed_stubs(dirs, pattern) + default_stubs(pattern)
- stubs = stubs.uniq {|stub| stub.full_name }
+ stubs = stubs_for_pattern(pattern, false)
- _resort!(stubs)
@@stubs_by_name = stubs.select {|s| Gem::Platform.match_spec? s }.group_by(&:name)
stubs
end
@@ -820,26 +819,31 @@ class Gem::Specification < Gem::BasicSpecification
end
end
- EMPTY = [].freeze # :nodoc:
-
##
# Returns a Gem::StubSpecification for installed gem named +name+
# only returns stubs that match Gem.platforms
def self.stubs_for(name)
- if @@stubs_by_name[name]
- @@stubs_by_name[name]
+ if @@stubs
+ @@stubs_by_name[name] || []
else
- pattern = "#{name}-*.gemspec"
- stubs = installed_stubs(dirs, pattern).select {|s| Gem::Platform.match_spec? s } + default_stubs(pattern)
- stubs = stubs.uniq {|stub| stub.full_name }.group_by(&:name)
- stubs.each_value {|v| _resort!(v) }
-
- @@stubs_by_name.merge! stubs
- @@stubs_by_name[name] ||= EMPTY
+ @@stubs_by_name[name] ||= stubs_for_pattern("#{name}-*.gemspec")
end
end
+ ##
+ # Finds stub specifications matching a pattern from the standard locations,
+ # optionally filtering out specs not matching the current platform
+ #
+ def self.stubs_for_pattern(pattern, match_platform = true) # :nodoc:
+ installed_stubs = installed_stubs(Gem::Specification.dirs, pattern)
+ installed_stubs.select! {|s| Gem::Platform.match_spec? s } if match_platform
+ stubs = installed_stubs + default_stubs(pattern)
+ stubs = stubs.uniq {|stub| stub.full_name }
+ _resort!(stubs)
+ stubs
+ end
+
def self._resort!(specs) # :nodoc:
specs.sort! do |a, b|
names = a.name <=> b.name
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index 6523c515be..0f3791f03d 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -26,7 +26,20 @@ begin
rescue LoadError
end
-require 'bundler'
+if File.exist?(bundler_gemspec)
+ require_relative '../../bundler/lib/bundler'
+else
+ require 'bundler'
+end
+
+# Enable server plugin needed for bisection
+if ENV["RG_BISECT_SERVER_PLUGIN"]
+ require ENV["RG_BISECT_SERVER_PLUGIN"]
+
+ Minitest.extensions << "server"
+end
+
+ENV["MT_NO_PLUGINS"] = "true"
require 'minitest/autorun'