Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X11Requirement: Inherit from generic class [macOS] #3548

Merged
merged 1 commit into from
Dec 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 1 addition & 24 deletions Library/Homebrew/extend/os/mac/requirements/x11_requirement.rb
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
6 changes: 4 additions & 2 deletions Library/Homebrew/requirement.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down