Add HEAD information to JSON API

This commit is contained in:
Bo Anderson 2023-02-06 13:04:16 +00:00
parent 8edf681175
commit 33681f90e3
No known key found for this signature in database
GPG Key ID: 3DB94E204E137D65
2 changed files with 11 additions and 0 deletions

View File

@ -2139,6 +2139,13 @@ class Formula
hsh["bottle"]["stable"] = bottle_hash if bottle_defined? hsh["bottle"]["stable"] = bottle_hash if bottle_defined?
end end
if head
hsh["urls"]["head"] = {
"url" => head.url,
"branch" => head.specs[:branch],
}
end
hsh["options"] = options.map do |opt| hsh["options"] = options.map do |opt|
{ "option" => opt.flag, "description" => opt.description } { "option" => opt.flag, "description" => opt.description }
end end

View File

@ -163,6 +163,10 @@ module Formulary
end end
end end
if (urls_head = json_formula["urls"]["head"]).present?
head urls_head["url"], branch: urls_head["branch"]
end
if (bottles_stable = json_formula["bottle"]["stable"]).present? if (bottles_stable = json_formula["bottle"]["stable"]).present?
bottle do bottle do
root_url bottles_stable["root_url"] root_url bottles_stable["root_url"]