Merge pull request #11839 from Rylan12/fix-api-paths
api: fix generic api path functions
This commit is contained in:
commit
764959b73a
@ -7,10 +7,9 @@ module Homebrew
|
|||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
module Analytics
|
module Analytics
|
||||||
|
class << self
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
module_function
|
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def analytics_api_path
|
def analytics_api_path
|
||||||
"analytics"
|
"analytics"
|
||||||
@ -24,5 +23,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
require "extend/os/api/analytics"
|
require "extend/os/api/analytics"
|
||||||
|
|||||||
@ -9,10 +9,9 @@ module Homebrew
|
|||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
module Bottle
|
module Bottle
|
||||||
|
class << self
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
module_function
|
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def bottle_api_path
|
def bottle_api_path
|
||||||
"bottle"
|
"bottle"
|
||||||
@ -67,7 +66,7 @@ module Homebrew
|
|||||||
match[:sha256]
|
match[:sha256]
|
||||||
end
|
end
|
||||||
|
|
||||||
sig { params(hash: Hash, tag: Symbol).void }
|
sig { params(hash: Hash, tag: String).void }
|
||||||
def download_bottle(hash, tag)
|
def download_bottle(hash, tag)
|
||||||
bottle = hash["bottles"][tag]
|
bottle = hash["bottles"][tag]
|
||||||
bottle ||= hash["bottles"]["all"]
|
bottle ||= hash["bottles"]["all"]
|
||||||
@ -91,5 +90,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
require "extend/os/api/bottle"
|
require "extend/os/api/bottle"
|
||||||
|
|||||||
@ -7,10 +7,9 @@ module Homebrew
|
|||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
module Cask
|
module Cask
|
||||||
|
class << self
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
module_function
|
|
||||||
|
|
||||||
sig { params(name: String).returns(Hash) }
|
sig { params(name: String).returns(Hash) }
|
||||||
def fetch(name)
|
def fetch(name)
|
||||||
Homebrew::API.fetch "cask/#{name}.json"
|
Homebrew::API.fetch "cask/#{name}.json"
|
||||||
@ -18,3 +17,4 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@ -7,10 +7,9 @@ module Homebrew
|
|||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
module Formula
|
module Formula
|
||||||
|
class << self
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
module_function
|
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def formula_api_path
|
def formula_api_path
|
||||||
"formula"
|
"formula"
|
||||||
@ -24,5 +23,6 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
require "extend/os/api/formula"
|
require "extend/os/api/formula"
|
||||||
|
|||||||
@ -7,10 +7,9 @@ module Homebrew
|
|||||||
#
|
#
|
||||||
# @api private
|
# @api private
|
||||||
module Versions
|
module Versions
|
||||||
|
class << self
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
module_function
|
|
||||||
|
|
||||||
def formulae
|
def formulae
|
||||||
# The result is cached by Homebrew::API.fetch
|
# The result is cached by Homebrew::API.fetch
|
||||||
Homebrew::API.fetch "versions-formulae.json"
|
Homebrew::API.fetch "versions-formulae.json"
|
||||||
@ -50,3 +49,4 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|||||||
@ -190,7 +190,7 @@ module Utils
|
|||||||
def formula_output(f, args:)
|
def formula_output(f, args:)
|
||||||
return if Homebrew::EnvConfig.no_analytics? || Homebrew::EnvConfig.no_github_api?
|
return if Homebrew::EnvConfig.no_analytics? || Homebrew::EnvConfig.no_github_api?
|
||||||
|
|
||||||
json = Homebrew::API::Formula.fetch f
|
json = Homebrew::API::Formula.fetch f.name
|
||||||
return if json.blank? || json["analytics"].blank?
|
return if json.blank? || json["analytics"].blank?
|
||||||
|
|
||||||
get_analytics(json, args: args)
|
get_analytics(json, args: args)
|
||||||
@ -202,7 +202,7 @@ module Utils
|
|||||||
def cask_output(cask, args:)
|
def cask_output(cask, args:)
|
||||||
return if Homebrew::EnvConfig.no_analytics? || Homebrew::EnvConfig.no_github_api?
|
return if Homebrew::EnvConfig.no_analytics? || Homebrew::EnvConfig.no_github_api?
|
||||||
|
|
||||||
json = Homebrew::API::Cask.fetch cask
|
json = Homebrew::API::Cask.fetch cask.token
|
||||||
return if json.blank? || json["analytics"].blank?
|
return if json.blank? || json["analytics"].blank?
|
||||||
|
|
||||||
get_analytics(json, args: args)
|
get_analytics(json, args: args)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user