Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
erp-rtgm-calculator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
Engineering and Risk Project
erp-rtgm-calculator
Commits
c6f445c6
Commit
c6f445c6
authored
5 months ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
add script to create app version file
parent
0e0c7e9c
No related branches found
No related tags found
1 merge request
!66
App metadata
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
poetry_scripts.py
+27
-1
27 additions, 1 deletion
poetry_scripts.py
with
27 additions
and
1 deletion
poetry_scripts.py
+
27
−
1
View file @
c6f445c6
...
@@ -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
"
]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment