aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2012-03-06 18:09:09 +0000
committerMax Howell2012-03-06 20:28:05 +0000
commit9c5ddb5721ec0a676ac3445214c6495aa4e53364 (patch)
treeb924a160bf5c430dcf78e8a4a52fd85c5f50f137 /Library
parentde30a7844f6bf08c040ec81500e9d6d73409e3d6 (diff)
downloadbrew-9c5ddb5721ec0a676ac3445214c6495aa4e53364.tar.bz2
The doctor checks if you need to `brew update`
Well at least it checks to see if it's been a while since the last one.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/doctor.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index ad24bb958..6abadeab5 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -795,6 +795,22 @@ def check_for_bad_python_symlink
end
end
+def check_for_outdated_homebrew
+ HOMEBREW_PREFIX.cd do
+ timestamp = if File.directory? ".git"
+ `git log -1 --format="%ct" HEAD`.to_i
+ else
+ (HOMEBREW_PREFIX/"Library").mtime.to_i
+ end
+
+ if Time.now.to_i - timestamp > 60 * 60 * 24 then <<-EOS.undent
+ Your Homebrew is outdated
+ You haven't updated for at least 24 hours, this is a long time in brewland!
+ EOS
+ end
+ end
+end
+
end # end class Checks
module Homebrew extend self