Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix (again) InfluxDB analytics messaging #15695

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
27 changes: 12 additions & 15 deletions Library/Homebrew/cmd/update-report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -329,10 +329,16 @@
end

def analytics_message
if !Utils::Analytics.messages_displayed? &&
!Utils::Analytics.disabled? &&
!Utils::Analytics.no_message_output?
return if Utils::Analytics.messages_displayed?
return if Utils::Analytics.no_message_output?

if Utils::Analytics.disabled? && !Utils::Analytics.influx_message_displayed?

Check warning on line 335 in Library/Homebrew/cmd/update-report.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/update-report.rb#L335

Added line #L335 was not covered by tests
ohai "Homebrew's analytics have entirely moved to our InfluxDB instance in the EU."
puts "We gather less data than before and have destroyed all Google Analytics data:"
puts " #{Formatter.url("https://docs.brew.sh/Analytics")}#{Tty.reset}"
puts "Please reconsider re-enabling analytics to help our volunteer maintainers with:"
puts " brew analytics on"

Check warning on line 340 in Library/Homebrew/cmd/update-report.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/cmd/update-report.rb#L337-L340

Added lines #L337 - L340 were not covered by tests
elsif !Utils::Analytics.disabled?
ENV["HOMEBREW_NO_ANALYTICS_THIS_RUN"] = "1"
# Use the shell's audible bell.
print "\a"
Expand All @@ -345,19 +351,10 @@
No analytics have been recorded yet (nor will be during this `brew` run).

EOS

# Consider the messages possibly missed if not a TTY.
Utils::Analytics.messages_displayed! if $stdout.tty?
elsif Utils::Analytics.disabled?
ohai "Homebrew's analytics have entirely moved to our InfluxDB instance in the EU."
puts "We gather less data than before and have destroyed all Google Analytics data:"
puts " #{Formatter.url("https://docs.brew.sh/Analytics")}#{Tty.reset}"
puts "Please reconsider re-enabling analytics to help our volunteer maintainers with:"
puts " brew analytics on"

# Consider the message possibly missed if not a TTY.
Settings.write "influxanalyticsmessage", true if $stdout.tty?
end

# Consider the messages possibly missed if not a TTY.
Utils::Analytics.messages_displayed! if $stdout.tty?
end

def donation_message
Expand Down
6 changes: 5 additions & 1 deletion Library/Homebrew/utils/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,14 @@
report_influx_event(:build_error, package_name: formula.name, tap_name: tap.name, options: options)
end

def influx_message_displayed?
config_true?(:influxanalyticsmessage)

Check warning on line 112 in Library/Homebrew/utils/analytics.rb

View check run for this annotation

Codecov / codecov/patch

Library/Homebrew/utils/analytics.rb#L112

Added line #L112 was not covered by tests
end

def messages_displayed?
config_true?(:analyticsmessage) &&
config_true?(:caskanalyticsmessage) &&
config_true?(:influxanalyticsmessage)
influx_message_displayed?
end

def disabled?
Expand Down