Merge pull request #10581 from Bo98/update-report-outdated
cmd/update-report: report outdated count & suggest `brew upgrade`
This commit is contained in:
commit
effe4ac5b0
@ -136,8 +136,28 @@ module Homebrew
|
|||||||
DescriptionCacheStore.new(db)
|
DescriptionCacheStore.new(db)
|
||||||
.update_from_report!(hub)
|
.update_from_report!(hub)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
unless args.preinstall?
|
||||||
|
outdated_formulae = Formula.installed.count(&:outdated?)
|
||||||
|
outdated_casks = Cask::Caskroom.casks.count(&:outdated?)
|
||||||
|
msg = ""
|
||||||
|
if outdated_formulae.positive?
|
||||||
|
msg += "#{Tty.bold}#{outdated_formulae}#{Tty.reset} outdated #{"formula".pluralize(outdated_formulae)}"
|
||||||
|
end
|
||||||
|
if outdated_casks.positive?
|
||||||
|
msg += " and " if msg.present?
|
||||||
|
msg += "#{Tty.bold}#{outdated_casks}#{Tty.reset} outdated #{"cask".pluralize(outdated_casks)}"
|
||||||
|
end
|
||||||
|
if msg.present?
|
||||||
|
puts_stdout_or_stderr
|
||||||
|
puts_stdout_or_stderr <<~EOS
|
||||||
|
You have #{msg} installed.
|
||||||
|
You can update them with #{Tty.bold}brew upgrade#{Tty.reset}.
|
||||||
|
EOS
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
puts if args.preinstall?
|
puts_stdout_or_stderr if args.preinstall?
|
||||||
elsif !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"]
|
elsif !args.preinstall? && !ENV["HOMEBREW_UPDATE_FAILED"]
|
||||||
puts_stdout_or_stderr "Already up-to-date." unless args.quiet?
|
puts_stdout_or_stderr "Already up-to-date." unless args.quiet?
|
||||||
end
|
end
|
||||||
@ -161,6 +181,7 @@ module Homebrew
|
|||||||
|
|
||||||
return if new_repository_version.blank?
|
return if new_repository_version.blank?
|
||||||
|
|
||||||
|
puts_stdout_or_stderr
|
||||||
ohai_stdout_or_stderr "Homebrew was updated to version #{new_repository_version}"
|
ohai_stdout_or_stderr "Homebrew was updated to version #{new_repository_version}"
|
||||||
if new_repository_version.split(".").last == "0"
|
if new_repository_version.split(".").last == "0"
|
||||||
puts_stdout_or_stderr <<~EOS
|
puts_stdout_or_stderr <<~EOS
|
||||||
|
|||||||
@ -121,6 +121,7 @@ module Kernel
|
|||||||
end
|
end
|
||||||
|
|
||||||
def puts_stdout_or_stderr(*message)
|
def puts_stdout_or_stderr(*message)
|
||||||
|
message = "\n" if message.empty?
|
||||||
if $stdout.tty?
|
if $stdout.tty?
|
||||||
puts(message)
|
puts(message)
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user