aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMike McQuaid2017-10-20 18:10:31 +0100
committerGitHub2017-10-20 18:10:31 +0100
commited28ed78d1c462d10e4fd9c3ea18e9dd0385e3a5 (patch)
treed486c59adfa79f2a47ba1b4abd9ad07c9c3323ae /Library
parent76cd7c79498daf380d99ed7379394618164b602b (diff)
parent43cbf08018c6ed8f3bc2142c368ba7b7c9fcf49e (diff)
downloadbrew-ed28ed78d1c462d10e4fd9c3ea18e9dd0385e3a5.tar.bz2
Merge pull request #3304 from richiethomas/refactor_uses
In 'readall.rb', replaced multi-step 'each' loop with one-line method chain of Ruby enumerator methods
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/list.rb2
-rw-r--r--Library/Homebrew/cmd/readall.rb12
2 files changed, 3 insertions, 11 deletions
diff --git a/Library/Homebrew/cmd/list.rb b/Library/Homebrew/cmd/list.rb
index 263f33564..f17667286 100644
--- a/Library/Homebrew/cmd/list.rb
+++ b/Library/Homebrew/cmd/list.rb
@@ -39,7 +39,7 @@ module Homebrew
filtered_list
elsif ARGV.named.empty?
if ARGV.include? "--full-name"
- full_names = Formula.installed.map(&:full_name).sort &tap_and_name_comparison
+ full_names = Formula.installed.map(&:full_name).sort(&tap_and_name_comparison)
return if full_names.empty?
puts Formatter.columns(full_names)
else
diff --git a/Library/Homebrew/cmd/readall.rb b/Library/Homebrew/cmd/readall.rb
index e628cb090..9fac52713 100644
--- a/Library/Homebrew/cmd/readall.rb
+++ b/Library/Homebrew/cmd/readall.rb
@@ -14,16 +14,8 @@ module Homebrew
def readall
if ARGV.include?("--syntax")
- ruby_files = []
- scan_files = %W[
- #{HOMEBREW_LIBRARY}/*.rb
- #{HOMEBREW_LIBRARY}/Homebrew/**/*.rb
- ]
- Dir.glob(scan_files).each do |rb|
- next if rb.include?("/vendor/")
- next if rb.include?("/cask/")
- ruby_files << rb
- end
+ scan_files = "#{HOMEBREW_LIBRARY_PATH}/**/*.rb"
+ ruby_files = Dir.glob(scan_files).reject { |file| file =~ %r{/(vendor|cask)/} }
Homebrew.failed = true unless Readall.valid_ruby_syntax?(ruby_files)
end