2021-09-15 10:31:53 +00:00
|
|
|
from .models import Role
|
|
|
|
from flask_migrate import upgrade
|
|
|
|
|
|
|
|
|
|
|
|
def register(app):
|
|
|
|
@app.cli.command()
|
|
|
|
def deploy():
|
|
|
|
"""Run deployment tasks."""
|
|
|
|
# migrate database to latest revision
|
|
|
|
upgrade()
|
|
|
|
# create or update user roles
|
|
|
|
Role.insert_roles()
|
|
|
|
|
2021-09-22 11:53:39 +00:00
|
|
|
@app.cli.group()
|
|
|
|
def daemon():
|
|
|
|
"""Daemon commands."""
|
|
|
|
pass
|
2021-09-15 10:31:53 +00:00
|
|
|
|
2021-09-22 11:53:39 +00:00
|
|
|
@daemon.command()
|
|
|
|
def run():
|
|
|
|
"""Run daemon"""
|
|
|
|
from app.daemon import Daemon
|
|
|
|
daemon = Daemon()
|
|
|
|
daemon.run()
|
|
|
|
|
|
|
|
@app.cli.group()
|
2021-09-15 10:31:53 +00:00
|
|
|
def test():
|
2021-09-22 11:53:39 +00:00
|
|
|
"""Test commands."""
|
|
|
|
pass
|
|
|
|
|
|
|
|
@test.command()
|
|
|
|
def run():
|
|
|
|
"""Run unit tests."""
|
2021-09-15 10:31:53 +00:00
|
|
|
import unittest
|
|
|
|
tests = unittest.TestLoader().discover('tests')
|
|
|
|
unittest.TextTestRunner(verbosity=2).run(tests)
|