cmd/commands: fix Rubocop warnings.

This commit is contained in:
Mike McQuaid 2016-09-10 10:24:56 +01:00
parent 984e80a7c2
commit 128729988e

View File

@ -41,22 +41,20 @@ module Homebrew
end end
def external_commands def external_commands
paths.reduce([]) do |cmds, path| paths.each_with_object([]) do |path, cmds|
Dir["#{path}/brew-*"].each do |file| Dir["#{path}/brew-*"].each do |file|
next unless File.executable?(file) next unless File.executable?(file)
cmd = File.basename(file, ".rb")[5..-1] cmd = File.basename(file, ".rb")[5..-1]
cmds << cmd unless cmd.include?(".") cmds << cmd unless cmd.include?(".")
end end
cmds
end.sort end.sort
end end
private private
def find_internal_commands(directory) def find_internal_commands(directory)
directory.children.reduce([]) do |cmds, f| directory.children.each_with_object([]) do |f, cmds|
cmds << f.basename.to_s.sub(/\.(?:rb|sh)$/, "") if f.file? cmds << f.basename.to_s.sub(/\.(?:rb|sh)$/, "") if f.file?
cmds
end end
end end
end end