aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorMax Howell2011-08-31 15:38:11 +0100
committerMax Howell2011-08-31 15:38:11 +0100
commit327945ef5cbc296fca4c8307983e47f41bd10445 (patch)
tree6b053d998f59d90ad0fee8f483187d043388f09a /Library/Homebrew/cmd
parent339142932af3819f24d1e3fae6a11d550135b6a7 (diff)
downloadhomebrew-327945ef5cbc296fca4c8307983e47f41bd10445.tar.bz2
Only report PATH order diagnosis if conflicts are found
Rationale: brew doctor shouldn't give warnings for a default install. And this particular warning only applies for a small subset of formula: the ones that are "dupes". If we get reported issues that prove this was a mistake we will revert it.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/doctor.rb34
1 files changed, 19 insertions, 15 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 1fd78701c..99cb221c6 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -319,25 +319,29 @@ def check_user_path
seen_prefix_sbin = false
seen_usr_bin = false
- path_folders.each do |p|
- if p == '/usr/bin'
+ path_folders.each do |p| case p
+ when '/usr/bin'
seen_usr_bin = true
unless seen_prefix_bin
- puts <<-EOS.undent
- /usr/bin is in your PATH before Homebrew's bin. This means that system-
- provided programs will be used before Homebrew-provided ones. This is an
- issue if you install, for instance, Python.
-
- Consider editing your .bashrc to put:
- #{HOMEBREW_PREFIX}/bin
- ahead of /usr/bin in your $PATH.
-
- EOS
+ # only show the doctor message if there are any conflicts
+ # rationale: a default install should not trigger any brew doctor messages
+ if Dir["#{HOMEBREW_PREFIX}/bin/*"].any? {|fn| File.exist? "/usr/bin/#{File.basename fn}"}
+ ohai "/usr/bin occurs before #{HOMEBREW_PREFIX}/bin"
+ puts <<-EOS.undent
+ This means that system-provided programs will be used instead of those
+ provided by Homebrew. This is an issue if you eg. brew installed Python.
+
+ Consider editing your .bashrc to put:
+ #{HOMEBREW_PREFIX}/bin
+ ahead of /usr/bin in your $PATH.
+ EOS
+ end
end
+ when "#{HOMEBREW_PREFIX}/bin"
+ seen_prefix_bin = true
+ when "#{HOMEBREW_PREFIX}/sbin"
+ seen_prefix_sbin = true
end
-
- seen_prefix_bin = true if p == "#{HOMEBREW_PREFIX}/bin"
- seen_prefix_sbin = true if p == "#{HOMEBREW_PREFIX}/sbin"
end
unless seen_prefix_bin