changed options labels, swagger generator now looks for the given destination path as a file instead of as a directory that contains a swagger.* file pattern

pr
Override-6 2 years ago
parent a8570e86e8
commit f8b70220e3

@ -15,15 +15,15 @@ This command generates the documentation and deploys it on your CodeDoc space
### arguments
- `-d --dir [dir]` path to the documentation root - **required**
- `-l --loc [dir]` location of the documentation sources root - **required**
- `-t --type [docusaurus|doxygen|swagger]` type of documentation generator to use. - **required**
- `-l --dest [dir]` path to where to put the documentation outputs in your repository's CodeDoc space - **optional <u>!! cannot be absolute !!</u>**
- `-d --dest [dir]` path to where to put the documentation outputs in your repository's CodeDoc space - **optional <u>!! cannot be absolute !!</u>**
usage examples :
```
/entrypoint.sh -d ./documentation/api -t swagger -l api_documentation
/entrypoint.sh -d ./documentation/app -t docusaurus -l application_documentation
/entrypoint.sh -d ./src -t doxygen -l sourcecode_documentation
/entrypoint.sh -l ./documentation/api/api-swagger.yml -t swagger -d api_documentation
/entrypoint.sh -l ./documentation/app -t docusaurus -d application_documentation
/entrypoint.sh -l ./src -t doxygen -d sourcecode_documentation
```

@ -8,9 +8,9 @@ echo "Generating and deploying documentation for user $DRONE_REPO_OWNER and repo
help() {
cat <<EOF
usage: $0
-d --dir [dir] path to the documentation root - required
-l --loc [dir] path to the documentation root - required
-t --type [docusaurus|doxygen|swagger] type of documentation generator to use. - required
-l --dest [dir] path to where to put the documentation outputs in your repository's CodeDoc space - optional !! cannot be absolute !!
-d --dest [dir] path to where to put the documentation outputs in your repository's CodeDoc space - optional !! cannot be absolute !!
EOF
exit 1
}
@ -18,11 +18,11 @@ EOF
DEST=""
while [ "$1" ]; do
case "$1" in
"-l" | "--dest")
"-d" | "--dest")
DEST="$2"
shift 1
;;
"-d" | "--dir")
"-l" | "--loc")
DOC_DIR="$2"
shift 1
;;

@ -1,21 +1,21 @@
GEN_PATH="/docs/swagger"
generate() {
SWAGGER_FILE=$(find "$1" -maxdepth 1 -type f -iname "swagger.*" -printf "%f" -quit)
if [[ ! "$SWAGGER_FILE" ]]; then
echo "missing swagger config gile ($1/swagger.*)" >&2
if [[ ! "$1" ]]; then
echo "missing swagger config file ($1)" >&2
fi
mkdir -p $GEN_PATH
echo "<!DOCTYPE html>
<html>
<head>
<meta http-equiv=\"Refresh\" content=\"0; url=/swagger?url=/documentation/${RELATIVE_PATH}$SWAGGER_FILE\" />
<meta http-equiv=\"Refresh\" content=\"0; url=/swagger?url=/documentation/${RELATIVE_PATH}$1\" />
</head>
<body>
<p>Suivez <a href=\"/swagger?url=/swagger?url=/documentation/${RELATIVE_PATH}$SWAGGER_FILE\">ce lien</a>.</p>
<p>Suivez <a href=\"/swagger?url=/swagger?url=/documentation/${RELATIVE_PATH}$1\">ce lien</a>.</p>
</body>
</html>" > $GEN_PATH/CLICKME.html
mkdir -p $GEN_PATH
mv "$SWAGGER_FILE" $GEN_PATH
mv "$1" $GEN_PATH
}

Loading…
Cancel
Save