aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2014-04-15 14:18:45 -0500
committerJack Nagel2014-04-15 14:20:18 -0500
commit538dea98ad3f4354fff32a07a12f987bf3d1d0b5 (patch)
tree010b3e7f661616789f6ea708b567542d8322d346 /Library
parent9d02c39e23ed995005e9b7e6c2d4b40b2ebaf2d3 (diff)
downloadbrew-538dea98ad3f4354fff32a07a12f987bf3d1d0b5.tar.bz2
Start cleaning up Xcode.version
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/os/mac/xcode.rb20
1 files changed, 5 insertions, 15 deletions
diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb
index cb19eaf8a..d56aa992b 100644
--- a/Library/Homebrew/os/mac/xcode.rb
+++ b/Library/Homebrew/os/mac/xcode.rb
@@ -81,23 +81,13 @@ module OS
return "0" unless OS.mac?
- # this shortcut makes version work for people who don't realise you
- # need to install the CLI tools
- # TODO investigate and update the above comment; what does this mean
- # for modern installs (Xcode 5 on 10.8/9)?
- xcode43build = Pathname.new("#{prefix}/usr/bin/xcodebuild")
- if xcode43build.file?
- `#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
- return $1 if $1
+ %W[#{prefix}/usr/bin/xcodebuild #{which("xcodebuild")}].uniq.each do |path|
+ if File.file? path
+ `#{path} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
+ return $1 if $1
+ end
end
- xcodebuild = which "xcodebuild"
- raise unless xcodebuild && xcodebuild != xcode43build
-
- `xcodebuild -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/
- raise if $1.nil? or not $?.success?
- $1
- rescue
# 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/Homebrew/homebrew/wiki/Xcode