diff options
| author | Martin Afanasjew | 2016-04-17 05:33:21 +0200 |
|---|---|---|
| committer | Martin Afanasjew | 2016-04-17 20:43:27 +0200 |
| commit | 3680c4667f1a47000c0152ca34bc3af7c41825ac (patch) | |
| tree | 3472665409394a743344b5ac6a39f8f34eeea5a7 /Library | |
| parent | b4b53e5067f8bd0e7bdb37e537ba99a0bb73285f (diff) | |
| download | brew-3680c4667f1a47000c0152ca34bc3af7c41825ac.tar.bz2 | |
man: replace split header/footer with ERB template
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/cmd/man.rb | 14 | ||||
| -rw-r--r-- | Library/Homebrew/manpages/brew.1.md.erb (renamed from Library/Homebrew/manpages/footer.1.md) | 39 | ||||
| -rw-r--r-- | Library/Homebrew/manpages/header.1.md | 38 |
3 files changed, 45 insertions, 46 deletions
diff --git a/Library/Homebrew/cmd/man.rb b/Library/Homebrew/cmd/man.rb index 112eff60d..164eca9b1 100644 --- a/Library/Homebrew/cmd/man.rb +++ b/Library/Homebrew/cmd/man.rb @@ -1,4 +1,5 @@ require "formula" +require "erb" module Homebrew SOURCE_PATH = HOMEBREW_LIBRARY_PATH/"manpages" @@ -38,22 +39,19 @@ module Homebrew end def build_man_page - header = (SOURCE_PATH/"header.1.md").read - footer = (SOURCE_PATH/"footer.1.md").read + template = (SOURCE_PATH/"brew.1.md.erb").read commands = Pathname.glob("#{HOMEBREW_LIBRARY_PATH}/cmd/*.{rb,sh}"). sort_by { |source_file| source_file.basename.sub(/\.(rb|sh)$/, "") }. map { |source_file| - source_file.read. - split("\n"). + source_file.read.lines. grep(/^#:/). map { |line| line.slice(2..-1) }. - join("\n") + join }. - reject { |s| s.strip.empty? }. - join("\n\n") + reject { |s| s.strip.empty? } - header + commands + footer + ERB.new(template, nil, ">").result(binding) end def convert_man_page(markup, target) diff --git a/Library/Homebrew/manpages/footer.1.md b/Library/Homebrew/manpages/brew.1.md.erb index 5ff6656a7..5fc1d7e6d 100644 --- a/Library/Homebrew/manpages/footer.1.md +++ b/Library/Homebrew/manpages/brew.1.md.erb @@ -1,4 +1,43 @@ +brew(1) -- The missing package manager for OS X +=============================================== +## SYNOPSIS + +`brew` `--version`<br> +`brew` <command> [`--verbose`|`-v`] [<options>] [<formula>] ... + +## DESCRIPTION + +Homebrew is the easiest and most flexible way to install the UNIX tools Apple +didn't include with OS X. + +## ESSENTIAL COMMANDS + +For the full command list, see the [COMMANDS][] section. + +With `--verbose` or `-v`, many commands print extra debugging information. Note that these flags should only appear after a command. + + * `install` <formula>: + Install <formula>. + + * `remove` <formula>: + Uninstall <formula>. + + * `update`: + Fetch the newest version of Homebrew from GitHub using `git`(1). + + * `list`: + List all installed formulae. + + * `search` <text>|`/`<text>`/`: + Perform a substring search of formula names for <text>. If <text> is + surrounded with slashes, then it is interpreted as a regular expression. + The search for <text> is extended online to some popular taps. + If no search term is given, all locally available formulae are listed. + +## COMMANDS + +<%= commands.join("\n") %> * `--cache`: Display Homebrew's download cache. See also `HOMEBREW_CACHE`. diff --git a/Library/Homebrew/manpages/header.1.md b/Library/Homebrew/manpages/header.1.md deleted file mode 100644 index 7caf028db..000000000 --- a/Library/Homebrew/manpages/header.1.md +++ /dev/null @@ -1,38 +0,0 @@ -brew(1) -- The missing package manager for OS X -=============================================== - -## SYNOPSIS - -`brew` `--version`<br> -`brew` <command> [`--verbose`|`-v`] [<options>] [<formula>] ... - -## DESCRIPTION - -Homebrew is the easiest and most flexible way to install the UNIX tools Apple -didn't include with OS X. - -## ESSENTIAL COMMANDS - -For the full command list, see the [COMMANDS][] section. - -With `--verbose` or `-v`, many commands print extra debugging information. Note that these flags should only appear after a command. - - * `install` <formula>: - Install <formula>. - - * `remove` <formula>: - Uninstall <formula>. - - * `update`: - Fetch the newest version of Homebrew from GitHub using `git`(1). - - * `list`: - List all installed formulae. - - * `search` <text>|`/`<text>`/`: - Perform a substring search of formula names for <text>. If <text> is - surrounded with slashes, then it is interpreted as a regular expression. - The search for <text> is extended online to some popular taps. - If no search term is given, all locally available formulae are listed. - -## COMMANDS |
