aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXu Cheng2015-08-22 13:21:13 +0800
committerXu Cheng2015-08-22 13:21:13 +0800
commit62be981016cdcee353ab538d089174fd8cce0f9e (patch)
tree1d3edfc274221bad4875e15fb369b8c57f895564
parenta88c40b8c888064f6514cf0646ea2140e2578d57 (diff)
downloadbrew-62be981016cdcee353ab538d089174fd8cce0f9e.tar.bz2
use Pathname#executable? directly
-rw-r--r--Library/Homebrew/os/mac.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb
index c2c909d76..bcaf84858 100644
--- a/Library/Homebrew/os/mac.rb
+++ b/Library/Homebrew/os/mac.rb
@@ -27,8 +27,8 @@ module OS
@locate[key] = if File.executable?(path = "/usr/bin/#{tool}")
Pathname.new path
# Homebrew GCCs most frequently; much faster to check this before xcrun
- elsif File.executable?(path = "#{HOMEBREW_PREFIX}/bin/#{tool}")
- Pathname.new path
+ elsif (path = HOMEBREW_PREFIX/"bin/#{tool}").executable?
+ path
else
path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool).chomp
Pathname.new(path) if File.executable?(path)
@@ -39,8 +39,8 @@ module OS
# Locates a (working) copy of install_name_tool, guaranteed to function
# whether the user has developer tools installed or not.
def install_name_tool
- if File.executable?(path = "#{HOMEBREW_PREFIX}/opt/cctools/bin/install_name_tool")
- Pathname.new(path)
+ if (path = HOMEBREW_PREFIX/"opt/cctools/bin/install_name_tool").executable?
+ path
else
locate("install_name_tool")
end
@@ -49,8 +49,8 @@ module OS
# Locates a (working) copy of otool, guaranteed to function whether the user
# has developer tools installed or not.
def otool
- if File.executable?(path = "#{HOMEBREW_PREFIX}/opt/cctools/bin/otool")
- Pathname.new(path)
+ if (path = HOMEBREW_PREFIX/"opt/cctools/bin/otool").executable?
+ path
else
locate("otool")
end