From d9c586e201b6d5ebfd7ccfe466808a2214494c0f Mon Sep 17 00:00:00 2001 From: Jack Nagel <jacknagel@gmail.com> Date: Thu, 19 Jun 2014 19:32:37 -0500 Subject: [PATCH] Remove unnecessary string evals from doctor --- Library/Homebrew/cmd/doctor.rb | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 57c8b12891..48c86af0ae 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -377,20 +377,19 @@ def check_access_usr_local end %w{include etc lib lib/pkgconfig share}.each do |d| - class_eval <<-EOS, __FILE__, __LINE__ + 1 - def check_access_#{d.sub("/", "_")} - if (dir = HOMEBREW_PREFIX+'#{d}').exist? && !dir.writable_real? - <<-EOF.undent - \#{dir} isn't writable. - This can happen if you "sudo make install" software that isn't managed by - by Homebrew. If a brew tries to write a file to this directory, the - install will fail during the link step. - - You should probably `chown` \#{dir} - EOF - end + define_method("check_access_#{d.sub("/", "_")}") do + dir = HOMEBREW_PREFIX.join(d) + if dir.exist? && !dir.writable_real? then <<-EOS.undent + #{dir} isn't writable. + + This can happen if you "sudo make install" software that isn't managed by + by Homebrew. If a formula tries to write a file to this directory, the + install will fail during the link step. + + You should probably `chown` #{dir} + EOS end - EOS + end end def check_access_logs -- GitLab