aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorAlex Dunn2015-05-15 12:06:15 -0700
committerMike McQuaid2015-07-11 14:36:05 +0100
commitac6ee129949ab33014ec779a1e8a26d1d4de52f8 (patch)
treea312a112f5b03a65d6fc6d9b5564b07d353e8340 /Library/Homebrew/cmd
parentdfbc2df09fc46c239fa099ef18507a498379c820 (diff)
downloadbrew-ac6ee129949ab33014ec779a1e8a26d1d4de52f8.tar.bz2
cmd/install: check time of last update if FormulaUnavailableError
Closes Homebrew/homebrew#40035. Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/install.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index 7f685b706..eafc5fd2c 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -91,6 +91,16 @@ module Homebrew
puts_columns(search_formulae(query))
puts "Searching taps..."
puts_columns(search_taps(query))
+
+ # If they haven't updated in 48 hours (172800 seconds), that
+ # might explain the error
+ master = HOMEBREW_REPOSITORY.join(".git", "refs", "heads", "master")
+ if master.exist? && (Time.now.to_i - File.mtime(master).to_i) > 172800
+ ohai "You haven't updated Homebrew in a while."
+ puts <<-EOS.undent
+ A formula for #{e.name} might have been added recently: run `brew update` to make sure everything's up-to-date!
+ EOS
+ end
end
end
end