info: show Linux formulae details and analytics
- This makes use of the new /api/formula-linux and /api/analytics-linux endpoints in formulae.brew.sh to give Linux users up to date formula and analytics info for their installed core formulae. Before, on Linux, the macOS stats for the `ack` formula: ``` $ brew info ack [...] ==> Analytics install: 12,422 (30 days), 32,742 (90 days), 97,788 (365 days) install_on_request: 10,778 (30 days), 28,339 (90 days), 85,202 (365 days) build_error: 0 (30 days) ``` Now, on Linux, the Linux stats for the `ack` formula: ``` $ brew info ack [...] ==> Analytics install: 95 (30 days), 242 (90 days), 737 (365 days) install_on_request: 94 (30 days), 241 (90 days), 734 (365 days) build_error: 0 (30 days) ```
This commit is contained in:
parent
28635a7fe4
commit
727f9671c7
@ -368,7 +368,7 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
|
|
||||||
def output_formula_analytics(f)
|
def output_formula_analytics(f)
|
||||||
json = formulae_api_json("formula/#{f}.json")
|
json = formulae_api_json("#{formula_path}/#{f}.json")
|
||||||
return if json.blank? || json["analytics"].blank?
|
return if json.blank? || json["analytics"].blank?
|
||||||
|
|
||||||
full_analytics = args.analytics? || args.verbose?
|
full_analytics = args.analytics? || args.verbose?
|
||||||
@ -431,4 +431,16 @@ module Homebrew
|
|||||||
def format_percent(percent)
|
def format_percent(percent)
|
||||||
format("%<percent>.2f", percent: percent)
|
format("%<percent>.2f", percent: percent)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def formula_path
|
||||||
|
"formula"
|
||||||
|
end
|
||||||
|
alias_method :generic_formula_path, :formula_path
|
||||||
|
|
||||||
|
def analytics_path
|
||||||
|
"analytics"
|
||||||
|
end
|
||||||
|
alias_method :generic_analytics_path, :analytics_path
|
||||||
|
|
||||||
|
require "extend/os/cmd/info"
|
||||||
end
|
end
|
||||||
|
|||||||
3
Library/Homebrew/extend/os/cmd/info.rb
Normal file
3
Library/Homebrew/extend/os/cmd/info.rb
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require "extend/os/linux/info" if OS.linux?
|
||||||
17
Library/Homebrew/extend/os/linux/info.rb
Normal file
17
Library/Homebrew/extend/os/linux/info.rb
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Homebrew
|
||||||
|
module_function
|
||||||
|
|
||||||
|
def formula_path
|
||||||
|
return generic_formula_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
|
||||||
|
|
||||||
|
"formula-linux"
|
||||||
|
end
|
||||||
|
|
||||||
|
def analytics_path
|
||||||
|
return generic_analytics_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"]
|
||||||
|
|
||||||
|
"analytics-linux"
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
x
Reference in New Issue
Block a user