BottleAPI: support :all bottles

This commit is contained in:
Rylan Polster 2021-07-14 10:14:48 -04:00
parent 98713e9cd1
commit c5df900936
No known key found for this signature in database
GPG Key ID: 46A744940CFF4D64

View File

@ -66,7 +66,7 @@ module BottleAPI
hash = fetch(name)
bottle_tag = Utils::Bottles.tag.to_s
odie "No bottle available for current OS" unless hash["bottles"].key? bottle_tag
odie "No bottle available for current OS" if !hash["bottles"].key?(bottle_tag) && !hash["bottles"].key?("all")
download_bottle(hash, bottle_tag)
@ -94,6 +94,7 @@ module BottleAPI
sig { params(hash: Hash, tag: Symbol).void }
def download_bottle(hash, tag)
bottle = hash["bottles"][tag]
bottle ||= hash["bottles"]["all"]
return if bottle.blank?
sha256 = bottle["sha256"] || checksum_from_url(bottle["url"])