diff options
| author | Jack Nagel | 2013-05-22 22:26:09 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-05-22 22:30:38 -0500 |
| commit | 3755b33a97bf45f3505c4d9fb6f86a06643b35b1 (patch) | |
| tree | da7e2fa322bdb97faac829d6da6977608ded6468 /Library/Homebrew/cmd | |
| parent | b2ff6e934bad87aaa4a8f4f7d3bc66fa87e8e72b (diff) | |
| download | brew-3755b33a97bf45f3505c4d9fb6f86a06643b35b1.tar.bz2 | |
Refactor Xcode/CLT version checks
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 49 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/install.rb | 2 |
2 files changed, 28 insertions, 23 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 2276f1c4a..0ba3ef999 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -215,33 +215,38 @@ def check_for_broken_symlinks end end -def check_for_latest_xcode - if not MacOS::Xcode.installed? - if MacOS.version >= 10.7 - if not MacOS::CLT.installed? - <<-EOS.undent - No developer tools installed - You should install the Command Line Tools: http://connect.apple.com - EOS - elsif not MacOS::CLT.latest_version? - <<-EOS.undent - A newer Command Line Tools for Xcode release is available - You should install the latest version from: http://connect.apple.com - EOS - end - else - <<-EOS.undent - Xcode not installed - Most stuff needs Xcode to build: http://developer.apple.com/xcode/ - EOS - end - elsif MacOS::Xcode.version < MacOS::Xcode.latest_version then <<-EOS.undent +def check_xcode_clt + if MacOS::Xcode.installed? + __check_xcode_up_to_date + elsif MacOS.version >= 10.7 + __check_clt_up_to_date + else <<-EOS.undent + Xcode not installed + Most stuff needs Xcode to build: http://developer.apple.com/xcode/ + EOS + end +end + +def __check_xcode_up_to_date + if MacOS::Xcode.outdated? then <<-EOS.undent Your Xcode (#{MacOS::Xcode.version}) is outdated Please install Xcode #{MacOS::Xcode.latest_version}. EOS end end +def __check_clt_up_to_date + if not MacOS::CLT.installed? then <<-EOS.undent + No developer tools installed + You should install the Command Line Tools: http://connect.apple.com + EOS + elsif MacOS::CLT.outdated? then <<-EOS.undent + A newer Command Line Tools for Xcode release is available + You should install the latest version from: http://connect.apple.com + EOS + end +end + def check_for_stray_developer_directory # if the uninstaller script isn't there, it's a good guess neither are # any troublesome leftover Xcode files @@ -271,7 +276,7 @@ def check_cc end def check_standard_compilers - return if check_for_latest_xcode # only check if Xcode is up to date + return if check_xcode_clt # only check if Xcode is up to date compiler_status = MacOS.compilers_standard? if not compiler_status and not compiler_status.nil? then <<-EOS.undent Your compilers are different from the standard versions for your Xcode. diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb index f44f67091..c0aa1a2e9 100644 --- a/Library/Homebrew/cmd/install.rb +++ b/Library/Homebrew/cmd/install.rb @@ -42,7 +42,7 @@ module Homebrew extend self def check_xcode require 'cmd/doctor' checks = Checks.new - %w{check_for_latest_xcode check_xcode_license_approved}.each do |check| + %w{check_xcode_clt check_xcode_license_approved}.each do |check| out = checks.send(check) opoo out unless out.nil? end |
