diff --git a/Library/Homebrew/tap.rb b/Library/Homebrew/tap.rb index ba55e3cf663e73b1ce336f0d7a1ed57b5403e3e0..99138330b2fa81477c996c5fbbcaddfd2ca6799f 100644 --- a/Library/Homebrew/tap.rb +++ b/Library/Homebrew/tap.rb @@ -41,6 +41,15 @@ class Tap CACHE.fetch(cache_key) { |key| CACHE[key] = Tap.new(user, repo) } end + def self.from_path(path) + path.to_s =~ HOMEBREW_TAP_PATH_REGEX + raise "Invalid tap path '#{path}'" unless $1 + fetch($1, $2) + rescue + # No need to error as a nil tap is sufficient to show failure. + nil + end + extend Enumerable # The user name of this {Tap}. Usually, it's the Github username of