API: supply additional data for requirements
This commit is contained in:
parent
486d498d6e
commit
5277f849d9
@ -1690,10 +1690,13 @@ class Formula
|
|||||||
end
|
end
|
||||||
|
|
||||||
hsh["requirements"] = requirements.map do |req|
|
hsh["requirements"] = requirements.map do |req|
|
||||||
|
req.name.prepend("maximum_") if req.try(:comparator) == "<="
|
||||||
{
|
{
|
||||||
"name" => req.name,
|
"name" => req.name,
|
||||||
"cask" => req.cask,
|
"cask" => req.cask,
|
||||||
"download" => req.download,
|
"download" => req.download,
|
||||||
|
"version" => req.try(:version),
|
||||||
|
"contexts" => req.tags,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
require "language/java"
|
require "language/java"
|
||||||
|
|
||||||
class JavaRequirement < Requirement
|
class JavaRequirement < Requirement
|
||||||
attr_reader :java_home
|
|
||||||
|
|
||||||
fatal true
|
fatal true
|
||||||
|
|
||||||
|
attr_reader :java_home, :version
|
||||||
|
|
||||||
# A strict Java 8 requirement (1.8) should prompt the user to install
|
# A strict Java 8 requirement (1.8) should prompt the user to install
|
||||||
# an OpenJDK 1.8 distribution. Versions newer than Java 8 are not
|
# an OpenJDK 1.8 distribution. Versions newer than Java 8 are not
|
||||||
# completely backwards compatible, and contain breaking changes such as
|
# completely backwards compatible, and contain breaking changes such as
|
||||||
|
|||||||
@ -5,6 +5,8 @@ require "requirement"
|
|||||||
class MacOSRequirement < Requirement
|
class MacOSRequirement < Requirement
|
||||||
fatal true
|
fatal true
|
||||||
|
|
||||||
|
attr_reader :comparator, :version
|
||||||
|
|
||||||
def initialize(tags = [], comparator: ">=")
|
def initialize(tags = [], comparator: ">=")
|
||||||
if comparator == "==" && tags.first.respond_to?(:map)
|
if comparator == "==" && tags.first.respond_to?(:map)
|
||||||
@version = tags.shift.map { |s| MacOS::Version.from_symbol(s) }
|
@version = tags.shift.map { |s| MacOS::Version.from_symbol(s) }
|
||||||
@ -54,6 +56,10 @@ class MacOSRequirement < Requirement
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def inspect
|
||||||
|
"#<#{self.class.name}: #{tags.inspect} version#{@comparator}#{@version}>"
|
||||||
|
end
|
||||||
|
|
||||||
def display_s
|
def display_s
|
||||||
return "macOS is required" unless version_specified?
|
return "macOS is required" unless version_specified?
|
||||||
|
|
||||||
|
|||||||
@ -5,6 +5,8 @@ require "requirement"
|
|||||||
class XcodeRequirement < Requirement
|
class XcodeRequirement < Requirement
|
||||||
fatal true
|
fatal true
|
||||||
|
|
||||||
|
attr_reader :version
|
||||||
|
|
||||||
satisfy(build_env: false) { xcode_installed_version }
|
satisfy(build_env: false) { xcode_installed_version }
|
||||||
|
|
||||||
def initialize(tags = [])
|
def initialize(tags = [])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user