From 9c5ddb5721ec0a676ac3445214c6495aa4e53364 Mon Sep 17 00:00:00 2001 From: Max Howell Date: Tue, 6 Mar 2012 18:09:09 +0000 Subject: 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. --- Library/Homebrew/cmd/doctor.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'Library') 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 -- cgit v1.2.3