Merge pull request #14635 from Bo98/api-analytics
This commit is contained in:
commit
56adf8cd3d
@ -110,7 +110,9 @@ module Cask
|
|||||||
|
|
||||||
install_artifacts
|
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
|
purge_backed_up_versioned_files
|
||||||
|
|
||||||
|
|||||||
@ -414,7 +414,7 @@ class FormulaInstaller
|
|||||||
options = display_options(formula).join(" ")
|
options = display_options(formula).join(" ")
|
||||||
oh1 "Installing #{Formatter.identifier(formula.full_name)} #{options}".strip if show_header?
|
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
|
action = "#{formula.full_name} #{options}".strip
|
||||||
Utils::Analytics.report_event("install", action, on_request: installed_on_request?)
|
Utils::Analytics.report_event("install", action, on_request: installed_on_request?)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -670,6 +670,13 @@ class Tap
|
|||||||
@pypi_formula_mappings = read_formula_list path/HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS
|
@pypi_formula_mappings = read_formula_list path/HOMEBREW_TAP_PYPI_FORMULA_MAPPINGS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# @private
|
||||||
|
def should_report_analytics?
|
||||||
|
return Homebrew::EnvConfig.install_from_api? && official? unless installed?
|
||||||
|
|
||||||
|
!private?
|
||||||
|
end
|
||||||
|
|
||||||
def ==(other)
|
def ==(other)
|
||||||
other = Tap.fetch(other) if other.is_a?(String)
|
other = Tap.fetch(other) if other.is_a?(String)
|
||||||
self.class == other.class && name == other.name
|
self.class == other.class && name == other.name
|
||||||
|
|||||||
@ -144,8 +144,7 @@ module Utils
|
|||||||
|
|
||||||
def report_build_error(exception)
|
def report_build_error(exception)
|
||||||
return unless exception.formula.tap
|
return unless exception.formula.tap
|
||||||
return unless exception.formula.tap.installed?
|
return unless exception.formula.tap.should_report_analytics?
|
||||||
return if exception.formula.tap.private?
|
|
||||||
|
|
||||||
action = exception.formula.full_name
|
action = exception.formula.full_name
|
||||||
if (options = exception.options.to_a.map(&:to_s).join(" ").presence)
|
if (options = exception.options.to_a.map(&:to_s).join(" ").presence)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user