homebrew-cask/developer/bin/generate_man_pages

56 lines
1012 B
Plaintext
Raw Normal View History

2014-01-30 00:09:29 +08:00
#!/bin/bash
#
# generate_man_pages
#
# This is temporary, should be replaced with a Rakefile target
#
2014-02-08 00:01:50 +08:00
###
### 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="$@"
if ! [[ $message =~ "\n"$ ]]; then
message="${message}\n"
fi
printf "$message" 1>&2
}
die () {
warn "$@"
exit 1
}
2014-01-30 00:09:29 +08:00
cd_to_project_root () {
2014-02-08 00:01:50 +08:00
local script_dir="$(/usr/bin/dirname "$0")"
2014-01-30 00:09:29 +08:00
cd "$script_dir"
local git_root="$(git rev-parse --show-toplevel)"
if [[ -z "$git_root" ]]; then
2014-02-08 00:01:50 +08:00
die "ERROR: Could not find git project root"
2014-01-30 00:09:29 +08:00
fi
cd "$git_root"
}
2014-02-08 00:01:50 +08:00
###
### main
###
cd_to_project_root
2014-01-30 00:09:29 +08:00
2014-02-08 00:02:30 +08:00
if ! /usr/bin/which ronn >/dev/null 2>&1; then
die "ERROR: The 'ronn' gem must be installed"
fi
2014-01-30 00:09:29 +08:00
ronn --roff --pipe --organization='Homebrew-cask' --manual='brew-cask' doc/src/brew-cask.1.md > doc/man/brew-cask.1
#