doctor: combine git existence and version checks

This commit is contained in:
Jack Nagel 2013-05-26 17:48:12 -05:00
parent 68b3e6f3fb
commit 255c6e7c3f

View File

@ -687,8 +687,22 @@ def check_filesystem_case_sensitive
EOS EOS
end end
def __check_git_version
# https://help.github.com/articles/https-cloning-errors
`git --version`.chomp =~ /git version ((?:\d+\.?)+)/
if Version.new($1) < Version.new("1.7.10") then <<-EOS.undent
An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git
EOS
end
end
def check_for_git def check_for_git
unless which "git" then <<-EOS.undent if which "git"
__check_git_version
else <<-EOS.undent
Git could not be found in your PATH. Git could not be found in your PATH.
Homebrew uses Git for several internal functions, and some formulae use Git Homebrew uses Git for several internal functions, and some formulae use Git
checkouts instead of stable tarballs. You may want to install Git: checkouts instead of stable tarballs. You may want to install Git:
@ -902,20 +916,6 @@ def check_for_leopard_ssl
end end
end end
def check_git_version
# https://help.github.com/articles/https-cloning-errors
return unless which "git"
`git --version`.chomp =~ /git version ((?:\d+\.?)+)/
if Version.new($1) < Version.new("1.7.10") then <<-EOS.undent
An outdated version of Git was detected in your PATH.
Git 1.7.10 or newer is required to perform checkouts over HTTPS from GitHub.
Please upgrade: brew upgrade git
EOS
end
end
def check_for_enthought_python def check_for_enthought_python
if which "enpkg" then <<-EOS.undent if which "enpkg" then <<-EOS.undent
Enthought Python was found in your PATH. Enthought Python was found in your PATH.