-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtasks.py
99 lines (67 loc) · 1.94 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# -*- coding: utf-8 -*-
import os
from invoke import task, run
from qcache import __version__ as qcache_version
docs_dir = 'docs'
build_dir = os.path.join(docs_dir, '_build')
@task
def test():
run('python -m pytest -s -v -m "not benchmark"', pty=True)
@task
def test_limited(limit_by):
run('python -m pytest -s -v -m "not benchmark" -k{}'.format(limit_by), pty=True)
@task
def benchmark():
run('python -m pytest -s -v -m "benchmark"', pty=True)
@task
def coverage():
run('python -m pytest --cov=qcache', pty=True)
run('coverage report -m', pty=True)
run('coverage html', pty=True)
@task
def flake8():
run("flake8 qcache test")
@task
def clean():
run("rm -rf build")
run("rm -rf dist")
run("rm -rf qcache.egg-info")
clean_docs()
print("Cleaned up.")
@task
def clean_docs():
run("rm -rf %s" % build_dir)
@task
def browse_docs():
run("open %s" % os.path.join(build_dir, 'index.html'))
@task
def build_docs(clean=False, browse=False):
if clean:
clean_docs()
run("sphinx-build %s %s" % (docs_dir, build_dir), pty=True)
if browse:
browse_docs()
@task
def readme(browse=False):
run('rst2html.py README.rst > README.html')
@task
def publish(test=False):
"""Publish to the cheeseshop."""
if test:
run('python setup.py register -r pypitest sdist upload -r pypitest')
else:
run("python setup.py register sdist upload")
@task
def install():
run('python setup.py sdist install')
@task
def build_image():
run("sudo docker build -t tobgu/qcache:{version} .".format(version=qcache_version))
run("sudo docker tag tobgu/qcache:{version} tobgu/qcache:latest".format(version=qcache_version))
@task
def push_image():
run("sudo docker push tobgu/qcache:{version}".format(version=qcache_version))
run("sudo docker push tobgu/qcache:latest")
@task
def tag():
run("git tag -fa v{version} -m 'v{version}'".format(version=qcache_version))