mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-15 14:14:39 +00:00
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:
@@ -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."
|
||||
|
Reference in New Issue
Block a user