aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMax Howell2012-03-16 00:59:09 +0000
committerMax Howell2012-03-16 00:59:39 +0000
commitc1545fe56a939ce3f353e541693cede233b8a902 (patch)
tree30ebc4c7c35e1597c06bd278918ed69083c1455c /Library/Homebrew
parentf1c26eb6e7c9d9b860172ea1606bc87467db5bd4 (diff)
downloadbrew-c1545fe56a939ce3f353e541693cede233b8a902.tar.bz2
xcode_version works for Xcode 4.3 without CLITools
Also correct heinous error when I put `case nil` in the code. Also outputs "dunno" if we really can't figure it out. I think this is safe.
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/utils.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index 4ef0a5a67..b335c45ea 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -378,6 +378,14 @@ module MacOS extend self
def xcode_version
@xcode_version ||= begin
+ # this shortcut makes xcode_version work for people who don't realise you
+ # need to install the CLI tools
+ xcode43build = "/Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild"
+ if File.file? xcode43build
+ `#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
+ return $1 if $1
+ end
+
# Xcode 4.3 xc* tools hang indefinately if xcode-select path is set thus
raise if `xcode-select -print-path 2>/dev/null`.chomp == "/"
@@ -389,8 +397,8 @@ module MacOS extend self
# For people who's xcode-select is unset, or who have installed
# xcode-gcc-installer or whatever other combinations we can try and
# supprt. See https://github.com/mxcl/homebrew/wiki/Xcode
- case nil
- when 0..2063 then "3.1.0"
+ case llvm_build_version.to_i
+ when 1..2063 then "3.1.0"
when 2064..2065 then "3.1.4"
when 2366..2325
# we have no data for this range so we are guessing
@@ -405,7 +413,9 @@ module MacOS extend self
"4.0"
else
case (clang_version.to_f * 10).to_i
- when 0..14
+ when 0
+ "dunno"
+ when 1..14
"3.2.2"
when 15
"3.2.4"