Pull another unwieldy condition into a method
This commit is contained in:
parent
d9b9b77fa6
commit
4adf8f047a
@ -40,17 +40,14 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
|
|
||||||
def dev_tools_path
|
def dev_tools_path
|
||||||
@dev_tools_path ||= \
|
@dev_tools_path ||= if tools_in_prefix? CLT::STANDALONE_PKG_PATH
|
||||||
if File.exist? MacOS::CLT::STANDALONE_PKG_PATH and
|
|
||||||
File.exist? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin/cc" and
|
|
||||||
File.exist? "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin/make"
|
|
||||||
# In 10.9 the CLT moved from /usr into /Library/Developer/CommandLineTools.
|
# In 10.9 the CLT moved from /usr into /Library/Developer/CommandLineTools.
|
||||||
Pathname.new "#{MacOS::CLT::STANDALONE_PKG_PATH}/usr/bin"
|
Pathname.new "#{CLT::STANDALONE_PKG_PATH}/usr/bin"
|
||||||
elsif File.exist? "/usr/bin/cc" and File.exist? "/usr/bin/make"
|
elsif tools_in_prefix? "/"
|
||||||
# probably a safe enough assumption (the unix way)
|
# probably a safe enough assumption (the unix way)
|
||||||
Pathname.new "/usr/bin"
|
Pathname.new "/usr/bin"
|
||||||
# Note that the exit status of system "xcrun foo" isn't always accurate
|
|
||||||
elsif not Xcode.bad_xcode_select_path? and not `/usr/bin/xcrun -find make 2>/dev/null`.empty?
|
elsif not Xcode.bad_xcode_select_path? and not `/usr/bin/xcrun -find make 2>/dev/null`.empty?
|
||||||
|
# Note that the exit status of system "xcrun foo" isn't always accurate
|
||||||
# Wherever "make" is there are the dev tools.
|
# Wherever "make" is there are the dev tools.
|
||||||
Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname
|
Pathname.new(`/usr/bin/xcrun -find make`.chomp).dirname
|
||||||
elsif File.exist? "#{Xcode.prefix}/usr/bin/make"
|
elsif File.exist? "#{Xcode.prefix}/usr/bin/make"
|
||||||
@ -59,6 +56,11 @@ module MacOS extend self
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def tools_in_prefix?(prefix)
|
||||||
|
File.directory?(prefix) &&
|
||||||
|
%w{cc make}.all? { |tool| File.executable? "#{prefix}/usr/bin/#{tool}" }
|
||||||
|
end
|
||||||
|
|
||||||
def xctoolchain_path
|
def xctoolchain_path
|
||||||
# As of Xcode 4.3, some tools are located in the "xctoolchain" directory
|
# As of Xcode 4.3, some tools are located in the "xctoolchain" directory
|
||||||
@xctoolchain_path ||= begin
|
@xctoolchain_path ||= begin
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user