Skip to content
Snippets Groups Projects
Commit b432f8e9 authored by Mike McQuaid's avatar Mike McQuaid Committed by GitHub
Browse files

Merge pull request #1004 from apjanke/print-requirements

info: print requirements
parents 92e6edea 5aaccba3
No related branches found
No related tags found
No related merge requests found
......@@ -143,6 +143,15 @@ module Homebrew
end
end
unless f.requirements.to_a.empty?
ohai "Requirements"
%w[build required recommended optional].map do |type|
reqs = f.requirements.select(&:"#{type}?")
next if reqs.to_a.empty?
puts "#{type.capitalize}: #{decorate_requirements(reqs)}"
end
end
unless f.options.empty?
ohai "Options"
Homebrew.dump_options_for_formula f
......@@ -158,4 +167,12 @@ module Homebrew
end
deps_status * ", "
end
def decorate_requirements(requirements)
req_status = requirements.collect do |req|
req_s = req.display_s
req.satisfied? ? pretty_installed(req_s) : pretty_uninstalled(req_s)
end
req_status.join(", ")
end
end
......@@ -121,6 +121,10 @@ class Requirement
end
end
def display_s
name
end
private
def infer_name
......
......@@ -42,4 +42,19 @@ class JavaRequirement < Requirement
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
if @version[-1] == "+"
op = ">="
version = @version[0, @version.length-1]
else
op = "="
version = @version
end
"#{name} #{op} #{version}"
else
name
end
end
end
......@@ -51,4 +51,8 @@ class LanguageModuleRequirement < Requirement
when :ruby then "gem install"
end
end
def display_s
"#{@module_name} (#{@language} module)"
end
end
......@@ -16,4 +16,8 @@ class MaximumMacOSRequirement < Requirement
versions newer than #{@version.pretty_name} due to an upstream incompatibility.
EOS
end
def display_s
"macOS <= #{@version}"
end
end
......@@ -13,4 +13,8 @@ class MinimumMacOSRequirement < Requirement
def message
"macOS #{@version.pretty_name} or newer is required."
end
def display_s
"macOS >= #{@version}"
end
end
......@@ -25,4 +25,12 @@ class PerlRequirement < Requirement
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
"#{name} >= #{@version}"
else
name
end
end
end
......@@ -25,4 +25,12 @@ class RubyRequirement < Requirement
def inspect
"#<#{self.class.name}: #{name.inspect} #{tags.inspect} version=#{@version.inspect}>"
end
def display_s
if @version
"#{name} >= #{@version}"
else
name
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment