source: src/mapservice/codegen/code_generator@ 8818b65

debian/bullseye
Last change on this file since 8818b65 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
RevLine 
[3a89adb]1#!/bin/bash
2
3DIR=`dirname "$0"`
[ec9e811]4SRC_GEN="${DIR}/../src-gen"
[adda9f2]5PACKAGE_NAME="gnuboat_mapservice"
6PACKAGE_VERSION="0.5.99"
7TARGET="${SRC_GEN}/${PACKAGE_NAME}/"
[a88607b]8CELERY_WORKER_SCRIPT="${SRC_GEN}/celery_worker"
[8f3d1dd]9TOX_INSTALL_COMMAND="${SRC_GEN}/tox_install_command"
[ec9e811]10
11echo "Cleaning directory"
12rm -R "${SRC_GEN}"
[3a89adb]13
14echo "Preparing symlinks"
[13cbe66]15mkdir -p "${TARGET}"
16cd "${TARGET}"
[a88607b]17mkdir -p server_impl
[ae2ff15]18cp -a ../../server_impl/* server_impl/
[3a89adb]19
[be25db1]20#echo "Copying static files"
[bd0cb38]21mkdir -p templates
22cp -a ../../templates/* templates/
[3a89adb]23
[be25db1]24echo "Generating backend and client API code"
[3a89adb]25cd ../../
[be25db1]26# backend
[adda9f2]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
[be25db1]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
[ae2ff15]32# copying tests into auto generated test directory with test base class
33cp -a tests/* src-gen/${PACKAGE_NAME}/test/
34
[adda9f2]35########
36#
37# Adding additional files to src-gen directory
38#
39########
[a88607b]40echo "#!/bin/bash" > "${CELERY_WORKER_SCRIPT}"
41echo 'export FLASK_ENV="development"' >> "${CELERY_WORKER_SCRIPT}"
[adda9f2]42echo "celery -A ${PACKAGE_NAME}.server_impl.CeleryWorker:celery worker -l info -E -B" >> "${CELERY_WORKER_SCRIPT}"
[a88607b]43chmod +x "${CELERY_WORKER_SCRIPT}"
44
[5c9c247]45# bash script to install gnuboat_common from this repository before other dependencies
[8f3d1dd]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}"
[f61d16d]50# create coverage configuration
51COVERAGERC_FILE="${SRC_GEN}/.coveragerc"
52echo "[run]" >> "${COVERAGERC_FILE}"
53echo "branch = True" >> "${COVERAGERC_FILE}"
54echo "omit = *test*" >> "${COVERAGERC_FILE}"
[8f3d1dd]55
[5c9c247]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"
[ae2ff15]60
[adda9f2]61########
62#
63# Run tox tests and start mapservice
64#
65########
[3a89adb]66cd src-gen/
[ae2ff15]67tox
[a88607b]68echo "###########################"
69echo "#"
70echo "# Do not forget to start the celery worker with"
71echo "# 1. start RabbitMQ broker with"
72echo "# sudo service rabbitmq-server start"
[c5ca247]73echo "# 2. start result backend"
74echo "# sudo service memcached start"
75echo "# 3. start celery worker with"
[a88607b]76echo "# cd ${SRC_GEN} && ${CELERY_WORKER_SCRIPT}"
77echo "#"
78echo "###########################"
79export FLASK_ENV="development"
[adda9f2]80python3 -m ${PACKAGE_NAME}
Note: See TracBrowser for help on using the repository browser.