-
Notifications
You must be signed in to change notification settings - Fork 6
/
fabfile.py
76 lines (59 loc) · 1.7 KB
/
fabfile.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
"""Summary."""
from fabric.api import local, task
from paystack.version import VERSION
@task
def install(version=""):
"""Install project artifacts.
Args:
version (str, optional): Description
"""
local("pip install -r requirements.txt")
local("pip install -r test-requirements.txt")
@task
def clean():
"""Remove all the .pyc files."""
local("find . -name '*.pyc' -print0|xargs -0 rm", capture=False)
# Remove the dist folder
local("rm -rf ./dist && rm -rf paystack.egg-info")
local("rm -rf **__pycache__* && rm -rf coverage*")
local("rm -rf ./temp && rm -rf ./build")
@task
def push(msg):
"""Push to github.
Args:
msg (str, required): Description
"""
clean()
local("git add . && git commit -m '{}'".format(msg))
local("git push")
@task
def publish(msg="checkpoint: publish package"):
"""Deploy the app to PYPI.
Args:
msg (str, optional): Description
"""
test = check()
if test.succeeded:
clean()
push(msg)
sdist = local("python setup.py sdist")
if sdist.succeeded:
build = local(
'python setup.py build && python setup.py bdist_egg')
if build.succeeded:
upload = local("twine upload dist/*")
if upload.succeeded:
tag()
@task
def check():
"""Test project."""
test = local("coverage erase && nosetests --with-coverage --cover-package=paystack/"
)
if test.succeeded:
return test
@task
def tag(version=VERSION):
"""Deploy a version tag."""
build = local("git tag {0}".format(version))
if build.succeeded:
local("git push --tags")