update-report: solicit donations.

This message will only be displayed once.

Fixes #4644.
This commit is contained in:
Mike McQuaid 2018-08-14 13:19:37 +01:00
parent 3e890c11ad
commit b45b716a2e

View File

@ -20,12 +20,14 @@ module Homebrew
def update_report def update_report
HOMEBREW_REPOSITORY.cd do HOMEBREW_REPOSITORY.cd do
analytics_message_displayed = \ analytics_message_displayed =
Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsmessage").chuzzle Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsmessage").chuzzle
analytics_disabled = \ analytics_disabled =
Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsdisabled").chuzzle Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsdisabled").chuzzle
if analytics_message_displayed != "true" && analytics_disabled != "true" && if analytics_message_displayed != "true" &&
!ENV["HOMEBREW_NO_ANALYTICS"] && !ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"] analytics_disabled != "true" &&
!ENV["HOMEBREW_NO_ANALYTICS"] &&
!ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"]
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
# Use the shell's audible bell. # Use the shell's audible bell.
print "\a" print "\a"
@ -43,6 +45,18 @@ module Homebrew
safe_system "git", "config", "--local", "--replace-all", "homebrew.analyticsmessage", "true" safe_system "git", "config", "--local", "--replace-all", "homebrew.analyticsmessage", "true"
end end
end end
donation_message_displayed =
Utils.popen_read("git", "config", "--local", "--get", "homebrew.donationmessage").chuzzle
if donation_message_displayed != "true"
ohai "Homebrew is run entirely by unpaid volunteers. Please consider donating:"
puts " #{Formatter.url("https://github.com/Homebrew/brew#donations")}\n"
# Consider the message possibly missed if not a TTY.
if $stdout.tty?
safe_system "git", "config", "--local", "--replace-all", "homebrew.donationmessage", "true"
end
end
end end
install_core_tap_if_necessary install_core_tap_if_necessary