aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tap.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/tap.rb')
-rw-r--r--Library/Homebrew/tap.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb
index 712348d60..08e85688d 100644
--- a/Library/Homebrew/tap.rb
+++ b/Library/Homebrew/tap.rb
@@ -247,6 +247,15 @@ class Tap
end
end
+ # return 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)
+ # @private
+ def formula_file?(file)
+ file = Pathname.new(file) unless file.is_a? Pathname
+ file = file.expand_path(path)
+ file.extname == ".rb" && file.parent == formula_dir
+ end
+
# an array of all {Formula} names of this {Tap}.
def formula_names
@formula_names ||= formula_files.map { |f| formula_file_to_name(f) }