use Tap#install

This commit is contained in:
Xu Cheng 2015-11-07 16:36:14 +08:00
parent e97610b916
commit 82689d81f7
3 changed files with 11 additions and 8 deletions

View File

@ -16,7 +16,10 @@ 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)
install_tap $1, $2
user = $1
repo = $2.sub(/^homebrew-/, "")
tap = Tap.fetch(user, repo)
tap.install
end
end unless ARGV.force?

View File

@ -82,12 +82,12 @@ module Homebrew
next unless (dir = HOMEBREW_CELLAR/f).exist?
migration = TAP_MIGRATIONS[f]
next unless migration
tap_user, tap_repo = migration.split "/"
install_tap tap_user, tap_repo
tap = Tap.fetch(*migration.split("/"))
tap.install
# update tap for each Tab
tabs = dir.subdirs.map { |d| Tab.for_keg(Keg.new(d)) }
next if tabs.first.source["tap"] != "Homebrew/homebrew"
tabs.each { |tab| tab.source["tap"] = "#{tap_user}/homebrew-#{tap_repo}" }
tabs.each { |tab| tab.source["tap"] = "#{tap.user}/homebrew-#{tap.repo}" }
tabs.each(&:write)
end if load_tap_migrations

View File

@ -8,7 +8,6 @@ require "caveats"
require "cleaner"
require "formula_cellar_checks"
require "install_renamed"
require "cmd/tap"
require "cmd/postinstall"
require "hooks/bottles"
require "debrew"
@ -115,10 +114,11 @@ class FormulaInstaller
begin
formula.recursive_dependencies.map(&:to_formula)
rescue TapFormulaUnavailableError => e
if Homebrew.install_tap(e.user, e.repo)
retry
else
if e.tap.installed?
raise
else
e.tap.install
retry
end
end
rescue FormulaUnavailableError => e