forked from dssg/triage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
37 lines (28 loc) · 1.12 KB
/
manage.py
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
import argparse
from pathlib import Path
from argcmdr import local, LocalRoot, Local
from plumbum import local as plumlocal
ROOT_PATH = Path(__file__).parent.resolve()
class Development(LocalRoot):
"""Commands to aid in Triage library development"""
pass
@Development.register
@local('remainder', metavar='alembic arguments', nargs=argparse.REMAINDER)
def alembic(context, args):
"""Configuration wrapper to use the Alembic schema migrations library for Triage development.
Try `alembic -h` or `manage alembic -- -h` to see a description of all
the available subcommands"""
return context.local['env'][
'PYTHONPATH=' + str(ROOT_PATH / 'src'),
'alembic',
'-c', ROOT_PATH / 'src' / 'triage' / 'component' / 'results_schema' / 'alembic.ini',
'-x', 'db_config_file=database.yaml',
args.remainder,
]
@Development.register
class Docs(Local):
"""View Triage documentation through local server"""
def prepare(self, args):
yield plumlocal['python']['docs/update_docs.py']
with plumlocal.cwd(ROOT_PATH / 'docs'):
yield plumlocal['mkdocs']['serve']