diff options
| author | Jack Nagel | 2013-04-15 15:00:57 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-04-15 15:00:57 -0500 |
| commit | 49682e854d10e99e799e7aeefd1ec08e2ebcf56b (patch) | |
| tree | df169b2aa42852e4db856d8e0d3793282014f3ba /Library/Homebrew/os | |
| parent | 841c8bedcaab1417d4745319d2dec02c81b4cfae (diff) | |
| download | brew-49682e854d10e99e799e7aeefd1ec08e2ebcf56b.tar.bz2 | |
Avoid expensive Pathname concatenation
Diffstat (limited to 'Library/Homebrew/os')
| -rw-r--r-- | Library/Homebrew/os/mac/xcode.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/os/mac/xquartz.rb | 12 |
2 files changed, 12 insertions, 12 deletions
diff --git a/Library/Homebrew/os/mac/xcode.rb b/Library/Homebrew/os/mac/xcode.rb index a89faa002..59bc199b2 100644 --- a/Library/Homebrew/os/mac/xcode.rb +++ b/Library/Homebrew/os/mac/xcode.rb @@ -33,15 +33,15 @@ module MacOS::Xcode extend self def prefix @prefix ||= begin path = Pathname.new(folder) - if path.absolute? and (path/'usr/bin/make').executable? + if path.absolute? and File.executable? "#{path}/usr/bin/make" path elsif File.executable? '/Developer/usr/bin/make' # we do this to support cowboys who insist on installing # only a subset of Xcode - Pathname.new '/Developer' - elsif (V4_BUNDLE_PATH/'Contents/Developer/usr/bin/make').executable? + Pathname.new('/Developer') + elsif File.executable? "#{V4_BUNDLE_PATH}/Contents/Developer/usr/bin/make" # fallback for broken Xcode 4.3 installs - V4_BUNDLE_PATH/'Contents/Developer' + Pathname.new("#{V4_BUNDLE_PATH}/Contents/Developer") else # Ask Spotlight where Xcode is. If the user didn't install the # helper tools and installed Xcode in a non-conventional place, this @@ -51,7 +51,7 @@ module MacOS::Xcode extend self unless path.nil? path += "Contents/Developer" - path if (path/'usr/bin/make').executable? + path if File.executable? "#{path}/usr/bin/make" end end end @@ -76,7 +76,7 @@ module MacOS::Xcode extend self # this shortcut makes version work for people who don't realise you # need to install the CLI tools - xcode43build = prefix/'usr/bin/xcodebuild' + xcode43build = Pathname.new("#{prefix}/usr/bin/xcodebuild") if xcode43build.file? `#{xcode43build} -version 2>/dev/null` =~ /Xcode (\d(\.\d)*)/ return $1 if $1 diff --git a/Library/Homebrew/os/mac/xquartz.rb b/Library/Homebrew/os/mac/xquartz.rb index a515d8915..f5b85afd2 100644 --- a/Library/Homebrew/os/mac/xquartz.rb +++ b/Library/Homebrew/os/mac/xquartz.rb @@ -70,27 +70,27 @@ module MacOS::X11 extend self # Confusingly, executables (e.g. config scripts) are only found under # /opt/X11/bin or /usr/X11/bin in all cases. def bin - prefix/'bin' + Pathname.new("#{prefix}/bin") end def include @include ||= if use_sdk? - MacOS.sdk_path/'usr/X11/include' + Pathname.new("#{MacOS.sdk_path}/usr/X11/include") else - prefix/'include' + Pathname.new("#{prefix}/include") end end def lib @lib ||= if use_sdk? - MacOS.sdk_path/'usr/X11/lib' + Pathname.new("#{MacOS.sdk_path}/usr/X11/lib") else - prefix/'lib' + Pathname.new("#{prefix}/lib") end end def share - prefix/'share' + Pathname.new("#{prefix}/share") end private |
