Doctor check for unlinked not-keg-only brews

Since these cause trouble.
This commit is contained in:
Max Howell 2012-03-09 11:36:34 +00:00
parent 7280590e88
commit 15f3e9ea77

View File

@ -842,6 +842,25 @@ def check_for_outdated_homebrew
end
end
def check_for_unlinked_but_not_keg_only
unlinked = HOMEBREW_CELLAR.children.reject do |rack|
if not (HOMEBREW_REPOSITORY/"Library/LinkedKegs"/rack.basename).directory?
Formula.factory(rack.basename).keg_only? rescue nil
else
true
end
end.map{ |pn| pn.basename }
if not unlinked.empty? then <<-EOS.undent
You have unlinked kegs in your Cellar
Leaving kegs unlinked can lead to build-trouble and cause brews that depend on
those kegs to fail to run properly once built.
#{unlinked * "\n "}
EOS
end
end
end # end class Checks
module Homebrew extend self