aboutsummaryrefslogtreecommitdiff
blob: a31b96c99e435e67e36303c7a69f5709ae65ee7f (plain)
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
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from flask_script import Manager, Shell

from backend import app, db
from backend.lib import sync


manager = Manager(app)

def shell_context():
    return dict(app=manager.app, db=db)

manager.add_command('shell', Shell(make_context=shell_context))

@manager.command
def init():
    """Initialize empty database with tables"""
    db.create_all()

@manager.command
def sync_gentoo():
    """Synchronize Gentoo data"""
    sync.sync_projects()
    sync.sync_categories()
    sync.sync_packages()
    #sync_versions()

@manager.command
def sync_projects():
    """Synchronize only Gentoo projects.xml data"""
    sync.sync_projects()

@manager.command
def sync_categories():
    """Synchronize only Gentoo categories data"""
    sync.sync_categories()

@manager.command
def sync_packages():
    """Synchronize only Gentoo packages base data (without details)"""
    sync.sync_packages()

@manager.command
def sync_versions():
    """Synchronize only Gentoo package details"""
    sync.sync_versions()

if __name__ == '__main__':
    manager.run()