aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorAdam Vandenberg2010-07-09 07:13:19 -0700
committerAdam Vandenberg2010-07-09 07:15:28 -0700
commite66f6435e071a7b4ca4f177ec74b31922fa5769e (patch)
tree8db0cbd9f89fae9a57cf12f4afab19df8d9b7136 /Library
parentbf80ab14f9e317d076daee5a8af77609f4acef06 (diff)
downloadhomebrew-e66f6435e071a7b4ca4f177ec74b31922fa5769e.tar.bz2
`brew doctor` and GitDownloadStrategy now check for Git.
GitDownloadStrategy now fails if git isn't in the path, same as other VCS strategies. `brew doctor` will also warn if Git isn't installed.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/brew_doctor.rb21
-rw-r--r--Library/Homebrew/download_strategy.rb4
2 files changed, 23 insertions, 2 deletions
diff --git a/Library/Homebrew/brew_doctor.rb b/Library/Homebrew/brew_doctor.rb
index e95cb9198..9af1f4381 100644
--- a/Library/Homebrew/brew_doctor.rb
+++ b/Library/Homebrew/brew_doctor.rb
@@ -229,7 +229,7 @@ def check_user_path
end
def check_which_pkg_config
- binary = `which pkg-config`.chomp
+ binary = `/usr/bin/which pkg-config`.chomp
return if binary.empty?
unless binary == "#{HOMEBREW_PREFIX}/bin/pkg-config"
@@ -245,7 +245,7 @@ def check_which_pkg_config
end
def check_pkg_config_paths
- binary = `which pkg-config`.chomp
+ binary = `/usr/bin/which pkg-config`.chomp
return if binary.empty?
# Use the debug output to determine which paths are searched
@@ -378,6 +378,22 @@ def check_for_multiple_volumes
end
end
+def check_for_git
+ git = `/usr/bin/which git`.chomp
+ if git.empty?
+ puts <<-EOS.undent
+ "Git" was not found in your path.
+
+ Homebrew uses Git for several internal functions, and some formulae
+ (Erlang in particular) use Git checkouts instead of stable tarballs.
+
+ You may want to do:
+ brew install git
+
+ EOS
+ end
+end
+
def brew_doctor
read, write = IO.pipe
@@ -401,6 +417,7 @@ def brew_doctor
check_for_dyld_vars
check_for_symlinked_cellar
check_for_multiple_volumes
+ check_for_git
exit! 0
else
diff --git a/Library/Homebrew/download_strategy.rb b/Library/Homebrew/download_strategy.rb
index 75ae64c1e..a735f0279 100644
--- a/Library/Homebrew/download_strategy.rb
+++ b/Library/Homebrew/download_strategy.rb
@@ -236,6 +236,10 @@ class GitDownloadStrategy <AbstractDownloadStrategy
end
def fetch
+ raise "You must install Git:\n\n"+
+ " brew install git\n" \
+ unless system "/usr/bin/which git"
+
ohai "Cloning #{@url}"
unless @clone.exist?
safe_system 'git', 'clone', @url, @clone # indeed, leave it verbose