From 389188ac4fcac42db3b4ef2e31557147890a861a Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 5 Nov 2017 12:09:31 +0000 Subject: [PATCH] mac/xquartz: compare with existing Version class. --- Library/Homebrew/os/mac/xquartz.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb index ddb2aa4fa4..efbb5b7384 100644 --- a/Library/Homebrew/os/mac/xquartz.rb +++ b/Library/Homebrew/os/mac/xquartz.rb @@ -34,7 +34,11 @@ module OS # The X11.app distributed by Apple is also XQuartz, and therefore covered # by this method. def version - @version ||= detect_version + if @version ||= detect_version + ::Version.new @version + else + ::Version::NULL + end end def detect_version @@ -115,7 +119,13 @@ module OS end def installed? - !version.nil? && !prefix.nil? + !version.null? && !prefix.nil? + end + + def outdated? + return false unless installed? + return false if provided_by_apple? + version < latest_version end # If XQuartz and/or the CLT are installed, headers will be found under