Merge pull request #20046 from Homebrew/internal-api-switch
Add undocumented `HOMEBREW_USE_INTERNAL_API` switch
This commit is contained in:
commit
0b67caf718
@ -12,6 +12,13 @@ module Homebrew
|
||||
|
||||
DEFAULT_API_FILENAME = "cask.jws.json"
|
||||
|
||||
sig { returns(String) }
|
||||
def self.api_filename
|
||||
return DEFAULT_API_FILENAME unless ENV.fetch("HOMEBREW_USE_INTERNAL_API", false)
|
||||
|
||||
"cask.#{SimulateSystem.current_tag}.jws.json"
|
||||
end
|
||||
|
||||
private_class_method :cache
|
||||
|
||||
sig { params(token: String).returns(Hash) }
|
||||
@ -41,12 +48,12 @@ module Homebrew
|
||||
end
|
||||
|
||||
def self.cached_json_file_path
|
||||
HOMEBREW_CACHE_API/DEFAULT_API_FILENAME
|
||||
HOMEBREW_CACHE_API/api_filename
|
||||
end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def self.download_and_cache_data!
|
||||
json_casks, updated = Homebrew::API.fetch_json_api_file DEFAULT_API_FILENAME
|
||||
json_casks, updated = Homebrew::API.fetch_json_api_file api_filename
|
||||
|
||||
cache["renames"] = {}
|
||||
cache["casks"] = json_casks.to_h do |json_cask|
|
||||
|
@ -12,6 +12,13 @@ module Homebrew
|
||||
|
||||
DEFAULT_API_FILENAME = "formula.jws.json"
|
||||
|
||||
sig { returns(String) }
|
||||
def self.api_filename
|
||||
return DEFAULT_API_FILENAME unless ENV.fetch("HOMEBREW_USE_INTERNAL_API", false)
|
||||
|
||||
"internal/formula.#{SimulateSystem.current_tag}.jws.json"
|
||||
end
|
||||
|
||||
private_class_method :cache
|
||||
|
||||
sig { params(name: String).returns(T::Hash[String, T.untyped]) }
|
||||
@ -42,12 +49,12 @@ module Homebrew
|
||||
|
||||
sig { returns(Pathname) }
|
||||
def self.cached_json_file_path
|
||||
HOMEBREW_CACHE_API/DEFAULT_API_FILENAME
|
||||
HOMEBREW_CACHE_API/api_filename
|
||||
end
|
||||
|
||||
sig { returns(T::Boolean) }
|
||||
def self.download_and_cache_data!
|
||||
json_formulae, updated = Homebrew::API.fetch_json_api_file DEFAULT_API_FILENAME
|
||||
json_formulae, updated = Homebrew::API.fetch_json_api_file api_filename
|
||||
|
||||
cache["aliases"] = {}
|
||||
cache["renames"] = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user