Handle when formula are deleted from taps
The symlinks in Formula must be updated.
This commit is contained in:
parent
d388c43863
commit
88604e1bb1
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user