diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb index 82509f1666c2f..43d9d31bc2dc9 100644 --- a/Library/Homebrew/cmd/update-report.rb +++ b/Library/Homebrew/cmd/update-report.rb @@ -20,12 +20,14 @@ def update_preinstall_header def update_report HOMEBREW_REPOSITORY.cd do - analytics_message_displayed = \ + analytics_message_displayed = Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsmessage").chuzzle - analytics_disabled = \ + analytics_disabled = Utils.popen_read("git", "config", "--local", "--get", "homebrew.analyticsdisabled").chuzzle - if analytics_message_displayed != "true" && analytics_disabled != "true" && - !ENV["HOMEBREW_NO_ANALYTICS"] && !ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"] + if analytics_message_displayed != "true" && + analytics_disabled != "true" && + !ENV["HOMEBREW_NO_ANALYTICS"] && + !ENV["HOMEBREW_NO_ANALYTICS_MESSAGE_OUTPUT"] ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1" # Use the shell's audible bell. print "\a" @@ -43,6 +45,18 @@ def update_report safe_system "git", "config", "--local", "--replace-all", "homebrew.analyticsmessage", "true" 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 install_core_tap_if_necessary