-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
38 lines (27 loc) · 2.88 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
from __future__ import with_statement
import os
from fabric.api import *
# ===== Usage =====
usage = """
--------
staging : > fab host_impd deploy:<branch>
gamekeeper test : > fab host_gamekeeper_test deploy:<branch>
gamekeeper prod : > fab host_gamekeeper_prod deploy:<branch>
"""
def help():
print usage
# ===== hosts ======
def host_impd():
env.user = 'impd'
env.hosts = ['gamekeeper.impd.co.za']
env.code_dir = '/home/gamekeeper'
# ===== top level commands ======
def deploy(branch_name="master"):
print(" Deploying: ** %s **" % branch_name)
with cd(env.code_dir):
run("git reset --hard HEAD")
run("git fetch origin")
run("git checkout origin/%s" % branch_name)
run("git pull origin %s" % branch_name)
run("./scripts/deploy_server.sh")
print("Deployed to: %s" % env.hosts[0])