dev-cmd/man: fix Rubocop warnings.

This commit is contained in:
Mike McQuaid 2016-09-11 17:41:51 +01:00
parent e6b057ea76
commit 71fd2bb4b0

View File

@ -34,15 +34,15 @@ module Homebrew
end end
def path_glob_commands(glob) def path_glob_commands(glob)
Pathname.glob(glob). Pathname.glob(glob)
sort_by { |source_file| sort_key_for_path(source_file) }. .sort_by { |source_file| sort_key_for_path(source_file) }
map { |source_file| .map do |source_file|
source_file.read.lines. source_file.read.lines
grep(/^#:/). .grep(/^#:/)
map { |line| line.slice(2..-1) }. .map { |line| line.slice(2..-1) }
join .join
}. end
reject { |s| s.strip.empty? || s.include?("@hide_from_man_page") } .reject { |s| s.strip.empty? || s.include?("@hide_from_man_page") }
end end
def build_man_page def build_man_page
@ -51,11 +51,11 @@ module Homebrew
variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}") variables[:commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}")
variables[:developer_commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}") variables[:developer_commands] = path_glob_commands("#{HOMEBREW_LIBRARY_PATH}/dev-cmd/*.{rb,sh}")
variables[:maintainers] = (HOMEBREW_REPOSITORY/"README.md"). variables[:maintainers] = (HOMEBREW_REPOSITORY/"README.md")
read[/Homebrew's current maintainers are (.*)\./, 1]. .read[/Homebrew's current maintainers are (.*)\./, 1]
scan(/\[([^\]]*)\]/).flatten .scan(/\[([^\]]*)\]/).flatten
ERB.new(template, nil, ">").result(variables.instance_eval{ binding }) ERB.new(template, nil, ">").result(variables.instance_eval { binding })
end end
def sort_key_for_path(path) def sort_key_for_path(path)