aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-07-21 19:11:05 -0500
committerJack Nagel2013-07-22 11:25:10 -0500
commit0b5551ee5b195bf1d9617ad158cb9ed0a9f5de85 (patch)
treecaf3eee15eb1e5a72d49a5cb7d3c7403c7e4cc89 /Library
parentdf0d4aa8530da406f8e58ee5e6d757acca1045de (diff)
downloadbrew-0b5551ee5b195bf1d9617ad158cb9ed0a9f5de85.tar.bz2
Extract guess_system_version
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/os/mac/xquartz.rb22
1 files changed, 13 insertions, 9 deletions
diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb
index b4fd1ece7..e65e8705a 100644
--- a/Library/Homebrew/os/mac/xquartz.rb
+++ b/Library/Homebrew/os/mac/xquartz.rb
@@ -12,15 +12,7 @@ module MacOS::XQuartz extend self
if not path.nil? and path.exist?
`mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip
elsif prefix.to_s == "/usr/X11"
- # Some users disable Spotlight indexing. If we're working with the
- # system X11 distribution, we can't get the version from pkgutil, so
- # just use the expected version.
- case MacOS.version
- when '10.5' then '2.1.6'
- when '10.6' then '2.3.6'
- when '10.7' then '2.6.3'
- else 'dunno'
- end
+ guess_system_version
else
# Finally, try to find it via pkgutil. This is slow, and only works
# for the upstream XQuartz package, so use it as a last resort.
@@ -37,6 +29,18 @@ module MacOS::XQuartz extend self
MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) || MacOS.app_with_bundle_id(APPLE_BUNDLE_ID)
end
+ # The XQuartz that Apple shipped in OS X through 10.7 does not have a
+ # pkg-util entry, so if Spotlight indexing is disabled we must make an
+ # educated guess as to what version is installed.
+ def guess_system_version
+ case MacOS.version
+ when '10.5' then '2.1.6'
+ when '10.6' then '2.3.6'
+ when '10.7' then '2.6.3'
+ else 'dunno'
+ end
+ end
+
def provided_by_apple?
[FORGE_BUNDLE_ID, APPLE_BUNDLE_ID].find do |id|
MacOS.app_with_bundle_id(id)