aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Nagel2012-06-30 14:01:07 -0500
committerJack Nagel2012-06-30 14:01:07 -0500
commit7384f4152bdc29f3ef7918df06eca24ebe4a40ad (patch)
tree96b3d55394b7ca1e6727dd796fa4861cfdb1ba3a
parent5e92531dd6571d5e848439b75f58233d39299dda (diff)
downloadhomebrew-7384f4152bdc29f3ef7918df06eca24ebe4a40ad.tar.bz2
Address some style issues in MacOS module
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
-rw-r--r--Library/Homebrew/macos.rb38
1 files changed, 16 insertions, 22 deletions
diff --git a/Library/Homebrew/macos.rb b/Library/Homebrew/macos.rb
index 9c4851515..645e0220d 100644
--- a/Library/Homebrew/macos.rb
+++ b/Library/Homebrew/macos.rb
@@ -128,34 +128,28 @@ module MacOS extend self
end
def xctoolchain_path
- # Beginning with Xcode 4.3, clang and some other tools are located in a xctoolchain dir.
+ # As of Xcode 4.3, some tools are located in the "xctoolchain" directory
@xctoolchain_path ||= begin
path = Pathname.new("#{MacOS.xcode_prefix}/Toolchains/XcodeDefault.xctoolchain")
- if path.exist?
- path
- else
- # ok, there are no Toolchains in xcode_prefix
- # and that's ok as long as everything is in dev_tools_path="/usr/bin" (i.e. clt_installed?)
- nil
- end
+ # If only the CLT are installed, all tools will be under dev_tools_path,
+ # and this path will be nil.
+ path if path.exist?
end
end
def sdk_path(v=MacOS.version)
- # The path of the MacOSX SDK.
- if !MacOS.xctools_fucked? and File.executable? "#{xcode_folder}/usr/bin/make"
- path = `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.strip
- elsif File.directory? '/Developer/SDKs/MacOS#{v}.sdk'
- # the old default (or wild wild west style)
- path = "/Developer/SDKs/MacOS#{v}.sdk"
- elsif File.directory? "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
- # xcode_prefix is pretty smart, so lets look inside to find the sdk
- path = "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
- end
- if path.nil? or path.empty? or not File.directory? path
- nil
- else
- Pathname.new path
+ @sdk_path ||= begin
+ path = if !MacOS.xctools_fucked? and File.executable? "#{xcode_folder}/usr/bin/make"
+ `#{locate('xcodebuild')} -version -sdk macosx#{v} Path 2>/dev/null`.strip
+ elsif File.directory? '/Developer/SDKs/MacOS#{v}.sdk'
+ # the old default (or wild wild west style)
+ "/Developer/SDKs/MacOS#{v}.sdk"
+ elsif File.directory? "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
+ # xcode_prefix is pretty smart, so lets look inside to find the sdk
+ "#{xcode_prefix}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX#{v}.sdk"
+ end
+
+ Pathname.new(path) unless path.nil? or path.empty? or not File.directory? path
end
end