blob: 4e439fa0a30cda47b0cc168669b45947ad77b086 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
#: * `doctor`:
#: Check your system for potential problems. Doctor exits with a non-zero status
#: if any potential problems are found. Please note that these warnings are just
#: used to help the Homebrew maintainers with debugging if you file an issue. If
#: everything you use Homebrew for is working fine: please don't worry or file
#: an issue; just ignore this.
# Undocumented options:
# `-D` activates debugging and profiling of the audit methods (not the same as `--debug`)
# `--list-checks` lists all audit methods
require "diagnostic"
module Homebrew
module_function
def doctor
inject_dump_stats!(Diagnostic::Checks, /^check_*/) if ARGV.switch? "D"
checks = Diagnostic::Checks.new
if ARGV.include? "--list-checks"
puts checks.all.sort
exit
end
if ARGV.named.empty?
slow_checks = %w[
check_for_broken_symlinks
check_missing_deps
check_for_linked_keg_only_brews
]
methods = (checks.all.sort - slow_checks) + slow_checks
else
methods = ARGV.named
end
first_warning = true
methods.each do |method|
$stderr.puts "Checking #{method}" if ARGV.debug?
unless checks.respond_to?(method)
Homebrew.failed = true
puts "No check available by the name: #{method}"
next
end
out = checks.send(method)
next if out.nil? || out.empty?
if first_warning
$stderr.puts <<~EOS
#{Tty.bold}Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!#{Tty.reset}
EOS
end
$stderr.puts
opoo out
Homebrew.failed = true
first_warning = false
end
puts "Your system is ready to brew." unless Homebrew.failed?
end
end
|