diff options
| author | Markus Reiter | 2017-04-27 10:44:44 +0200 |
|---|---|---|
| committer | Markus Reiter | 2017-04-30 21:11:27 +0200 |
| commit | f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822 (patch) | |
| tree | b49a1211a472e686fed66010e2ddd38ca92cd2a9 /Library/Homebrew/brew.rb | |
| parent | 314483f75c8893eb68073f5863e7784797d6ea2a (diff) | |
| download | brew-f8ad9d7efd5f3f489ed3c1671f16eb2a2eaef822.tar.bz2 | |
Use `PATH` where possible.
Diffstat (limited to 'Library/Homebrew/brew.rb')
| -rw-r--r-- | Library/Homebrew/brew.rb | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 62cfd79c3..f2e723114 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -12,9 +12,9 @@ require "pathname" HOMEBREW_LIBRARY_PATH = Pathname.new(__FILE__).realpath.parent $:.unshift(HOMEBREW_LIBRARY_PATH.to_s) require "global" +require "tap" if ARGV == %w[--version] || ARGV == %w[-v] - require "tap" puts "Homebrew #{HOMEBREW_VERSION}" puts "Homebrew/homebrew-core #{CoreTap.instance.version_string}" exit 0 @@ -47,13 +47,15 @@ begin end end + path = PATH.new(ENV["PATH"]) + # Add contributed commands to PATH before checking. - Dir["#{HOMEBREW_LIBRARY}/Taps/*/*/cmd"].each do |tap_cmd_dir| - ENV["PATH"] += "#{File::PATH_SEPARATOR}#{tap_cmd_dir}" - end + path.append(Pathname.glob(Tap::TAP_DIRECTORY/"*/*/cmd")) # Add SCM wrappers. - ENV["PATH"] += "#{File::PATH_SEPARATOR}#{HOMEBREW_SHIMS_PATH}/scm" + path.append(HOMEBREW_SHIMS_PATH/"scm") + + ENV["PATH"] = path if cmd internal_cmd = require? HOMEBREW_LIBRARY_PATH.join("cmd", cmd) |
