diff options
| author | Jack Nagel | 2013-05-23 23:07:20 -0500 |
|---|---|---|
| committer | Jack Nagel | 2013-05-23 23:07:20 -0500 |
| commit | 187b9c9d593be13b137da7fb675764f57b03a8db (patch) | |
| tree | 95d1d4f4f05b51bf851dcdc8096b79fe8be27e6b /Library/Homebrew/cmd | |
| parent | 6a020239d14d5a5d8a8853f8d619b0d4b6b1b57a (diff) | |
| download | brew-187b9c9d593be13b137da7fb675764f57b03a8db.tar.bz2 | |
doctor: simplify trailing slash checks
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 8139ee152..315cfcc8a 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -41,14 +41,10 @@ end class Checks ############# HELPERS - def remove_trailing_slash s - (s[s.length-1] == '/') ? s[0,s.length-1] : s - end - def paths @paths ||= ENV['PATH'].split(':').collect do |p| begin - remove_trailing_slash(File.expand_path(p)) + File.expand_path(p).chomp('/') rescue ArgumentError onoe "The following PATH component is invalid: #{p}" end @@ -72,7 +68,7 @@ class Checks # Sorry for the lack of an indent here, the diff would have been unreadable. # See https://github.com/mxcl/homebrew/pull/9986 def check_path_for_trailing_slashes - bad_paths = ENV['PATH'].split(':').select{|p| p[p.length-1, p.length] == '/'} + bad_paths = ENV['PATH'].split(':').select { |p| p[-1..-1] == '/' } return if bad_paths.empty? s = <<-EOS.undent Some directories in your path end in a slash. |
