Merge pull request #18176 from Homebrew/speed-up-loading-cask-and-formula-file-names_v4

Simplify globbing for casks and formula in taps
This commit is contained in:
Kevin 2024-08-27 01:02:58 -07:00 committed by GitHub
commit f31aa91f67
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -712,10 +712,10 @@ class Tap
if formula_dir == path
# We only want the top level here so we don't treat commands & casks as formulae.
# Sharding is only supported in Formula/ and HomebrewFormula/.
Dir.glob(File.join(formula_dir.to_s, "*.rb"))
Pathname.glob(formula_dir/"*.rb")
else
Dir.glob(File.join(formula_dir.to_s, "**/*.rb"))
end.map { Pathname(_1) }
Pathname.glob(formula_dir/"**/*.rb")
end
else
[]
end
@ -736,7 +736,7 @@ class Tap
sig { returns(T::Array[Pathname]) }
def cask_files
@cask_files ||= if cask_dir.directory?
Dir.glob(File.join(cask_dir.to_s, "**/*.rb")).map { Pathname(_1) }
Pathname.glob(cask_dir/"**/*.rb")
else
[]
end