From 88604e1bb1ec71b0c6e1b88bfbab7f3382277723 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sun, 18 Mar 2012 01:23:01 +0000 Subject: [PATCH] Handle when formula are deleted from taps The symlinks in Formula must be updated. --- Library/Homebrew/cmd/update.rb | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 7939136a53..aacd68fc54 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -1,4 +1,5 @@ require 'cmd/tap' +require 'cmd/untap' module Homebrew extend self @@ -26,6 +27,9 @@ module Homebrew extend self end end end + + # we unlink first in case the formula has moved to another tap + Homebrew.unlink_tap_formula(report.removed_tapped_formula) Homebrew.link_tap_formula(report.new_tapped_formula) if report.empty? @@ -121,19 +125,27 @@ class Report < Hash # dump_deleted_commands end - def new_tapped_formula - fetch(:A, []).map do |path| - case path when %r{^Library/Taps(/\w+-\w+/.*)} + def tapped_formula_for key + fetch(key, []).map do |path| + case path when %r{^Library/Taps/(\w+-\w+/.*)} Pathname.new($1) end end.compact end + def new_tapped_formula + tapped_formula_for :A + end + + def removed_tapped_formula + tapped_formula_for :D + end + def select_formula key fetch(key, []).map do |path| case path when %r{^Library/Formula} File.basename(path, ".rb") - when %r{^Library/Taps/(\w+)-(\w+)/(.*)} + when %r{^Library/Taps/(\w+)-(\w+)/(.*)\.rb} "#$1/#$2/#{File.basename(path, '.rb')}" end end.compact.sort