aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-07-21 19:11:05 -0500
committerJack Nagel2013-07-22 11:25:11 -0500
commit50c59320a5b8f543d6d46bb1180660e5e0a7b0cf (patch)
tree8e5c938ff1ed411a6c391e4ee9ae39c59b4ecf87 /Library
parentfc0f4ff771f53b9ccf10d120c687dda1386fc78f (diff)
downloadhomebrew-50c59320a5b8f543d6d46bb1180660e5e0a7b0cf.tar.bz2
Separate version detection from accessor
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/os/mac/xquartz.rb19
1 files changed, 10 insertions, 9 deletions
diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb
index 108ac1e60..ed7473cef 100644
--- a/Library/Homebrew/os/mac/xquartz.rb
+++ b/Library/Homebrew/os/mac/xquartz.rb
@@ -7,15 +7,16 @@ module MacOS::XQuartz extend self
# The X11.app distributed by Apple is also XQuartz, and therefore covered
# by this method.
def version
- @version ||= begin
- path = bundle_path
- if not path.nil? and path.exist?
- version_from_mdls(path)
- elsif prefix.to_s == "/usr/X11"
- guess_system_version
- else
- version_from_pkgutil
- end
+ @version ||= detect_version
+ end
+
+ def detect_version
+ if (path = bundle_path) && path.exist?
+ version_from_mdls(path)
+ elsif prefix.to_s == "/usr/X11"
+ guess_system_version
+ else
+ version_from_pkgutil
end
end