File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,29 +57,10 @@ readme: ## Generate README.md based on Chart.yaml and template.
5757 @echo " .: ⚙ Generate Helm Docs."
5858 helm-docs --template-files=$(HELM_DOCS_DIR ) /templates.gotmpl --template-files=.helm-docs.gotmpl --template-files=$(HELM_DOCS_DIR ) /README.md.gotmpl
5959
60- # FIXME: #754 Remove .ONESHELL which is unsupported on some systems
6160.PHONY : hook-docs
6261hook-docs : # # Generate documentation for hooks.
63- cd hooks; \
64- find . -type f ! -name " $( printf " *\n*" ) " -name Chart.yaml | while IFS= read -r chart; do \
65- (dir=" $$ (dirname " $$ {chart}" )" ; \
66- echo " Processing Helm Chart in $$ dir" ; \
67- cd " $$ {dir}" || exit ; \
68- if [ -d " docs" ]; then \
69- echo " Docs Folder found at: $$ {dir}/docs" ; \
70- helm-docs \
71- --template-files=" $( HELM_DOCS_DIR) /templates.gotmpl" \
72- --template-files=" .helm-docs.gotmpl" \
73- --template-files=" $( HELM_DOCS_DIR) /README.DockerHub-Hook.md.gotmpl" \
74- --output-file=" docs/README.DockerHub-Hook.md" ; \
75- helm-docs \
76- --template-files=" $( HELM_DOCS_DIR) /templates.gotmpl" \
77- --template-files=" .helm-docs.gotmpl" \
78- --template-files=" $( HELM_DOCS_DIR) /README.ArtifactHub.md.gotmpl" \
79- --output-file=" docs/README.ArtifactHub.md" ; \
80- else \
81- echo " Ignoring Docs creation process for Chart $$ dir, because no docs folder found at: $$ {dir}/docs" ; \
82- fi) \
62+ @for chart in $(HOOKS_CHART_LIST ) ; do \
63+ $(BIN_DIR ) /generate-docs.sh --hook " $$ {chart}" $(HELM_DOCS_DIR ) ; \
8364 done
8465
8566.PHONY : scanner-docs
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ COLOR_PREFIX="\e[32m"
1010COLOR_ERROR=" \e[31m"
1111COLOR_RESET=" \e[0m"
1212
13- USAGE=" $( basename " ${0} " ) --scanner path/to/scanner/Chart.yaml path/to/.helm-docs"
13+ USAGE=" $( basename " ${0} " ) --scanner|--hook path/to/scanner/Chart.yaml path/to/.helm-docs"
1414
1515DOC_TYPE=" ${1:- } "
1616CHART_FILE=" ${2:- } "
@@ -106,11 +106,39 @@ function generate_scanner_docs() {
106106 " ${HELM_DOCS_DIR} /README.ArtifactHub.md.gotmpl"
107107}
108108
109+ function generate_hook_docs() {
110+ log " Generating hook docs for ${CHART_FILE} ..."
111+
112+ local hook_dir docs_dir
113+
114+ hook_dir=" $( dirname " ${CHART_FILE} " ) "
115+ docs_dir=" ${hook_dir} /docs"
116+
117+ if [ ! -d " ${docs_dir} " ]; then
118+ log " Ignoring docs creation process for '${CHART_FILE} ' because docs folder found at: '${docs_dir} '!"
119+ exit 0
120+ fi
121+
122+ generate_docs " ${hook_dir} " \
123+ " docs/README.DockerHub-Hook.md" \
124+ " ${HELM_DOCS_DIR} /templates.gotmpl" \
125+ " ${hook_dir} /.helm-docs.gotmpl" \
126+ " ${HELM_DOCS_DIR} /README.DockerHub-Hook.md.gotmpl"
127+ generate_docs " ${hook_dir} " \
128+ " docs/README.ArtifactHub.md" \
129+ " ${HELM_DOCS_DIR} /templates.gotmpl" \
130+ " ${hook_dir} /.helm-docs.gotmpl" \
131+ " ${HELM_DOCS_DIR} /README.ArtifactHub.md.gotmpl"
132+ }
133+
109134function main() {
110135 case " ${DOC_TYPE} " in
111136 " --scanner" )
112137 generate_scanner_docs
113138 ;;
139+ " --hook" )
140+ generate_hook_docs
141+ ;;
114142 * )
115143 error " Unsupported doc type: ${DOC_TYPE} !"
116144 error " ${USAGE} "
You can’t perform that action at this time.
0 commit comments