-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
84 lines (63 loc) · 2.18 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
from cement.core import controller
from decanter import app, cli
from decanter.admin import create_app
from decanter.cli import InstallDBController, CreateRoleController, CreateUserController
class RootController(cli.RootController):
class Meta:
label = 'base'
description = "Management tools for decanter based website."
class ServerController(cli.ServerController):
flask_app = app
# TestController currently not implemented
class TestController(cli.Controller):
class Meta:
label = 'tests'
description = "Run the decanter test suite"
@controller.expose(hide=True, help='Run the decanter test suite')
def default(self):
#test.run('tests')
pass
class AssetController(cli.Controller):
class Meta:
label = 'assets'
description = "Build, watch or clean static assets"
arguments = [
(['-b', '--bundle'], {
'action': 'append',
'help': 'Build bundle asset',
'default': [],
}),
(['-f', '--force'], {
'action': 'store_true',
'help': 'Force build even if it exists',
})
]
@controller.expose(hide=True, help='Build, watch or clean static assets')
def default(self):
self.app.args.print_help()
@controller.expose(help='Build static assets')
def build(self):
args = ['build'] + self.pargs.bundle
self.run(*args)
@controller.expose(help='Rebuild static assets')
def rebuild(self):
args = ['build', '--no-cache'] + self.pargs.bundle
self.run(*args)
@controller.expose(help='Clean static assets')
def clean(self):
self.run('clean')
def run(self, *args):
from webassets import script
app = create_app()
script.main(args, env=app.assets)
class App(cli.App):
class Meta:
label = 'decanter'
base_controller = RootController
handlers = (ServerController,
AssetController,
InstallDBController,
CreateRoleController,
CreateUserController)
if __name__ == '__main__':
App.execute()