Merge pull request #18165 from Homebrew/speed-up-loading-cask-and-formula-file-names_v2
Speed up the `Tap#formula_files` and `Tap#cask_files` methods
This commit is contained in:
commit
0c3104a8f2
@ -712,10 +712,10 @@ class Tap
|
|||||||
if formula_dir == path
|
if formula_dir == path
|
||||||
# We only want the top level here so we don't treat commands & casks as formulae.
|
# We only want the top level here so we don't treat commands & casks as formulae.
|
||||||
# Sharding is only supported in Formula/ and HomebrewFormula/.
|
# Sharding is only supported in Formula/ and HomebrewFormula/.
|
||||||
formula_dir.children
|
Dir.glob(File.join(formula_dir.to_s, "*.rb"))
|
||||||
else
|
else
|
||||||
formula_dir.find
|
Dir.glob(File.join(formula_dir.to_s, "**/*.rb"))
|
||||||
end.select { formula_file?(_1) }
|
end.map { Pathname(_1) }
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
@ -736,7 +736,7 @@ class Tap
|
|||||||
sig { returns(T::Array[Pathname]) }
|
sig { returns(T::Array[Pathname]) }
|
||||||
def cask_files
|
def cask_files
|
||||||
@cask_files ||= if cask_dir.directory?
|
@cask_files ||= if cask_dir.directory?
|
||||||
cask_dir.find.select { ruby_file?(_1) }
|
Dir.glob(File.join(cask_dir.to_s, "**/*.rb")).map { Pathname(_1) }
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user