diff options
| author | Max Howell | 2012-08-04 15:06:37 -0400 |
|---|---|---|
| committer | Max Howell | 2012-08-04 15:11:47 -0400 |
| commit | 5eb06b9dc59dc731bddf0a45dff354b02d19f250 (patch) | |
| tree | dbc219f150a67b27c2bb7bdaac3e9de115334174 /Library | |
| parent | 523e21fd6e9cdc1b2d94c6b8e100c620eceaf6c3 (diff) | |
| download | homebrew-5eb06b9dc59dc731bddf0a45dff354b02d19f250.tar.bz2 | |
`brew tap --repair`
Removes dead symlinks in Formula and re-symlinks all Taps.
Closes #11565.
Diffstat (limited to 'Library')
| -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 |
