mirror of
https://github.com/wavetermdev/homebrew-cask.git
synced 2026-08-05 13:43:24 -07:00
Add rake task to generate man page
This commit is contained in:
@@ -32,3 +32,9 @@ task :console do
|
||||
ARGV.clear
|
||||
Hbc.pry
|
||||
end
|
||||
|
||||
desc 'Generate man page from Markdown source'
|
||||
task :man do
|
||||
sh 'ronn --roff --pipe --organization=Homebrew-cask --manual=brew-cask ' \
|
||||
'doc/src/brew-cask.1.md > man/man1/brew-cask.1'
|
||||
end
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# generate_man_pages
|
||||
#
|
||||
# This is temporary, should be replaced with a Rakefile target
|
||||
#
|
||||
|
||||
###
|
||||
### settings
|
||||
###
|
||||
|
||||
set -e # exit on uncaught error
|
||||
set +o histexpand # don't expand history expressions
|
||||
shopt -s nocasematch # case-insensitive regular expressions
|
||||
|
||||
###
|
||||
### functions
|
||||
###
|
||||
|
||||
warn () {
|
||||
local message="$@"
|
||||
message="${message//\\t/$'\011'}"
|
||||
message="${message//\\n/$'\012'}"
|
||||
message="${message%"${message##*[![:space:]]}"}"
|
||||
printf "%s\n" "$message" 1>&2
|
||||
}
|
||||
|
||||
die () {
|
||||
warn "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
cd_to_project_root () {
|
||||
local script_dir="$(/usr/bin/dirname "$0")"
|
||||
cd "$script_dir"
|
||||
local git_root="$(git rev-parse --show-toplevel)"
|
||||
if [[ -z "$git_root" ]]; then
|
||||
die "ERROR: Could not find git project root"
|
||||
fi
|
||||
cd "$git_root"
|
||||
}
|
||||
|
||||
###
|
||||
### main
|
||||
###
|
||||
|
||||
cd_to_project_root
|
||||
|
||||
if ! /usr/bin/which ronn >/dev/null 2>&1; then
|
||||
die "ERROR: The 'ronn' gem must be installed"
|
||||
fi
|
||||
|
||||
ronn --roff --pipe --organization='Homebrew-cask' --manual='brew-cask' doc/src/brew-cask.1.md > man/man1/brew-cask.1
|
||||
|
||||
#
|
||||
Reference in New Issue
Block a user