Rework doc generation to simplify and centralize

Just do all doc generation in the hack::util::gen-docs instead of spread
around. We also only track the generated docs in a single file for the
whole tree.
This commit is contained in:
Eric Paris
2015-08-20 19:17:26 -07:00
parent 9cf7bb6b4f
commit 58d6b29e97
7 changed files with 120 additions and 143 deletions

View File

@@ -23,17 +23,23 @@ 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")
kube::util::ensure-temp-dir
kube::util::gen-docs "${KUBE_TEMP}"
# remove all of the old docs
while read file; do
rm "${KUBE_ROOT}/${file}" 2>/dev/null || true
done <"${KUBE_ROOT}/.generated_docs"
# the shopt is so that we get .generated_docs from the glob.
shopt -s dotglob
cp -af "${KUBE_TEMP}"/* "${KUBE_ROOT}"
shopt -u dotglob
kube::util::gen-doc "${gendocs}" "${KUBE_ROOT}" "docs/user-guide/kubectl/" '###### 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/"
kube::util::gen-analytics "${KUBE_ROOT}"
mungedocs=$(kube::util::find-binary "mungedocs")
"${mungedocs}" "--root-dir=${KUBE_ROOT}/docs/" && ret=0 || ret=$?
if [[ $ret -eq 1 ]]; then
echo "${KUBE_ROOT}/docs/ requires manual changes. See preceding errors."