generated from GovStackWorkingGroup/bb-template
-
Notifications
You must be signed in to change notification settings - Fork 6
/
dev.sh
executable file
·109 lines (83 loc) · 2.6 KB
/
dev.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
set -e
echo "Consent BB development script"
echo ""
echo "This runs a developer-version of what happens in the Circle CI configuration."
if [ "$1" == "build-openapi-assets" ]
then
echo "Building openapi.yaml and mock application"
./api/govstack_csv_to_openapi.py \
"api/GovStack Consent BB API endpoints - endpoints.csv" \
"api/GovStack Consent BB API endpoints - schema.csv" \
> "api/consent-openapi.yaml"
./api/govstack_csv_to_openapi.py \
"api/GovStack Consent BB API endpoints - endpoints.csv" \
"api/GovStack Consent BB API endpoints - schema.csv" \
--django-api > "examples/mock/djangoapp/consentbb/app/api_autogenerated.py"
./api/govstack_csv_to_openapi.py \
"api/GovStack Consent BB API endpoints - endpoints.csv" \
"api/GovStack Consent BB API endpoints - schema.csv" \
--django-models > "examples/mock/djangoapp/consentbb/app/models.py"
./api/govstack_csv_to_openapi.py \
"api/GovStack Consent BB API endpoints - endpoints.csv" \
"api/GovStack Consent BB API endpoints - schema.csv" \
--django-ninja-schemas > "examples/mock/djangoapp/consentbb/app/schemas.py"
./api/govstack_csv_to_openapi.py \
"api/GovStack Consent BB API endpoints - endpoints.csv" \
"api/GovStack Consent BB API endpoints - schema.csv" \
--django-admin > "examples/mock/djangoapp/consentbb/app/admin.py"
exit
fi
if [ "$1" == "gitbook-api-spec" ]
then
./api/govstack_csv_to_openapi.py \
"api/GovStack Consent BB API endpoints - endpoints.csv" \
"api/GovStack Consent BB API endpoints - schema.csv" \
> "api/consent-openapi.yaml"
./api/govstack_csv_to_openapi.py \
"api/GovStack Consent BB API endpoints - endpoints.csv" \
"api/GovStack Consent BB API endpoints - schema.csv" \
--gitbook-api-spec
exit
fi
if [ "$1" == "build" ]
then
cd ./test/gherkin/
docker build . -t test:latest
cd -
cd ./examples/mock/
docker-compose build
cd -
exit
fi
cd ./examples/mock/
if [ "$1" == "fixtures" ]
then
docker-compose exec -it consent python manage.py dumpdata app --indent 2 > ./djangoapp/fixtures.json
exit 0
fi
if [ "$1" == "test" ]
then
docker-compose up -d
else
echo ""
echo "Running the consent BB mocking application."
echo ""
echo "By default, you can reach it on:"
echo "http://localhost:8080"
echo "https://localhost:8888 (HTTPS)"
echo "http://localhost:8000 (Django mock application direct access)"
docker-compose up --build
fi
cd -
if [ "$1" == "test" ]
then
echo "Running test suites..."
echo ""
cd ./test/gherkin
./test_entrypoint.sh
cd -
cd ./examples/mock/
docker-compose stop
cd -
fi