forked from noirbizarre/flask-restplus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtasks.py
76 lines (51 loc) · 1.49 KB
/
tasks.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
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from invoke import run, task
from os.path import join, abspath, dirname
ROOT = abspath(join(dirname(__file__)))
def lrun(cmd, *args, **kwargs):
'''Run a command ensuring cwd is project root'''
return run('cd {0} && {1}'.format(ROOT, cmd), *args, **kwargs)
@task
def clean(docs=False, bytecode=False, extra=''):
'''Cleanup all build artifacts'''
patterns = ['build', 'dist', 'cover', 'docs/_build', '**/*.pyc', '*.egg-info', '.tox']
for pattern in patterns:
print('Removing {0}'.format(pattern))
lrun('rm -rf {0}'.format(pattern))
@task
def demo():
'''Run the demo'''
lrun('python examples/todo.py')
@task
def test():
'''Run tests suite'''
lrun('nosetests --force-color', pty=True)
@task
def cover():
'''Run tests suite with coverage'''
lrun('nosetests --force-color --with-coverage --cover-html', pty=True)
@task
def tox():
'''Run tests against Python versions'''
run('tox', pty=True)
@task
def qa():
'''Run a quality report'''
lrun('flake8 flask_restplus')
@task
def doc():
'''Build the documentation'''
lrun('cd doc && make html', pty=True)
@task
def assets():
'''Fetch web assets'''
lrun('bower install')
@task
def dist():
'''Package for distribution'''
lrun('python setup.py sdist bdist_wheel', pty=True)
@task(tox, doc, qa, assets, dist, default=True)
def all():
'''Run tests, reports and packaging'''
pass