Rename Xcode.folder to MacOS.active_developer_dir

This reflects what Apple calls it in more recent versions of Xcode/OS X.
This commit is contained in:
Jack Nagel 2014-05-01 18:36:46 -05:00
parent 4b335eb2df
commit aa5a5a526f
4 changed files with 7 additions and 11 deletions

View File

@ -437,7 +437,7 @@ def check_xcode_prefix_exists
end end
def check_xcode_select_path def check_xcode_select_path
if not MacOS::CLT.installed? and not File.file? "#{MacOS::Xcode.folder}/usr/bin/xcodebuild" if not MacOS::CLT.installed? and not File.file? "#{MacOS.active_developer_dir}/usr/bin/xcodebuild"
path = MacOS.app_with_bundle_id(MacOS::Xcode::V4_BUNDLE_ID, MacOS::Xcode::V3_BUNDLE_ID) path = MacOS.app_with_bundle_id(MacOS::Xcode::V4_BUNDLE_ID, MacOS::Xcode::V3_BUNDLE_ID)
path = '/Developer' if path.nil? or not path.directory? path = '/Developer' if path.nil? or not path.directory?
<<-EOS.undent <<-EOS.undent

View File

@ -36,6 +36,10 @@ module OS
end end
end end
def active_developer_dir
@active_developer_dir ||= `xcode-select -print-path 2>/dev/null`.strip
end
def dev_tools_prefix def dev_tools_prefix
dev_tools_path.parent.parent dev_tools_path.parent.parent
end end

View File

@ -7,14 +7,6 @@ module OS
V3_BUNDLE_ID = "com.apple.Xcode" V3_BUNDLE_ID = "com.apple.Xcode"
V4_BUNDLE_PATH = Pathname.new("/Applications/Xcode.app") V4_BUNDLE_PATH = Pathname.new("/Applications/Xcode.app")
# Locate the "current Xcode folder" via xcode-select. See:
# man xcode-select
# TODO Should this be moved to OS::Mac? As of 10.9 this is referred to
# as the "developer directory", and be either a CLT or Xcode instance.
def folder
@folder ||= `xcode-select -print-path 2>/dev/null`.strip
end
def latest_version def latest_version
case MacOS.version case MacOS.version
when "10.4" then "2.5" when "10.4" then "2.5"
@ -43,7 +35,7 @@ module OS
def prefix def prefix
@prefix ||= begin @prefix ||= begin
path = Pathname.new(folder) path = Pathname.new(MacOS.active_developer_dir)
if path != CLT::MAVERICKS_PKG_PATH and path.absolute? \ if path != CLT::MAVERICKS_PKG_PATH and path.absolute? \
and File.executable? "#{path}/usr/bin/make" and File.executable? "#{path}/usr/bin/make"
path path

View File

@ -34,7 +34,7 @@ end
# Check for bad xcode-select before anything else, because `doctor` and # Check for bad xcode-select before anything else, because `doctor` and
# many other things will hang # many other things will hang
# Note that this bug was fixed in 10.9 # Note that this bug was fixed in 10.9
if OS.mac? && MacOS.version < :mavericks && MacOS::Xcode.folder == "/" if OS.mac? && MacOS.version < :mavericks && MacOS.active_developer_dir == "/"
odie <<-EOS.undent odie <<-EOS.undent
Your xcode-select path is currently set to '/'. Your xcode-select path is currently set to '/'.
This causes the `xcrun` tool to hang, and can render Homebrew unusable. This causes the `xcrun` tool to hang, and can render Homebrew unusable.