brew doctor - only check unique path folders

This commit is contained in:
Adam Vandenberg 2011-03-29 12:45:54 -07:00
parent f523662ce5
commit 4a4186c583

View File

@ -28,6 +28,12 @@ def is_prefix? prefix, longer_string
longer_string.to_s[0,p.length] == p
end
def path_folders
ENV['PATH'].split(':').collect{|p| File.expand_path p}.uniq
end
# Installing MacGPG2 interferes with Homebrew in a big way
# http://sourceforge.net/projects/macgpg2/files/
def check_for_macgpg2
@ -240,9 +246,7 @@ def check_user_path
seen_prefix_sbin = false
seen_usr_bin = false
paths = ENV['PATH'].split(':').collect{|p| File.expand_path p}
paths.each do |p|
path_folders.each do |p|
if p == '/usr/bin'
seen_usr_bin = true
unless seen_prefix_bin
@ -375,8 +379,7 @@ def check_for_config_scripts
config_scripts = []
paths = ENV['PATH'].split(':').collect{|p| File.expand_path p}
paths.each do |p|
path_folders.each do |p|
next if ['/usr/bin', '/usr/sbin', '/usr/X11/bin', "#{HOMEBREW_PREFIX}/bin", "#{HOMEBREW_PREFIX}/sbin"].include? p
next if p =~ %r[^(#{real_cellar.to_s}|#{HOMEBREW_CELLAR.to_s})]
@ -441,7 +444,7 @@ def check_for_multiple_volumes
real_cellar = HOMEBREW_CELLAR.realpath
tmp_prefix = ENV['HOMEBREW_TEMP'] || '/tmp'
tmp=Pathname.new `/usr/bin/mktemp -d #{tmp_prefix}/homebrew-brew-doctor-XXXX`.strip
tmp = Pathname.new `/usr/bin/mktemp -d #{tmp_prefix}/homebrew-brew-doctor-XXXX`.strip
real_temp = tmp.realpath.parent
where_cellar = volumes.which real_cellar