diff options
| author | Max Howell | 2012-08-04 15:06:37 -0400 |
|---|---|---|
| committer | Max Howell | 2012-08-04 15:11:47 -0400 |
| commit | 28bbced64bbb6874d6fc06d18ca8a9571ed4e4e3 (patch) | |
| tree | b9f10e7463609fe7b690f4489502d6ffdc36db73 /Library/Homebrew/cmd | |
| parent | e8c9a19f65133b0b618e70e538e2881a7df25748 (diff) | |
| download | brew-28bbced64bbb6874d6fc06d18ca8a9571ed4e4e3.tar.bz2 | |
`brew tap --repair`
Removes dead symlinks in Formula and re-symlinks all Taps.
Closes Homebrew/homebrew#11565.
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/tap.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb index f20266195..bdcc8369e 100644 --- a/Library/Homebrew/cmd/tap.rb +++ b/Library/Homebrew/cmd/tap.rb @@ -6,6 +6,8 @@ module Homebrew extend self tapd.children.each do |tap| puts tap.basename.sub('-', '/') if (tap/'.git').directory? end if tapd.directory? + elsif ARGV.first == "--repair" + repair_taps else install_tap(*tap_args) end @@ -58,6 +60,28 @@ module Homebrew extend self tapped end + def repair_taps + count = 0 + # prune dead symlinks in Formula + Dir["#{HOMEBREW_REPOSITORY}/Library/Formula/*.rb"].each do |fn| + if not File.exist? fn + File.delete fn + count += 1 + end + end + puts "Pruned #{count} dead formula" + + count = 0 + # check symlinks are all set in each tap + HOMEBREW_REPOSITORY.join("Library/Taps").children.each do |tap| + files = [] + tap.find_formula{ |file| files << tap.basename.join(file) } + count += link_tap_formula(files) + end + + puts "Tapped #{count} formula" + end + private def tap_args |
