diff --git a/Makefile b/Makefile index c528b12b871efeac6e1d4c0424a91df5fbf1190e..2c62a031ca005d82e9a3dd8418eaa9149ad12556 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ TAG ?= latest -all: build-docs +all: build clean: rm -rf ./site @@ -16,10 +16,10 @@ verify: build: mkdocs build - cd ./swagger && bash ./generate.sh + bash ./swagger/generate.sh build-swagger: - cd ./swagger && UPDATE=1 ./generate.sh + bash ./swagger/generate.sh deploy-docs: tar czfv ./final.tar.gz ./final diff --git a/swagger/generate.sh b/swagger/generate.sh index a5ca8017a498d330ad46681648897aae8c6fc371..710d30b71e383380c76000fd01411ab59882b227 100755 --- a/swagger/generate.sh +++ b/swagger/generate.sh @@ -14,40 +14,40 @@ services[9099]=metadata function retrieve () { if [[ "$2" == analyse ]]; then echo "... retrieve json api from localhost:$1" - wget "http://localhost:$1/api-$2.json" -O "./api-$2.yaml" -q + wget "http://localhost:$1/api-$2.json" -O "./swagger/api-$2.yaml" -q else echo "... retrieve yaml api from localhost:$1" - wget "http://localhost:$1/v3/api-docs.yaml" -O "./api-$2.yaml" -q + wget "http://localhost:$1/v3/api-docs.yaml" -O "./swagger/api-$2.yaml" -q fi } function generate () { echo "... generate python api" - java -jar swagger-codegen-cli.jar generate -i "./api-$1.yaml" -l python -o "./api-$1" > /dev/null + java -jar swagger-codegen-cli.jar generate -i "./swagger/api-$1.yaml" -l python -o "./swagger/api-$1" > /dev/null } function remove () { echo "... removing old python api" - rm -rf "./api/api_$1" + rm -rf "./swagger/api/api_$1" } function copy () { echo "... copying python api" - cp -r "./api-$1/swagger_client" "./api/api_$1" - cp "./api-$1.yaml" "./$1/api.yaml" - cp -r ../dist/* "./$1" + cp -r "./swagger/api-$1/swagger_client" "./swagger/api/api_$1" + cp "./swagger/api-$1.yaml" "./swagger/$1/api.yaml" + cp -r ./dist/* "./swagger/$1" } function replace () { echo "... replacing swagger client package name and gateway" - find "./api/api_$2" -type f -exec sed -i -e "s/swagger_client/api_$2/g" {} \; - find "./api/api_$2" -type f -exec sed -i -e "s/self.host = .*/self.host = \"http:\/\/localhost:9095\"/g" {} \; + find "./swagger/api/api_$2" -type f -exec sed -i -e "s/swagger_client/api_$2/g" {} \; + find "./swagger/api/api_$2" -type f -exec sed -i -e "s/self.host = .*/self.host = \"http:\/\/localhost:9095\"/g" {} \; } function move () { echo "... moving swagger static files" - mkdir -p ../site/swagger - cp -r "./$1" ../site/swagger + mkdir -p ./site/swagger + cp -r "./swagger/$1" ./site/swagger } for key in "${!services[@]}"; do