-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
56 lines (35 loc) · 952 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from fabric.api import local, settings, abort
from fabric.contrib.console import confirm
# prep
def test():
with settings(warn_only=True):
result = local("nosetests -v", capture=True)
if result.failed and not confirm("Tests failed. Continue?"):
abort("Aborted at user request.")
def commit():
message = raw_input("Enter a git commit message: ")
local("git add . && git commit -am '{}'".format(message))
def push():
local("git branch")
branch = raw_input("Which branch do you want to push to? ")
local("git push origin {}".format(branch))
def prepare():
test()
commit()
push()
# deploy
def pull():
local("git pull origin master")
def heroku():
local("git push heroku master")
def heroku_test():
local("heroku run nosetests -v")
def deploy():
pull()
test()
commit()
heroku()
heroku_test()
# rollback
def rollback():
local("heroku rollback")