diff --git a/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb b/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb index ae4f5b8edfd7d..0c319d1de32fe 100644 --- a/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb +++ b/Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb @@ -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 @@ def min_version 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 diff --git a/Library/Homebrew/requirement.rb b/Library/Homebrew/requirement.rb index 95807d5aeffd9..91f84157e7975 100644 --- a/Library/Homebrew/requirement.rb +++ b/Library/Homebrew/requirement.rb @@ -170,8 +170,10 @@ class << self 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)