aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMax Howell2012-03-18 01:23:01 +0000
committerMax Howell2012-03-18 01:23:01 +0000
commit88604e1bb1ec71b0c6e1b88bfbab7f3382277723 (patch)
treec39b6d903dd87aad9911e593818887955d0568bb /Library/Homebrew/cmd
parentd388c4386335390d1c57dc1f9857bbf373781f18 (diff)
downloadbrew-88604e1bb1ec71b0c6e1b88bfbab7f3382277723.tar.bz2
Handle when formula are deleted from taps
The symlinks in Formula must be updated.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/update.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb
index 7939136a5..aacd68fc5 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