Skip to content

Commit

Permalink
Merge pull request #16102 from EricFromCanada/api-urls-using
Browse files Browse the repository at this point in the history
api: add `using:` attribute to head & stable URLs
  • Loading branch information
EricFromCanada authored Oct 12, 2023
2 parents f89c719 + 03e743a commit eacf8d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Library/Homebrew/formula.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2281,6 +2281,7 @@ def to_hash
"url" => stable_spec.url,
"tag" => stable_spec.specs[:tag],
"revision" => stable_spec.specs[:revision],
"using" => (stable_spec.using if stable_spec.using.is_a?(Symbol)),
"checksum" => stable_spec.checksum&.to_s,
}

Expand All @@ -2291,6 +2292,7 @@ def to_hash
hsh["urls"]["head"] = {
"url" => T.must(head).url,
"branch" => T.must(head).specs[:branch],
"using" => (T.must(head).using if T.must(head).using.is_a?(Symbol)),
}
end

Expand Down
11 changes: 9 additions & 2 deletions Library/Homebrew/formulary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,11 @@ def self.load_formula_from_api(name, flags:)

if (urls_stable = json_formula["urls"]["stable"].presence)
stable do
url_spec = { tag: urls_stable["tag"], revision: urls_stable["revision"] }.compact
url_spec = {
tag: urls_stable["tag"],
revision: urls_stable["revision"],
using: urls_stable["using"]&.to_sym,
}.compact
url urls_stable["url"], **url_spec
version json_formula["versions"]["stable"]
sha256 urls_stable["checksum"] if urls_stable["checksum"].present?
Expand All @@ -256,7 +260,10 @@ def self.load_formula_from_api(name, flags:)

if (urls_head = json_formula["urls"]["head"].presence)
head do
url_spec = { branch: urls_head["branch"] }.compact
url_spec = {
branch: urls_head["branch"],
using: urls_head["using"]&.to_sym,
}.compact
url urls_head["url"], **url_spec

instance_exec(:head, &add_deps)
Expand Down

0 comments on commit eacf8d9

Please sign in to comment.