From 48950f2cc07d74a52411cf1fe8674409736291ab Mon Sep 17 00:00:00 2001 From: Xu Cheng Date: Wed, 2 Dec 2015 14:35:42 +0800 Subject: centralize the logic of handling `homebrew-` in Tap.fetch Closes Homebrew/homebrew#46537. Signed-off-by: Xu Cheng --- Library/Homebrew/cmd/info.rb | 2 +- Library/Homebrew/cmd/install.rb | 4 +--- Library/Homebrew/cmd/update.rb | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) (limited to 'Library/Homebrew/cmd') diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb index da50fe5d2..68e4c5425 100644 --- a/Library/Homebrew/cmd/info.rb +++ b/Library/Homebrew/cmd/info.rb @@ -69,7 +69,7 @@ module Homebrew def github_info(f) if f.tap? user, repo = f.tap.split("/", 2) - tap = Tap.fetch user, repo.gsub(/^homebrew-/, "") + tap = Tap.fetch user, repo if remote = tap.remote path = f.path.relative_path_from(tap.path) github_remote_path(remote, path) diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index a1e13d9e6..7afa3462d 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -16,9 +16,7 @@ module Homebrew ARGV.named.each do |name| if !File.exist?(name) && (name !~ HOMEBREW_CORE_FORMULA_REGEX) \ && (name =~ HOMEBREW_TAP_FORMULA_REGEX || name =~ HOMEBREW_CASK_TAP_FORMULA_REGEX) - user = $1 - repo = $2.sub(/^homebrew-/, "") - tap = Tap.fetch(user, repo) + tap = Tap.fetch($1, $2) tap.install unless tap.installed? end end unless ARGV.force? diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 504d4115b..10b4da661 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -403,10 +403,8 @@ class Report fetch(:D, []).each do |path| case path.to_s when HOMEBREW_TAP_PATH_REGEX - user = $1 - repo = $2.sub("homebrew-", "") oldname = path.basename(".rb").to_s - next unless newname = Tap.fetch(user, repo).formula_renames[oldname] + next unless newname = Tap.fetch($1, $2).formula_renames[oldname] else oldname = path.basename(".rb").to_s next unless newname = FORMULA_RENAMES[oldname] @@ -427,7 +425,7 @@ class Report def select_formula(key) fetch(key, []).map do |path, newpath| if path.to_s =~ HOMEBREW_TAP_PATH_REGEX - tap = "#{$1}/#{$2.sub("homebrew-", "")}" + tap = Tap.fetch($1, $2) if newpath ["#{tap}/#{path.basename(".rb")}", "#{tap}/#{newpath.basename(".rb")}"] else -- cgit v1.2.3