source: src/mapservice/codegen/code_generator@ 3db3d13

debian/bullseye
Last change on this file since 3db3d13 was a249e2d, checked in by Joachim Langenbach <joachim.langenbach@…>, 7 years ago
  • Removed static files from gnuboat_mapservice, because they are not needed
    • Removed template symlink, because it is not needed anymore (s. commit fixing the template folder path)
  • Property mode set to 100755
File size: 2.6 KB
Line 
1#!/bin/bash
2
3DIR=`dirname "$0"`
4SRC_GEN="${DIR}/../src-gen"
5PACKAGE_NAME="gnuboat_mapservice"
6PACKAGE_VERSION="0.5.99"
7TARGET="${SRC_GEN}/${PACKAGE_NAME}/"
8CELERY_WORKER_SCRIPT="${SRC_GEN}/celery_worker"
9TOX_INSTALL_COMMAND="${SRC_GEN}/tox_install_command"
10
11echo "Cleaning directory"
12rm -R "${SRC_GEN}"
13
14echo "Preparing symlinks"
15mkdir -p "${TARGET}"
16cd "${TARGET}"
17mkdir -p server_impl
18cp -a ../../server_impl/* server_impl/
19
20#echo "Copying static files"
21mkdir -p templates
22cp -a ../../templates/* templates/
23
24echo "Generating backend and client API code"
25cd ../../
26# backend
27codegen/openapi-generator-cli generate -i openapi.yaml -g python-flask -t codegen/templates/ --additional-properties=packageVersion=${PACKAGE_VERSION},packageName=${PACKAGE_NAME} -o src-gen
28# client
29#codegen/openapi-generator-cli generate -i openapi.yaml -g javascript -o src-gen/openapi_server/static/
30#rm -R src-gen/openapi_server/static/.openapi*
31
32# copying tests into auto generated test directory with test base class
33cp -a tests/* src-gen/${PACKAGE_NAME}/test/
34
35########
36#
37# Adding additional files to src-gen directory
38#
39########
40echo "#!/bin/bash" > "${CELERY_WORKER_SCRIPT}"
41echo 'export FLASK_ENV="development"' >> "${CELERY_WORKER_SCRIPT}"
42echo "celery -A ${PACKAGE_NAME}.server_impl.CeleryWorker:celery worker -l info -E -B" >> "${CELERY_WORKER_SCRIPT}"
43chmod +x "${CELERY_WORKER_SCRIPT}"
44
45# bash script to install gnuboat_common from this repository before other dependencies
46echo "#!/bin/bash" > "${TOX_INSTALL_COMMAND}"
47echo 'pip install --editable=file:///`pwd`/../../common' >> "${TOX_INSTALL_COMMAND}"
48echo 'pip install $@' >> "${TOX_INSTALL_COMMAND}"
49chmod 0755 "${TOX_INSTALL_COMMAND}"
50# create coverage configuration
51COVERAGERC_FILE="${SRC_GEN}/.coveragerc"
52echo "[run]" >> "${COVERAGERC_FILE}"
53echo "branch = True" >> "${COVERAGERC_FILE}"
54echo "omit = *test*" >> "${COVERAGERC_FILE}"
55
56# create MANIFEST.in to package openapi-spec and templates
57echo "include gnuboat_mapservice/openapi/*.yaml" > "${SRC_GEN}/MANIFEST.in"
58echo "graft gnuboat_mapservice/templates" >> "${SRC_GEN}/MANIFEST.in"
59echo "global-exclude *.pyc" >> "${SRC_GEN}/MANIFEST.in"
60
61########
62#
63# Run tox tests and start mapservice
64#
65########
66cd src-gen/
67tox
68echo "###########################"
69echo "#"
70echo "# Do not forget to start the celery worker with"
71echo "# 1. start RabbitMQ broker with"
72echo "# sudo service rabbitmq-server start"
73echo "# 2. start result backend"
74echo "# sudo service memcached start"
75echo "# 3. start celery worker with"
76echo "# cd ${SRC_GEN} && ${CELERY_WORKER_SCRIPT}"
77echo "#"
78echo "###########################"
79export FLASK_ENV="development"
80python3 -m ${PACKAGE_NAME}
Note: See TracBrowser for help on using the repository browser.