aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2012-05-13 19:00:10 -0500
committerJack Nagel2012-05-13 19:28:03 -0500
commit210c9ac2055566bb7fd8932299b55c29f1ececee (patch)
tree21b01e45c58ee68ee2e39e368c0ccb96ebb5bc18 /Library
parent28f89c59a2b39738df5a6fc85711be9af250fb53 (diff)
downloadbrew-210c9ac2055566bb7fd8932299b55c29f1ececee.tar.bz2
Use 'which' helper method more
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/--config.rb18
-rw-r--r--Library/Homebrew/cmd/doctor.rb4
-rw-r--r--Library/Homebrew/cmd/info.rb2
-rw-r--r--Library/Homebrew/cmd/tap.rb2
-rw-r--r--Library/Homebrew/utils.rb4
5 files changed, 15 insertions, 15 deletions
diff --git a/Library/Homebrew/cmd/--config.rb b/Library/Homebrew/cmd/--config.rb
index 755695567..abe247cad 100644
--- a/Library/Homebrew/cmd/--config.rb
+++ b/Library/Homebrew/cmd/--config.rb
@@ -45,29 +45,29 @@ module Homebrew extend self
end
def describe_perl
- perl = `which perl`.chomp
- return "N/A" if perl.empty?
+ perl = which 'perl'
+ return "N/A" if perl.nil?
- real_perl = Pathname.new(perl).realpath.to_s
+ real_perl = Pathname.new(perl).realpath
return perl if perl == real_perl
return "#{perl} => #{real_perl}"
end
def describe_python
- python = `which python`.chomp
- return "N/A" if python.empty?
+ python = which 'python'
+ return "N/A" if python.nil?
- real_python = Pathname.new(python).realpath.to_s
+ real_python = Pathname.new(python).realpath
return python if python == real_python
return "#{python} => #{real_python}"
end
def describe_ruby
- ruby = `which ruby`.chomp
- return "N/A" if ruby.empty?
+ ruby = which 'ruby'
+ return "N/A" if ruby.nil?
- real_ruby = Pathname.new(ruby).realpath.to_s
+ real_ruby = Pathname.new(ruby).realpath
return ruby if ruby == real_ruby
return "#{ruby} => #{real_ruby}"
end
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 33e01f0fc..734f38bdb 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -669,9 +669,9 @@ end
def check_for_autoconf
return if MacOS.xcode_version >= "4.3"
- autoconf = `/usr/bin/which autoconf`.chomp
+ autoconf = which('autoconf')
safe_autoconfs = %w[/usr/bin/autoconf /Developer/usr/bin/autoconf]
- unless autoconf.empty? or safe_autoconfs.include? autoconf then <<-EOS.undent
+ unless autoconf.nil? or safe_autoconfs.include? autoconf.to_s then <<-EOS.undent
An "autoconf" in your path blocks the Xcode-provided version at:
#{autoconf}
diff --git a/Library/Homebrew/cmd/info.rb b/Library/Homebrew/cmd/info.rb
index 0a9cb76db..3fac9f434 100644
--- a/Library/Homebrew/cmd/info.rb
+++ b/Library/Homebrew/cmd/info.rb
@@ -21,7 +21,7 @@ module Homebrew extend self
end
def github_fork
- if system "/usr/bin/which -s git"
+ if which 'git'
if `git remote -v` =~ %r{origin\s+(https?://|git(?:@|://))github.com[:/](.+)/homebrew}
$2
end
diff --git a/Library/Homebrew/cmd/tap.rb b/Library/Homebrew/cmd/tap.rb
index cadebe8ce..1f4ec19b5 100644
--- a/Library/Homebrew/cmd/tap.rb
+++ b/Library/Homebrew/cmd/tap.rb
@@ -12,7 +12,7 @@ module Homebrew extend self
end
def install_tap user, repo
- raise "brew install git" unless system "/usr/bin/which -s git"
+ raise "brew install git" unless which 'git'
# we special case homebrew so users don't have to shift in a terminal
repouser = if user == "homebrew" then "Homebrew" else user end
diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb
index f5530c29f..de797f2d6 100644
--- a/Library/Homebrew/utils.rb
+++ b/Library/Homebrew/utils.rb
@@ -482,8 +482,8 @@ module MacOS extend self
return false unless MACOS
%w[port fink].each do |ponk|
- path = `/usr/bin/which #{ponk} 2>/dev/null`
- return ponk unless path.empty?
+ path = which(ponk)
+ return ponk unless path.nil?
end
# we do the above check because macports can be relocated and fink may be