diff options
| author | Jack Nagel | 2012-05-07 20:32:04 -0500 |
|---|---|---|
| committer | Jack Nagel | 2012-05-07 21:05:47 -0500 |
| commit | 68124d481f7938f3bf280fb92d370a0de9a9b80f (patch) | |
| tree | f90db02fcdad95975fb43f830343d014563ced16 /Library/Homebrew/cmd | |
| parent | fa1edd684653e324d36c431fa8bc33b95e651f9e (diff) | |
| download | brew-68124d481f7938f3bf280fb92d370a0de9a9b80f.tar.bz2 | |
Unify 'which' and which_s' utility methods
'which' only returns a Pathname or nil, and doesn't care about anything
sent to stderr, so just silence it by default and combine the two
methods.
Closes Homebrew/homebrew#12115.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 12 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/update.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/cmd/versions.rb | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index b4c99a7e6..1940ff272 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -633,7 +633,7 @@ def check_for_multiple_volumes end def check_for_git - unless which_s "git" then <<-EOS.undent + unless which "git" then <<-EOS.undent Git could not be found in your PATH. Homebrew uses Git for several internal functions, and some formulae use Git checkouts instead of stable tarballs. You may want to install Git: @@ -643,7 +643,7 @@ def check_for_git end def check_git_newline_settings - return unless which_s "git" + return unless which "git" autocrlf = `git config --get core.autocrlf`.chomp safecrlf = `git config --get core.safecrlf`.chomp @@ -774,7 +774,7 @@ def check_missing_deps end def check_git_status - return unless which_s "git" + return unless which "git" HOMEBREW_REPOSITORY.cd do unless `git status -s -- Library/Homebrew/ 2>/dev/null`.chomp.empty? then <<-EOS.undent You have uncommitted modifications to Homebrew's core. @@ -803,7 +803,7 @@ end def check_git_version # see https://github.com/blog/642-smart-http-support - return unless which_s "git" + return unless which "git" `git --version`.chomp =~ /git version (\d)\.(\d)\.(\d)/ if $2.to_i < 6 or $2.to_i == 6 and $3.to_i < 6 then <<-EOS.undent @@ -815,7 +815,7 @@ def check_git_version end def check_for_enthought_python - if which_s "enpkg" then <<-EOS.undent + if which "enpkg" then <<-EOS.undent Enthought Python was found in your PATH. This can cause build problems, as this software installs its own copies of iconv and libxml2 into directories that are picked up by @@ -825,7 +825,7 @@ def check_for_enthought_python end def check_for_bad_python_symlink - return unless which_s "python" + return unless which "python" # Indeed Python --version outputs to stderr (WTF?) `python --version 2>&1` =~ /Python (\d+)\./ unless $1 == "2" then <<-EOS.undent diff --git a/Library/Homebrew/cmd/update.rb b/Library/Homebrew/cmd/update.rb index 26edaf204..428014291 100644 --- a/Library/Homebrew/cmd/update.rb +++ b/Library/Homebrew/cmd/update.rb @@ -4,7 +4,7 @@ require 'cmd/untap' module Homebrew extend self def update - abort "Please `brew install git' first." unless which_s "git" + abort "Please `brew install git' first." unless which "git" # ensure GIT_CONFIG is unset as we need to operate on .git/config ENV.delete('GIT_CONFIG') diff --git a/Library/Homebrew/cmd/versions.rb b/Library/Homebrew/cmd/versions.rb index ba312ab6f..267551106 100644 --- a/Library/Homebrew/cmd/versions.rb +++ b/Library/Homebrew/cmd/versions.rb @@ -2,7 +2,7 @@ require 'formula' module Homebrew extend self def versions - raise "Please `brew install git` first" unless which_s "git" + raise "Please `brew install git` first" unless which "git" raise "Please `brew update' first" unless (HOMEBREW_REPOSITORY/".git").directory? raise FormulaUnspecifiedError if ARGV.named.empty? |
