aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils/analytics.sh
diff options
context:
space:
mode:
authorMike McQuaid2016-04-25 18:51:00 -0500
committerMike McQuaid2016-04-25 18:51:00 -0500
commitdf489cfde25b9ea59fdf12c67876a18c13dde4aa (patch)
tree01d2081cf38d49915855f287e3e72a98e6991c46 /Library/Homebrew/utils/analytics.sh
parent421cd5365f50702636632106a81b640331daff23 (diff)
downloadbrew-df489cfde25b9ea59fdf12c67876a18c13dde4aa.tar.bz2
More analytics tweaks.
Provide a single command that can be run to disable analytics, run it if `HOMEBREW_NO_ANALYTICS` is ever set and remove the user UUID file in that case too. References https://github.com/Homebrew/brew/issues/142.
Diffstat (limited to 'Library/Homebrew/utils/analytics.sh')
-rw-r--r--Library/Homebrew/utils/analytics.sh21
1 files changed, 19 insertions, 2 deletions
diff --git a/Library/Homebrew/utils/analytics.sh b/Library/Homebrew/utils/analytics.sh
index b0041a1d8..e851fec92 100644
--- a/Library/Homebrew/utils/analytics.sh
+++ b/Library/Homebrew/utils/analytics.sh
@@ -1,9 +1,26 @@
setup-analytics() {
- [[ -n "$HOMEBREW_NO_ANALYTICS" ]] && return
-
# User UUID file. Used for Homebrew user counting. Can be deleted and
# recreated with no adverse effect (beyond our user counts being inflated).
HOMEBREW_ANALYTICS_USER_UUID_FILE="$HOME/.homebrew_analytics_user_uuid"
+
+ if [[ -n "$HOMEBREW_NO_ANALYTICS" ]]
+ then
+ rm -f "$HOMEBREW_ANALYTICS_USER_UUID_FILE"
+ git config --file="$HOMEBREW_REPOSITORY/.git/config" --replace-all homebrew.analyticsdisabled true
+ fi
+
+ if [[ "$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsmessage)" != "true" ]]
+ then
+ export HOMEBREW_NO_ANALYTICS="1"
+ return
+ fi
+
+ if [[ "$(git config --file="$HOMEBREW_REPOSITORY/.git/config" --get homebrew.analyticsdisabled)" = "true" ]]
+ then
+ export HOMEBREW_NO_ANALYTICS="1"
+ return
+ fi
+
if [[ -r "$HOMEBREW_ANALYTICS_USER_UUID_FILE" ]]
then
HOMEBREW_ANALYTICS_USER_UUID="$(<"$HOMEBREW_ANALYTICS_USER_UUID_FILE")"