Refactor MacOS check_development_tools usage.

Better use the abstraction layer so e.g. Linux could have similarly
fatal checks for these things.
This commit is contained in:
Mike McQuaid 2016-09-07 09:11:06 +01:00
parent 921aa01576
commit f1cc1265af
3 changed files with 25 additions and 14 deletions

View File

@ -223,14 +223,15 @@ module Homebrew
def check_development_tools def check_development_tools
checks = Diagnostic::Checks.new checks = Diagnostic::Checks.new
checks.all_development_tools_checks.each do |check| all_development_tools_checks = checks.development_tools_checks +
checks.fatal_development_tools_checks
all_development_tools_checks.each do |check|
out = checks.send(check) out = checks.send(check)
opoo out unless out.nil? next if out.nil?
end if checks.fatal_development_tools_checks.include?(check)
if OS.mac? && MacOS.prerelease? odie out
checks.strict_development_tools_checks.each do |strict_check| else
out = checks.send(strict_check) opoo out
odie out unless out.nil?
end end
end end
end end

View File

@ -86,12 +86,17 @@ module Homebrew
end end
############# END HELPERS ############# END HELPERS
def all_development_tools_checks def development_tools_checks
%w[ %w[
check_for_installed_developer_tools check_for_installed_developer_tools
] ]
end end
def fatal_development_tools_checks
%w[
]
end
def check_for_installed_developer_tools def check_for_installed_developer_tools
return if DevelopmentTools.installed? return if DevelopmentTools.installed?

View File

@ -1,7 +1,7 @@
module Homebrew module Homebrew
module Diagnostic module Diagnostic
class Checks class Checks
def all_development_tools_checks def development_tools_checks
%w[ %w[
check_for_unsupported_osx check_for_unsupported_osx
check_for_prerelease_xcode check_for_prerelease_xcode
@ -12,11 +12,16 @@ module Homebrew
] ]
end end
def strict_development_tools_checks def fatal_development_tools_checks
%w[ if MacOS.prerelease?
check_xcode_up_to_date %w[
check_clt_up_to_date check_xcode_up_to_date
] check_clt_up_to_date
]
else
%w[
]
end
end end
def check_for_unsupported_osx def check_for_unsupported_osx