formulary: remove consts on cache clear

This commit is contained in:
Bo Anderson 2021-02-17 15:14:16 +00:00
parent 431e448c9e
commit da9e42f312

View File

@ -33,6 +33,19 @@ module Formulary
cache.fetch(path)
end
def self.clear_cache
cache.each do |key, klass|
next if key == :formulary_factory
namespace = klass.name.deconstantize
next if namespace.deconstantize != name
remove_const(namespace.demodulize)
end
super
end
def self.load_formula(name, path, contents, namespace, flags:)
raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if Homebrew::EnvConfig.disable_load_formula?