Use cask-source API when needed

This commit is contained in:
Rylan Polster 2023-01-06 02:41:35 -05:00
parent ffc74a51fb
commit ec8adb617e
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64

View File

@ -203,7 +203,6 @@ module Cask
def load(config:)
json_cask = Homebrew::API::Cask.all_casks[token]
cask_source = Homebrew::API::CaskSource.fetch(token)
if (bottle_tag = ::Utils::Bottles.tag.to_s.presence) &&
(variations = json_cask["variations"].presence) &&
@ -213,6 +212,12 @@ module Cask
json_cask.deep_symbolize_keys!
# Use the cask-source API if there are any `*flight` blocks
if json_cask[:artifacts].any? { |artifact| FLIGHT_STANZAS.include?(artifact.keys.first) }
cask_source = Homebrew::API::CaskSource.fetch(token)
return FromContentLoader.new(cask_source).load(config: config)
end
Cask.new(token, source: cask_source, config: config) do
version json_cask[:version]