Fix analytics handling when core/cask taps are untapped
This commit is contained in:
parent
f2c9db2626
commit
7ef0c48362
@ -110,7 +110,9 @@ module Cask
|
||||
|
||||
install_artifacts
|
||||
|
||||
::Utils::Analytics.report_event("cask_install", @cask.token, on_request: true) unless @cask.tap&.private?
|
||||
if @cask.tap&.should_report_analytics?
|
||||
::Utils::Analytics.report_event("cask_install", @cask.token, on_request: true)
|
||||
end
|
||||
|
||||
purge_backed_up_versioned_files
|
||||
|
||||
|
||||
@ -414,7 +414,7 @@ class FormulaInstaller
|
||||
options = display_options(formula).join(" ")
|
||||
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip if show_header?
|
||||
|
||||
if formula.tap&.installed? && !formula.tap&.private?
|
||||
if formula.tap&.should_report_analytics?
|
||||
action = "#{formula.full_name} #{options}".strip
|
||||
Utils::Analytics.report_event("install", action, on_request: installed_on_request?)
|
||||
end
|
||||
|
||||
@ -670,6 +670,13 @@ class Tap
|
||||
@pypi_formula_mappings = read_formula_list path/HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS
|
||||
end
|
||||
|
||||
# @private
|
||||
def should_report_analytics?
|
||||
return Homebrew::EnvConfig.install_from_api? && official? unless installed?
|
||||
|
||||
!private?
|
||||
end
|
||||
|
||||
def ==(other)
|
||||
other = Tap.fetch(other) if other.is_a?(String)
|
||||
self.class == other.class && name == other.name
|
||||
|
||||
@ -144,8 +144,7 @@ module Utils
|
||||
|
||||
def report_build_error(exception)
|
||||
return unless exception.formula.tap
|
||||
return unless exception.formula.tap.installed?
|
||||
return if exception.formula.tap.private?
|
||||
return unless exception.formula.tap.should_report_analytics?
|
||||
|
||||
action = exception.formula.full_name
|
||||
if (options = exception.options.to_a.map(&:to_s).join(" ").presence)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user