aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorJack Nagel2014-09-24 19:43:06 -0500
committerJack Nagel2014-09-24 19:58:10 -0500
commite5495c38a10c549627f606610b00af75d13e8d06 (patch)
treeec461e6bf7890ac2f21a5d55a83546b70d849f93 /Library/Homebrew/cmd
parent4ec34dc9001d631832c0ae2d997beea93ca953e7 (diff)
downloadhomebrew-e5495c38a10c549627f606610b00af75d13e8d06.tar.bz2
Use Dir.glob and array operations to remove whitelisted files
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/doctor.rb12
1 files changed, 3 insertions, 9 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index 2c0d1bf4a..4ec369737 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -107,16 +107,10 @@ def __check_stray_files(dir, pattern, white_list, message)
return unless File.directory?(dir)
files = Dir.chdir(dir) {
- Dir[pattern].select { |f| File.file?(f) && !File.symlink?(f) }
- }
-
- bad = files.reject { |file|
- white_list.any? { |pat| File.fnmatch?(pat, file) }
- }
-
- bad.map! { |file| File.join(dir, file) }
+ Dir[pattern].select { |f| File.file?(f) && !File.symlink?(f) } - Dir.glob(white_list)
+ }.map { |file| File.join(dir, file) }
- inject_file_list(bad, message) unless bad.empty?
+ inject_file_list(files, message) unless files.empty?
end
def check_for_stray_dylibs