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"
|
require "requirement"
|
||||||
|
|
||||||
class XQuartzRequirement < Requirement
|
class X11Requirement < Requirement
|
||||||
include Comparable
|
|
||||||
|
|
||||||
fatal true
|
|
||||||
cask "xquartz"
|
cask "xquartz"
|
||||||
download "https://xquartz.macosforge.org"
|
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
|
def min_version
|
||||||
MacOS::XQuartz.minimum_version
|
MacOS::XQuartz.minimum_version
|
||||||
end
|
end
|
||||||
@ -28,15 +16,4 @@ class XQuartzRequirement < Requirement
|
|||||||
def message
|
def message
|
||||||
"XQuartz #{min_version} (or newer) is required to install this formula. #{super}"
|
"XQuartz #{min_version} (or newer) is required to install this formula. #{super}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def <=>(other)
|
|
||||||
return unless other.is_a? X11Requirement
|
|
||||||
0
|
|
||||||
end
|
|
||||||
|
|
||||||
def inspect
|
|
||||||
"#<#{self.class.name}: #{name.inspect} #{tags.inspect}>"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
X11Requirement = XQuartzRequirement
|
|
||||||
|
|||||||
@ -170,8 +170,10 @@ class Requirement
|
|||||||
attr_rw :fatal, :default_formula
|
attr_rw :fatal, :default_formula
|
||||||
attr_rw :cask, :download
|
attr_rw :cask, :download
|
||||||
|
|
||||||
def satisfy(options = {}, &block)
|
def satisfy(options = nil, &block)
|
||||||
@satisfied ||= Requirement::Satisfier.new(options, &block)
|
return @satisfied if options.nil? && !block_given?
|
||||||
|
options = {} if options.nil?
|
||||||
|
@satisfied = Requirement::Satisfier.new(options, &block)
|
||||||
end
|
end
|
||||||
|
|
||||||
def env(*settings, &block)
|
def env(*settings, &block)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user