-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage.py
executable file
·64 lines (40 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
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
dashboard manager
~~~~~~~~~~~~~~~~~
This module contains the management functionality.
"""
import os
import redi
from clint.textui import puts, indent, colored
from flaskext.script import Manager
from dashboard import app, g, redis_connect
from dashboard.views.gh_commits import grab_changelog
from dashboard.views.topsy import get_window_url, WINDOW_MAP
manager = Manager(app)
app.test_request_context('/').push()
redi.config.init(r=redis_connect())
@manager.command
def clear_db():
KEYS = ['dashboard:github:commits',]
puts('Clearing Database...')
with indent(4):
r = redis_connect()
for key in KEYS:
if r.delete(key):
puts('{0} deleted.'.format(colored.red(key)))
@manager.command
def migrate():
os.system('./migrate.py')
@manager.command
def sync():
puts('Grabbing GitHub Commits...')
with indent(2):
puts(grab_changelog())
puts('Grabbing Topsy Links...')
with indent(2):
for w in WINDOW_MAP.keys():
puts(get_window_url(w))
if __name__ == '__main__':
manager.run()