diff options
| author | Jack Nagel | 2014-09-24 19:43:06 -0500 |
|---|---|---|
| committer | Jack Nagel | 2014-09-24 19:58:10 -0500 |
| commit | 799a2a456e065f831cdb983cba8f52e40d5c4a78 (patch) | |
| tree | e8e04fc372126a67169a902fab4046139cab73fa /Library | |
| parent | 586756209ca528b18e261f0c1fef4d7357f9135c (diff) | |
| download | brew-799a2a456e065f831cdb983cba8f52e40d5c4a78.tar.bz2 | |
Use Dir.glob and array operations to remove whitelisted files
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/doctor.rb | 12 |
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 |
