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
commit178fa2b6f1a460ad82e62976d247ff943f806c0a (patch)
tree2bcfdcdc704b2820ce291b2f4ca58e6659cf58d6 /Library
parent3159f9b399c66246408e87f12de9cddf9462c3a5 (diff)
downloadhomebrew-178fa2b6f1a460ad82e62976d247ff943f806c0a.tar.bz2
Extract version_from_mdls
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/os/mac/xquartz.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb
index e65e8705a..221bf7719 100644
--- a/Library/Homebrew/os/mac/xquartz.rb
+++ b/Library/Homebrew/os/mac/xquartz.rb
@@ -10,7 +10,7 @@ module MacOS::XQuartz extend self
@version ||= begin
path = bundle_path
if not path.nil? and path.exist?
- `mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip
+ version_from_mdls(path)
elsif prefix.to_s == "/usr/X11"
guess_system_version
else
@@ -29,6 +29,10 @@ module MacOS::XQuartz extend self
MacOS.app_with_bundle_id(FORGE_BUNDLE_ID) || MacOS.app_with_bundle_id(APPLE_BUNDLE_ID)
end
+ def version_from_mdls(path)
+ `mdls -raw -name kMDItemVersion "#{path}" 2>/dev/null`.strip
+ 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.