summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorVít Ondruch <vondruch@redhat.com>2019-04-02 10:52:44 +0200
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-05-08 14:13:29 +0900
commitacc86570dd8cc1920d1c55da7836d6c60d98a6d5 (patch)
tree1ad418ef0e0c63eb073d37ce6edfaf5fd7350906 /lib
parent15a4b7d7693891831cd956def7108481aa86ddb2 (diff)
[rubygems/rubygems] Let `@@stubs_by_name` to be incrementally populated again.
Originally, the call to `.stubs_for` allowed to incrementally populate the `@@stubs_by_name` (especially see the `"#{name}-*.gemspec"` pattern in 4fa03bb7aac9f25f44394e818433fdda9962ae8d). Now it looks like it expects that all stubs are loaded, but the `.stubs_for` still matches the .gemspec files by the `name` pattern: https://github.com/rubygems/rubygems/blob/6d45e0f7ac1caca22900e39f703e226c4cfdebf7/lib/rubygems/specification.rb#L845 I think this was done by mistake incrementally by PR #1239 and 4cee8ca9199ac7b3ab8647e0b78615f55d3eb02b. I think the best option is to get back to the original implementation, to let RubyGems incrementally populate the array. Other option would be to replace the logic in `.stub_for` by call to `.stubs`, but the means the performance improvement from the original commit was lost. https://github.com/rubygems/rubygems/commit/4d0e18185a
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3092
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/specification.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/rubygems/specification.rb b/lib/rubygems/specification.rb
index 9f6cdea8ad..4f2b64e652 100644
--- a/lib/rubygems/specification.rb
+++ b/lib/rubygems/specification.rb
@@ -828,8 +828,8 @@ class Gem::Specification < Gem::BasicSpecification
# only returns stubs that match Gem.platforms
def self.stubs_for(name)
- if @@stubs
- @@stubs_by_name[name] || []
+ if @@stubs_by_name[name]
+ @@stubs_by_name[name]
else
pattern = "#{name}-*.gemspec"
stubs = Gem.loaded_specs.values +