Handle when formula are deleted from taps

The symlinks in Formula must be updated.
This commit is contained in:
Max Howell 2012-03-18 01:23:01 +00:00
parent d388c43863
commit 88604e1bb1

View File

@ -1,4 +1,5 @@
require 'cmd/tap' require 'cmd/tap'
require 'cmd/untap'
module Homebrew extend self module Homebrew extend self
@ -26,6 +27,9 @@ module Homebrew extend self
end end
end 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) Homebrew.link_tap_formula(report.new_tapped_formula)
if report.empty? if report.empty?
@ -121,19 +125,27 @@ class Report < Hash
# dump_deleted_commands # dump_deleted_commands
end end
def new_tapped_formula def tapped_formula_for key
fetch(:A, []).map do |path| fetch(key, []).map do |path|
case path when %r{^Library/Taps(/\w+-\w+/.*)} case path when %r{^Library/Taps/(\w+-\w+/.*)}
Pathname.new($1) Pathname.new($1)
end end
end.compact end.compact
end end
def new_tapped_formula
tapped_formula_for :A
end
def removed_tapped_formula
tapped_formula_for :D
end
def select_formula key def select_formula key
fetch(key, []).map do |path| fetch(key, []).map do |path|
case path when %r{^Library/Formula} case path when %r{^Library/Formula}
File.basename(path, ".rb") File.basename(path, ".rb")
when %r{^Library/Taps/(\w+)-(\w+)/(.*)} when %r{^Library/Taps/(\w+)-(\w+)/(.*)\.rb}
"#$1/#$2/#{File.basename(path, '.rb')}" "#$1/#$2/#{File.basename(path, '.rb')}"
end end
end.compact.sort end.compact.sort