Merge pull request #10762 from erictune/toc

Automatic Doc Editing, with Table of Contents Generation
This commit is contained in:
Victor Marmol
2015-07-09 08:13:45 -07:00
7 changed files with 385 additions and 7 deletions

View File

@@ -64,6 +64,7 @@ kube::golang::test_targets() {
cmd/integration
cmd/gendocs
cmd/genman
cmd/mungedocs
cmd/genbashcomp
cmd/genconversion
cmd/gendeepcopy

View File

@@ -22,23 +22,34 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
"${KUBE_ROOT}/hack/build-go.sh" cmd/gendocs cmd/genman cmd/genbashcomp
"${KUBE_ROOT}/hack/build-go.sh" cmd/gendocs cmd/genman cmd/genbashcomp cmd/mungedocs
# Find binary
gendocs=$(kube::util::find-binary "gendocs")
genman=$(kube::util::find-binary "genman")
genbashcomp=$(kube::util::find-binary "genbashcomp")
mungedocs=$(kube::util::find-binary "mungedocs")
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" ]]; then
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" || ! -x "$mungedocs" ]]; then
{
echo "It looks as if you don't have a compiled gendocs, genman, or genbashcomp binary"
echo "It looks as if you don't have a compiled gendocs, genman, genbashcomp or mungedocs binary"
echo
echo "If you are running from a clone of the git repo, please run"
echo "'./hack/build-go.sh cmd/gendocs cmd/genman cmd/genbashcomp'."
echo "'./hack/build-go.sh cmd/gendocs cmd/genman cmd/genbashcomp cmd/mungedocs'."
} >&2
exit 1
fi
"${mungedocs}" "--root-dir=${KUBE_ROOT}/docs/"
ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/docs/ requires manual changes. See proceeding errors."
exit 1
elif [[ $ret -eq 2 ]]; then
echo "Error running mungedocs."
exit 1
fi
kube::util::gen-doc "${gendocs}" "${KUBE_ROOT}/docs/" '###### Auto generated by spf13/cobra'
kube::util::gen-doc "${genman}" "${KUBE_ROOT}/docs/man/man1"
kube::util::gen-doc "${genbashcomp}" "${KUBE_ROOT}/contrib/completions/bash/"

View File

@@ -23,16 +23,18 @@ source "${KUBE_ROOT}/hack/lib/init.sh"
kube::golang::setup_env
# Find binary
gendocs=$(kube::util::find-binary "gendocs")
genman=$(kube::util::find-binary "genman")
genbashcomp=$(kube::util::find-binary "genbashcomp")
mungedocs=$(kube::util::find-binary "mungedocs")
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" ]]; then
if [[ ! -x "$gendocs" || ! -x "$genman" || ! -x "$genbashcomp" || ! -x "$mungedocs" ]]; then
{
echo "It looks as if you don't have a compiled gendocs, genman, or genbashcomp binary"
echo "It looks as if you don't have a compiled gendocs, genman, genbashcomp or mungedocs binary"
echo
echo "If you are running from a clone of the git repo, please run"
echo "'./hack/build-go.sh cmd/gendocs cmd/genman cmd/genbashcomp'."
echo "'./hack/build-go.sh cmd/gendocs cmd/genman cmd/genbashcomp cmd/mungedocs'."
} >&2
exit 1
fi
@@ -44,6 +46,17 @@ _tmp="${KUBE_ROOT}/_tmp"
mkdir -p "${_tmp}"
cp -a "${DOCROOT}" "${TMP_DOCROOT}"
"${mungedocs}" "--verify=true" "--root-dir=${TMP_DOCROOT}"
ret=$?
if [[ $ret -eq 1 ]]; then
echo "${DOCROOT} is out of date. Please run hack/run-gendocs.sh"
exit 1
fi
if [[ $ret -eq 2 ]]; then
echo "Error running mungedocs"
exit 1
fi
kube::util::gen-doc "${genman}" "${TMP_DOCROOT}/man/man1/"
kube::util::gen-doc "${gendocs}" "${TMP_DOCROOT}"
echo "diffing ${DOCROOT} against freshly generated docs"