aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/tap.rb4
-rw-r--r--Library/Homebrew/cmd/update.rb14
2 files changed, 9 insertions, 9 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb
index b24c70e87..80ebcd81e 100644
--- a/Library/Homebrew/cmd/tap.rb
+++ b/Library/Homebrew/cmd/tap.rb
@@ -107,7 +107,7 @@ module Homebrew extend self
end
def tap_args
- ARGV.first =~ %r{^([\w-]+)/(homebrew-)?([\w-]+)$}
+ ARGV.first =~ HOMEBREW_TAP_ARGS_REGEX
raise "Invalid tap name" unless $1 && $3
[$1, $3]
end
@@ -122,7 +122,7 @@ module Homebrew extend self
def tap_ref(path)
case path.to_s
- when %r{^#{HOMEBREW_LIBRARY}/Taps/([\w-]+)/([\w-]+)/(.+)}
+ when HOMEBREW_TAP_PATH_REGEX
"#$1/#$2/#{File.basename($3, '.rb')}"
when %r{^#{HOMEBREW_LIBRARY}/Formula/(.+)}
"Homebrew/homebrew/#{File.basename($1, '.rb')}"
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 45f8251ba..88804c6cf 100644
--- a/Library/Homebrew/cmd/update.rb
+++ b/Library/Homebrew/cmd/update.rb
@@ -218,9 +218,9 @@ class Report < Hash
def tapped_formula_for key
fetch(key, []).select do |path|
- case path.relative_path_from(HOMEBREW_REPOSITORY).to_s
- when %r{^Library/Taps/([\w-]+/[\w-]+/.*)}
- valid_formula_location?($1)
+ case path.to_s
+ when HOMEBREW_TAP_PATH_REGEX
+ valid_formula_location?("#{$1}/#{$2}/#{$3}")
else
false
end
@@ -247,11 +247,11 @@ class Report < Hash
def select_formula key
fetch(key, []).map do |path|
- case path.relative_path_from(HOMEBREW_REPOSITORY).to_s
- when %r{^Library/Formula}
+ case path.to_s
+ when Regexp.new(HOMEBREW_LIBRARY + "/Formula")
path.basename(".rb").to_s
- when %r{^Library/Taps/([\w-]+)/(homebrew-)?([\w-]+)/(.*)\.rb}
- "#$1/#$3/#{path.basename(".rb")}"
+ when HOMEBREW_TAP_PATH_REGEX
+ "#$1/#{$2.sub("homebrew-", "")}/#{path.basename(".rb")}"
end
end.compact.sort
end