formulary: update api loader to load internal json v3
This commit is contained in:
parent
d64de40e52
commit
670e2188d7
@ -251,8 +251,8 @@ module Formulary
|
|||||||
desc json_formula["desc"]
|
desc json_formula["desc"]
|
||||||
homepage json_formula["homepage"]
|
homepage json_formula["homepage"]
|
||||||
license SPDX.string_to_license_expression(json_formula["license"])
|
license SPDX.string_to_license_expression(json_formula["license"])
|
||||||
revision json_formula["revision"]
|
revision json_formula.fetch("revision", 0)
|
||||||
version_scheme json_formula["version_scheme"]
|
version_scheme json_formula.fetch("version_scheme", 0)
|
||||||
|
|
||||||
if (urls_stable = json_formula["urls"]["stable"].presence)
|
if (urls_stable = json_formula["urls"]["stable"].presence)
|
||||||
stable do
|
stable do
|
||||||
@ -262,7 +262,7 @@ module Formulary
|
|||||||
using: urls_stable["using"]&.to_sym,
|
using: urls_stable["using"]&.to_sym,
|
||||||
}.compact
|
}.compact
|
||||||
url urls_stable["url"], **url_spec
|
url urls_stable["url"], **url_spec
|
||||||
version json_formula["versions"]["stable"]
|
version Homebrew::API.internal_json_v3? ? json_formula["version"] : json_formula["versions"]["stable"]
|
||||||
sha256 urls_stable["checksum"] if urls_stable["checksum"].present?
|
sha256 urls_stable["checksum"] if urls_stable["checksum"].present?
|
||||||
|
|
||||||
instance_exec(:stable, &add_deps)
|
instance_exec(:stable, &add_deps)
|
||||||
@ -289,7 +289,13 @@ module Formulary
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (bottles_stable = json_formula["bottle"]["stable"].presence)
|
bottles_stable = if Homebrew::API.internal_json_v3?
|
||||||
|
json_formula["bottle"]
|
||||||
|
else
|
||||||
|
json_formula["bottle"]["stable"]
|
||||||
|
end.presence
|
||||||
|
|
||||||
|
if bottles_stable
|
||||||
bottle do
|
bottle do
|
||||||
if Homebrew::EnvConfig.bottle_domain == HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
if Homebrew::EnvConfig.bottle_domain == HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
||||||
root_url HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
root_url HOMEBREW_BOTTLE_DEFAULT_DOMAIN
|
||||||
@ -373,19 +379,26 @@ module Formulary
|
|||||||
&.gsub(HOMEBREW_HOME_PLACEHOLDER, Dir.home)
|
&.gsub(HOMEBREW_HOME_PLACEHOLDER, Dir.home)
|
||||||
end
|
end
|
||||||
|
|
||||||
@tap_git_head_string = json_formula["tap_git_head"]
|
@tap_git_head_string = if Homebrew::API.internal_json_v3?
|
||||||
|
Homebrew::API::Formula.tap_git_head
|
||||||
|
else
|
||||||
|
json_formula["tap_git_head"]
|
||||||
|
end
|
||||||
|
|
||||||
def tap_git_head
|
def tap_git_head
|
||||||
self.class.instance_variable_get(:@tap_git_head_string)
|
self.class.instance_variable_get(:@tap_git_head_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
@oldnames_array = json_formula["oldnames"] || [json_formula["oldname"]].compact
|
unless Homebrew::API.internal_json_v3?
|
||||||
def oldnames
|
@oldnames_array = json_formula["oldnames"] || [json_formula["oldname"]].compact
|
||||||
self.class.instance_variable_get(:@oldnames_array)
|
def oldnames
|
||||||
end
|
self.class.instance_variable_get(:@oldnames_array)
|
||||||
|
end
|
||||||
|
|
||||||
@aliases_array = json_formula.fetch("aliases", [])
|
@aliases_array = json_formula.fetch("aliases", [])
|
||||||
def aliases
|
def aliases
|
||||||
self.class.instance_variable_get(:@aliases_array)
|
self.class.instance_variable_get(:@aliases_array)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@versioned_formulae_array = json_formula.fetch("versioned_formulae", [])
|
@versioned_formulae_array = json_formula.fetch("versioned_formulae", [])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user