From e5089a15618da64dfedcbd39458c096bd377e60e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Wed, 30 Oct 2013 11:19:28 -0700 Subject: global: add more tap regexes. --- Library/Homebrew/cmd/info.rb | 2 +- Library/Homebrew/cmd/versions.rb | 2 +- Library/Homebrew/formula.rb | 2 +- Library/Homebrew/global.rb | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) (limited to 'Library') diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index d794cf26f..3180c60b6 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -67,7 +67,7 @@ module Homebrew extend self def github_info f path = f.path.realpath - if path.to_s =~ %r{#{HOMEBREW_REPOSITORY}/Library/Taps/(\w+)-(\w+)/(.*)} + if path.to_s =~ HOMEBREW_TAP_PATH_REGEX user = $1 repo = "homebrew-#$2" path = $3 diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb index daca2469a..35597c6c5 100644 --- a/Library/Homebrew/cmd/versions.rb +++ b/Library/Homebrew/cmd/versions.rb @@ -64,7 +64,7 @@ class Formula private def repository @repository ||= begin - if path.realpath.to_s =~ %r{#{HOMEBREW_REPOSITORY}/Library/Taps/(\w+)-(\w+)} + if path.realpath.to_s =~ HOMEBREW_TAP_DIR_REGEX HOMEBREW_REPOSITORY/"Library/Taps/#$1-#$2" else HOMEBREW_REPOSITORY diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index b94ec7c3e..e0c9921cd 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -438,7 +438,7 @@ class Formula end def tap - if path.realpath.to_s =~ %r{#{HOMEBREW_REPOSITORY}/Library/Taps/(\w+)-(\w+)} + if path.realpath.to_s =~ HOMEBREW_TAP_DIR_REGEX "#$1/#$2" elsif core_formula? "mxcl/master" diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index c65bf50ba..12e77c407 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -84,6 +84,9 @@ HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY HOMEBREW_CURL_ARGS = '-f#LA' HOMEBREW_TAP_FORMULA_REGEX = %r{^(\w+)/(\w+)/([^/]+)$} +HOMEBREW_TAP_DIR_REGEX = %r{#{HOMEBREW_REPOSITORY}/Library/Taps/(\w+)-(\w+)} +HOMEBREW_TAP_PATH_REGEX = Regexp.new(HOMEBREW_TAP_DIR_REGEX.source \ + + %r{/(.*)}.source) module Homebrew extend self include FileUtils -- cgit v1.2.3