Merge pull request #14725 from Bo98/api-link_overwrite
Support `link_overwrite` and `conflicts_with` in API
This commit is contained in:
commit
ddd328ed7d
@ -2119,6 +2119,8 @@ class Formula # rubocop:disable Metrics/ClassLength
|
|||||||
"uses_from_macos" => uses_from_macos_elements.uniq,
|
"uses_from_macos" => uses_from_macos_elements.uniq,
|
||||||
"requirements" => [],
|
"requirements" => [],
|
||||||
"conflicts_with" => conflicts.map(&:name),
|
"conflicts_with" => conflicts.map(&:name),
|
||||||
|
"conflicts_with_reasons" => conflicts.map(&:reason),
|
||||||
|
"link_overwrite" => self.class.link_overwrite_paths.to_a,
|
||||||
"caveats" => caveats&.gsub(HOMEBREW_PREFIX, HOMEBREW_PREFIX_PLACEHOLDER),
|
"caveats" => caveats&.gsub(HOMEBREW_PREFIX, HOMEBREW_PREFIX_PLACEHOLDER),
|
||||||
"installed" => [],
|
"installed" => [],
|
||||||
"linked_keg" => linked_version&.to_s,
|
"linked_keg" => linked_version&.to_s,
|
||||||
|
|||||||
@ -244,6 +244,14 @@ module Formulary
|
|||||||
depends_on req_name => req_tags
|
depends_on req_name => req_tags
|
||||||
end
|
end
|
||||||
|
|
||||||
|
json_formula["conflicts_with"].each_with_index do |conflict, index|
|
||||||
|
conflicts_with conflict, because: json_formula.dig("conflicts_with_reasons", index)
|
||||||
|
end
|
||||||
|
|
||||||
|
json_formula["link_overwrite"]&.each do |overwrite_path|
|
||||||
|
link_overwrite overwrite_path
|
||||||
|
end
|
||||||
|
|
||||||
def install
|
def install
|
||||||
raise "Cannot build from source from abstract formula."
|
raise "Cannot build from source from abstract formula."
|
||||||
end
|
end
|
||||||
|
|||||||
@ -253,6 +253,9 @@ describe Formulary do
|
|||||||
"contexts" => ["build"],
|
"contexts" => ["build"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
"conflicts_with" => ["conflicting_formula"],
|
||||||
|
"conflicts_with_reasons" => ["it does"],
|
||||||
|
"link_overwrite" => ["bin/abc"],
|
||||||
"caveats" => "example caveat string",
|
"caveats" => "example caveat string",
|
||||||
}.merge(extra_items),
|
}.merge(extra_items),
|
||||||
}
|
}
|
||||||
@ -330,6 +333,10 @@ describe Formulary do
|
|||||||
expect(req.version).to eq "1.0"
|
expect(req.version).to eq "1.0"
|
||||||
expect(req.tags).to eq [:build]
|
expect(req.tags).to eq [:build]
|
||||||
|
|
||||||
|
expect(formula.conflicts.map(&:name)).to include "conflicting_formula"
|
||||||
|
expect(formula.conflicts.map(&:reason)).to include "it does"
|
||||||
|
expect(formula.class.link_overwrite_paths).to include "bin/abc"
|
||||||
|
|
||||||
expect(formula.caveats).to eq "example caveat string"
|
expect(formula.caveats).to eq "example caveat string"
|
||||||
|
|
||||||
expect {
|
expect {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user