X11Requirement: Inherit from generic class [macOS]
Fix the warning: already initialized constant X11Requirement
This commit is contained in:
parent
5055c31a86
commit
020c1adebd
@ -1,21 +1,9 @@
|
||||
require "requirement"
|
||||
|
||||
class XQuartzRequirement < Requirement
|
||||
include Comparable
|
||||
|
||||
fatal true
|
||||
class X11Requirement < Requirement
|
||||
cask "xquartz"
|
||||
download "https://xquartz.macosforge.org"
|
||||
|
||||
env { ENV.x11 }
|
||||
|
||||
def initialize(name = "x11", tags = [])
|
||||
@name = name
|
||||
# no-op on version specified as a tag argument
|
||||
tags.shift if /(\d\.)+\d/ =~ tags.first
|
||||
super(tags)
|
||||
end
|
||||
|
||||
def min_version
|
||||
MacOS::XQuartz.minimum_version
|
||||
end
|
||||
@ -28,15 +16,4 @@ class XQuartzRequirement < Requirement
|
||||
def message
|
||||
"XQuartz #{min_version} (or newer) is required to install this formula. #{super}"
|
||||
end
|
||||
|
||||
def <=>(other)
|
||||
return unless other.is_a? X11Requirement
|
||||
0
|
||||
end
|
||||
|
||||
def inspect
|
||||
"#<#{self.class.name}: #{name.inspect} #{tags.inspect}>"
|
||||
end
|
||||
end
|
||||
|
||||
X11Requirement = XQuartzRequirement
|
||||
|
||||
@ -170,8 +170,10 @@ class Requirement
|
||||
attr_rw :fatal, :default_formula
|
||||
attr_rw :cask, :download
|
||||
|
||||
def satisfy(options = {}, &block)
|
||||
@satisfied ||= Requirement::Satisfier.new(options, &block)
|
||||
def satisfy(options = nil, &block)
|
||||
return @satisfied if options.nil? && !block_given?
|
||||
options = {} if options.nil?
|
||||
@satisfied = Requirement::Satisfier.new(options, &block)
|
||||
end
|
||||
|
||||
def env(*settings, &block)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user