Merge pull request #15150 from muzimuzhi/tap-formula-file
Tighten `tap.formula_file?(file)` and `tap.formula_files` to not detect cask file as formula
This commit is contained in:
commit
104434c1d9
@ -498,7 +498,7 @@ class Tap
|
|||||||
formula_dir.find
|
formula_dir.find
|
||||||
else
|
else
|
||||||
formula_dir.children
|
formula_dir.children
|
||||||
end.select(&method(:ruby_file?))
|
end.select(&method(:formula_file?))
|
||||||
else
|
else
|
||||||
[]
|
[]
|
||||||
end
|
end
|
||||||
@ -561,7 +561,7 @@ class Tap
|
|||||||
file.extname == ".rb"
|
file.extname == ".rb"
|
||||||
end
|
end
|
||||||
|
|
||||||
# return true if given path would present a {Formula} file in this {Tap}.
|
# returns true if given path would present a {Formula} file in this {Tap}.
|
||||||
# accepts both absolute path and relative path (relative to this {Tap}'s path)
|
# accepts both absolute path and relative path (relative to this {Tap}'s path)
|
||||||
# @private
|
# @private
|
||||||
sig { params(file: T.any(String, Pathname)).returns(T::Boolean) }
|
sig { params(file: T.any(String, Pathname)).returns(T::Boolean) }
|
||||||
@ -569,11 +569,12 @@ class Tap
|
|||||||
file = Pathname.new(file) unless file.is_a? Pathname
|
file = Pathname.new(file) unless file.is_a? Pathname
|
||||||
file = file.expand_path(path)
|
file = file.expand_path(path)
|
||||||
return false unless ruby_file?(file)
|
return false unless ruby_file?(file)
|
||||||
|
return false if cask_file?(file)
|
||||||
|
|
||||||
file.to_s.start_with?("#{formula_dir}/")
|
file.to_s.start_with?("#{formula_dir}/")
|
||||||
end
|
end
|
||||||
|
|
||||||
# return true if given path would present a {Cask} file in this {Tap}.
|
# returns true if given path would present a {Cask} file in this {Tap}.
|
||||||
# accepts both absolute path and relative path (relative to this {Tap}'s path)
|
# accepts both absolute path and relative path (relative to this {Tap}'s path)
|
||||||
# @private
|
# @private
|
||||||
sig { params(file: T.any(String, Pathname)).returns(T::Boolean) }
|
sig { params(file: T.any(String, Pathname)).returns(T::Boolean) }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user