Skip to content
Snippets Groups Projects
Commit c6f445c6 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

add script to create app version file

parent 0e0c7e9c
No related branches found
No related tags found
1 merge request!66App metadata
...@@ -2,14 +2,38 @@ ...@@ -2,14 +2,38 @@
""" """
import sys import sys
from subprocess import check_call from subprocess import check_call
import git
import json
import os
_test_dir = "tests" _test_dir = "tests"
_python_dir = "rtgmpy" _python_dir = "rtgmpy"
def app_version():
version_file = open("rtgmpy/www/resources/app-version.json", "w+")
try:
repo = git.Repo('.')
gitHash = repo.head.commit.hexsha
version = repo.git.describe(tags=True, first_parent=True, always=True)
url = os.environ.get('CI_PROJECT_URL', repo.remotes.origin.url)
version_info = dict(
gitHash=gitHash,
projectName='erp-rtgm-calculator',
url = url,
version=version,
)
version_file.write(json.dumps(version_info, indent=2))
except:
print('Failed to create version file. Writing blank file.')
version_file.write(json.dumps('{}'))
def rtgm(): def rtgm():
args = sys.argv args = sys.argv
args.remove(args[0]) args.remove(args[0])
...@@ -34,11 +58,13 @@ def lint(): ...@@ -34,11 +58,13 @@ def lint():
def start(): def start():
app_version()
# Run development web service # Run development web service
check_call(["python", "-m", "uvicorn", "rtgmpy.www.main:app", "--reload", "--port", "8080"]) check_call(["python", "-m", "uvicorn", "rtgmpy.www.main:app", "--reload", "--port", "8080"])
def start_prod(): def start_prod():
app_version()
# Run development web service # Run development web service
check_call( check_call(
["python", "-m", "uvicorn", "rtgmpy.www.main:app", "--port", "8080", "--host", "0.0.0.0"] ["python", "-m", "uvicorn", "rtgmpy.www.main:app", "--port", "8080", "--host", "0.0.0.0"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment