Add rake task to generate man page

This commit is contained in:
Josh Hagins
2016-01-04 16:59:12 -05:00
parent f023072d4f
commit 56308931ef
2 changed files with 6 additions and 55 deletions
-55
View File
@@ -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
#