aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2016-04-25 18:05:30 -0500
committerMike McQuaid2016-04-25 18:05:30 -0500
commit421cd5365f50702636632106a81b640331daff23 (patch)
treeae35c33d76ea2ced3571887011d484d927000366 /Library
parent663f51b88eb2f380eca25e21d11df13681bcdc22 (diff)
downloadbrew-421cd5365f50702636632106a81b640331daff23.tar.bz2
Point to analytics documentation on brew update.
Make sure that users are notified on the first run of `brew update` after we enabled analytics about how it works and how to opt-out. This will be shown to all users who have not already seen this message from `brew update` or through a new Homebrew installation. References https://github.com/Homebrew/install/pull/42 References https://github.com/Homebrew/brew/issues/142
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/update-report.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/update-report.rb b/Library/Homebrew/cmd/update-report.rb
index 4d3b280f9..55b7bdd27 100644
--- a/Library/Homebrew/cmd/update-report.rb
+++ b/Library/Homebrew/cmd/update-report.rb
@@ -12,6 +12,23 @@ module Homebrew
end
def update_report
+ HOMEBREW_REPOSITORY.cd do
+ key = "homebrew.analyticsmessage"
+ analytics_message_displayed = \
+ Utils.popen_read("git", "config", "--local", "--get", key).chuzzle
+ unless analytics_message_displayed == "true"
+ ENV["HOMEBREW_NO_ANALYTICS"] = "1"
+ ohai "Homebrew has enabled anonymous aggregate user behaviour analytics"
+ puts "Read the analytics documentation (and how to opt-out) here:"
+ puts " https://git.io/brew-analytics"
+
+ # Consider the message possibly missed if not a TTY.
+ if $stdout.tty?
+ safe_system "git", "config", "--local", "--replace-all", key, "true"
+ end
+ end
+ end
+
install_core_tap_if_necessary
hub = ReporterHub.new