diff options
| author | Mike McQuaid | 2013-10-21 04:24:54 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2013-10-21 18:53:24 +0100 |
| commit | 077f09e4ea7cabef9f3dd7212e5ccdfff1e5001d (patch) | |
| tree | af2bb18cc9117ad47f19eef755d913e6a00bdaba /Library | |
| parent | 862e6ca3bcaa313935a02ab87f182abf1fd31762 (diff) | |
| download | brew-077f09e4ea7cabef9f3dd7212e5ccdfff1e5001d.tar.bz2 | |
global: unify tap regex.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/search.rb | 8 | ||||
| -rw-r--r-- | Library/Homebrew/exceptions.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/global.rb | 5 |
3 files changed, 7 insertions, 8 deletions
diff --git a/Library/Homebrew/cmd/search.rb b/Library/Homebrew/cmd/search.rb index b2febbdba..204a178ae 100644 --- a/Library/Homebrew/cmd/search.rb +++ b/Library/Homebrew/cmd/search.rb @@ -4,12 +4,6 @@ require 'utils' require 'utils/json' module Homebrew extend self - - # A regular expession to capture the username (one or more char but no `/`, - # which has to be escaped like `\/`), repository, followed by an optional `/` - # and an optional query. - TAP_QUERY_REGEX = /^([^\/]+)\/([^\/]+)\/?(.+)?$/ - def search if ARGV.include? '--macports' exec_browser "http://www.macports.org/ports.php?by=name&substr=#{ARGV.next}" @@ -25,7 +19,7 @@ module Homebrew extend self exec_browser "http://packages.ubuntu.com/search?keywords=#{ARGV.next}&searchon=names&suite=all§ion=all" elsif (query = ARGV.first).nil? puts_columns Formula.names - elsif ARGV.first =~ TAP_QUERY_REGEX + elsif ARGV.first =~ HOMEBREW_TAP_REGEX # So look for user/repo/query or list all formulae by the tap # we downcase to avoid case-insensitive filesystem issues. user, repo, query = $1.downcase, $2.downcase, $3 diff --git a/Library/Homebrew/exceptions.rb b/Library/Homebrew/exceptions.rb index c0e9a8c73..1ea06381a 100644 --- a/Library/Homebrew/exceptions.rb +++ b/Library/Homebrew/exceptions.rb @@ -44,7 +44,7 @@ class FormulaUnavailableError < RuntimeError end def to_s - if name =~ %r{(\w+)/(\w+)/([^/]+)} then <<-EOS.undent + if name =~ HOMEBREW_TAP_REGEX then <<-EOS.undent No available formula for #$3 #{dependent_s} Please tap it and then try again: brew tap #$1/#$2 EOS diff --git a/Library/Homebrew/global.rb b/Library/Homebrew/global.rb index dc809021d..2345997c0 100644 --- a/Library/Homebrew/global.rb +++ b/Library/Homebrew/global.rb @@ -83,6 +83,11 @@ HOMEBREW_USER_AGENT = "Homebrew #{HOMEBREW_VERSION} (Ruby #{RUBY_VERSION}-#{RUBY HOMEBREW_CURL_ARGS = '-f#LA' +# A regular expession to capture the username (one or more char but no `/`, +# which has to be escaped like `\/`), repository, followed by an optional `/` +# and an optional query. +HOMEBREW_TAP_REGEX = /^([^\/]+)\/([^\/]+)\/?(.+)?$/ + module Homebrew extend self include FileUtils |
