-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfabfile.py
39 lines (32 loc) · 923 Bytes
/
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
# reference tutorial: http://docs.fabfile.org/en/1.12/tutorial.html
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
import os
# run unit tests
def test():
with settings(warn_only=True):
result = local('python test.py', capture=True)
if result.failed and not confirm("Tests failed. Continue anyway?"):
abort("Aborting at user request.")
def static_analysis():
# ignore error from static analysis so files can be pushed to git
try:
local("pylint shopping_list.py >> shopping_list_static_analysis.txt")
except:
pass
def commit():
local("git add -u && git add shopping_list_static_analysis.txt")
local("git commit")
def push():
local("git push")
def prepare_deploy():
test()
static_analysis()
commit()
push()
# start server for web app
def deploy():
with cd(os.getcwd()):
local("git pull")
local("python shopping_list.py")