Rename API filename constants

This commit is contained in:
Rylan Polster 2024-07-04 12:08:01 -04:00
parent 6ecdad7379
commit b5f99d78f4
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64
2 changed files with 9 additions and 9 deletions

View File

@ -10,7 +10,7 @@ module Homebrew
module Cask module Cask
extend Cachable extend Cachable
DEFAULT_API_ENDPOINT = "cask.jws.json" DEFAULT_API_FILENAME = "cask.jws.json"
private_class_method :cache private_class_method :cache
@ -41,12 +41,12 @@ module Homebrew
end end
def self.cached_json_file_path def self.cached_json_file_path
HOMEBREW_CACHE_API/DEFAULT_API_ENDPOINT HOMEBREW_CACHE_API/DEFAULT_API_FILENAME
end end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def self.download_and_cache_data! def self.download_and_cache_data!
json_casks, updated = Homebrew::API.fetch_json_api_file "cask.jws.json" json_casks, updated = Homebrew::API.fetch_json_api_file DEFAULT_API_FILENAME
cache["renames"] = {} cache["renames"] = {}
cache["casks"] = json_casks.to_h do |json_cask| cache["casks"] = json_casks.to_h do |json_cask|

View File

@ -10,8 +10,8 @@ module Homebrew
module Formula module Formula
extend Cachable extend Cachable
DEFAULT_API_ENDPOINT = "formula.jws.json" DEFAULT_API_FILENAME = "formula.jws.json"
INTERNAL_V3_API_ENDPOINT = "internal/v3/homebrew-core.jws.json" INTERNAL_V3_API_FILENAME = "internal/v3/homebrew-core.jws.json"
private_class_method :cache private_class_method :cache
@ -40,19 +40,19 @@ module Homebrew
def self.cached_json_file_path def self.cached_json_file_path
if Homebrew::API.internal_json_v3? if Homebrew::API.internal_json_v3?
HOMEBREW_CACHE_API/INTERNAL_V3_API_ENDPOINT HOMEBREW_CACHE_API/INTERNAL_V3_API_FILENAME
else else
HOMEBREW_CACHE_API/DEFAULT_API_ENDPOINT HOMEBREW_CACHE_API/DEFAULT_API_FILENAME
end end
end end
sig { returns(T::Boolean) } sig { returns(T::Boolean) }
def self.download_and_cache_data! def self.download_and_cache_data!
if Homebrew::API.internal_json_v3? if Homebrew::API.internal_json_v3?
json_formulae, updated = Homebrew::API.fetch_json_api_file INTERNAL_V3_API_ENDPOINT json_formulae, updated = Homebrew::API.fetch_json_api_file INTERNAL_V3_API_FILENAME
overwrite_cache! T.cast(json_formulae, T::Hash[String, T.untyped]) overwrite_cache! T.cast(json_formulae, T::Hash[String, T.untyped])
else else
json_formulae, updated = Homebrew::API.fetch_json_api_file DEFAULT_API_ENDPOINT json_formulae, updated = Homebrew::API.fetch_json_api_file DEFAULT_API_FILENAME
cache["aliases"] = {} cache["aliases"] = {}
cache["renames"] = {} cache["renames"] = {}