-
Notifications
You must be signed in to change notification settings - Fork 11
/
swagger.sh
executable file
·50 lines (45 loc) · 1.55 KB
/
swagger.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env bash
set -e
if [ ! -f ./swagger-codegen-cli.jar ]; then
echo "File swagger not found! Try download..."
FILE="https://github.com/devopshq/teamcity/releases/download/0.0.0/swagger-codegen-cli.jar"
wget $FILE -O swagger-codegen-cli.jar || \
(
echo "Something wrong, please download $FILE manually and place in current directory"; rm ./swagger-codegen-cli.jar; \
exit 11
)
fi
echo "Start generate"
java -Xmx8192m -Xms1024m -jar ./swagger-codegen-cli.jar generate \
-l python \
-c ./swagger/swagger-config.json \
-t ./swagger/template/ \
-D models -Dapis -D docs \
-i ./swagger/swagger.json
## I do not known why, but it is not working, and we have 'No description' in files...
## --additional-properties appDescription="Python Client for TeamCity REST API"
## -D appDescription="Python Client for TeamCity REST API"
#
echo "" >> './dohq_teamcity/models/file.py'
echo "file = File" >> './dohq_teamcity/models/file.py'
mkdir ./docs-sphinx/swagger || echo "Swagger folder exist"
mkdir ./docs-sphinx/swagger/api || echo "API folder exitst"
mkdir ./docs-sphinx/swagger/models || echo "API folder exitst"
mv -vf docs/*Api.md ./docs-sphinx/swagger/api
mv -vf docs/*.md ./docs-sphinx/swagger/models/
rmdir docs
pushd ./docs-sphinx/swagger/api
for file in *.md
do
mv "$file" "${file%.md}.rst"
done
popd
pushd ./docs-sphinx/swagger/models/
for file in *.md
do
mv "$file" "${file%.md}.rst"
done
popd
# Auto PEP8
pip install autopep8
autopep8 --in-place --aggressive --max-line-length 120 --recursive dohq_teamcity