brew vendor-gems: commit updates.

This commit is contained in:
BrewTestBot 2021-12-27 18:15:43 +00:00
parent c1973ae2be
commit f4af030751
No known key found for this signature in database
GPG Key ID: 82D7D104050B0F0F
14 changed files with 21 additions and 23 deletions

View File

@ -7,7 +7,7 @@ $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/concurrent-ruby-1.1.9
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.11/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/i18n-1.8.11/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.15.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/minitest-5.15.0/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/tzinfo-2.0.4/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.5.1/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/zeitwerk-2.5.2/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.4.3/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/activesupport-6.1.4.3/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/public_suffix-4.0.6/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/public_suffix-4.0.6/lib"
$:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib" $:.unshift "#{path}/../#{ruby_engine}/#{ruby_version}/gems/addressable-2.8.0/lib"

View File

@ -24,22 +24,23 @@ module Kernel
def require(path) def require(path)
if loader = Zeitwerk::Registry.loader_for(path) if loader = Zeitwerk::Registry.loader_for(path)
if path.end_with?(".rb") if path.end_with?(".rb")
zeitwerk_original_require(path).tap do |required| required = zeitwerk_original_require(path)
loader.on_file_autoloaded(path) if required loader.on_file_autoloaded(path) if required
end required
else else
loader.on_dir_autoloaded(path) loader.on_dir_autoloaded(path)
$LOADED_FEATURES << path
true true
end end
else else
zeitwerk_original_require(path).tap do |required| required = zeitwerk_original_require(path)
if required if required
abspath = $LOADED_FEATURES.last abspath = $LOADED_FEATURES.last
if loader = Zeitwerk::Registry.loader_for(abspath) if loader = Zeitwerk::Registry.loader_for(abspath)
loader.on_file_autoloaded(abspath) loader.on_file_autoloaded(abspath)
end end
end end
end required
end end
end end

View File

@ -1,7 +1,6 @@
# frozen_string_literal: true # frozen_string_literal: true
require "set" require "set"
require "securerandom"
module Zeitwerk module Zeitwerk
class Loader class Loader
@ -124,13 +123,7 @@ module Zeitwerk
# @sig () -> void # @sig () -> void
def unload def unload
mutex.synchronize do mutex.synchronize do
# We are going to keep track of the files that were required by our abspaths_of_unloaded_crefs = Set.new
# autoloads to later remove them from $LOADED_FEATURES, thus making them
# loadable by Kernel#require again.
#
# Directories are not stored in $LOADED_FEATURES, keeping track of files
# is enough.
unloaded_files = Set.new
autoloads.each do |abspath, (parent, cname)| autoloads.each do |abspath, (parent, cname)|
if parent.autoload?(cname) if parent.autoload?(cname)
@ -140,7 +133,7 @@ module Zeitwerk
# and the constant path would escape unloadable_cpath? This is just # and the constant path would escape unloadable_cpath? This is just
# defensive code to clean things up as much as we are able to. # defensive code to clean things up as much as we are able to.
unload_cref(parent, cname) unload_cref(parent, cname)
unloaded_files.add(abspath) if ruby?(abspath) abspaths_of_unloaded_crefs.add(abspath)
end end
end end
@ -151,10 +144,14 @@ module Zeitwerk
end end
unload_cref(parent, cname) unload_cref(parent, cname)
unloaded_files.add(abspath) if ruby?(abspath) abspaths_of_unloaded_crefs.add(abspath)
end end
unless unloaded_files.empty? unless abspaths_of_unloaded_crefs.empty?
# We remove these abspaths from $LOADED_FEATURES because, otherwise,
# `require`'s idempotence would prevent newly defined autoloads from
# loading them again.
#
# Bootsnap decorates Kernel#require to speed it up using a cache and # Bootsnap decorates Kernel#require to speed it up using a cache and
# this optimization does not check if $LOADED_FEATURES has the file. # this optimization does not check if $LOADED_FEATURES has the file.
# #
@ -166,7 +163,7 @@ module Zeitwerk
# Rails applications may depend on bootsnap, so for unloading to work # Rails applications may depend on bootsnap, so for unloading to work
# in that setting it is preferable that we restrict our API choice to # in that setting it is preferable that we restrict our API choice to
# one of those methods. # one of those methods.
$LOADED_FEATURES.reject! { |file| unloaded_files.member?(file) } $LOADED_FEATURES.reject! { |file| abspaths_of_unloaded_crefs.member?(file) }
end end
autoloads.clear autoloads.clear

View File

@ -1,5 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
module Zeitwerk module Zeitwerk
VERSION = "2.5.1" VERSION = "2.5.2"
end end