-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
40 lines (33 loc) · 1.03 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
config.fab_user = 'eric'
def git_pull():
"Updates the repository."
run("cd ~/lib/$(repo)/; git pull $(parent) $(branch)")
def git_reset():
"Resets the repository to specified version."
run("cd ~/lib/$(repo)/; git reset --hard $(hash)")
def production():
config.fab_hosts = ['fredvents.com']
config.repos = (('allfeeds','origin','master'),)
def staging():
config.fab_hosts = ['holscher.mine.nu']
config.repos = (('allfeeds','origin','master'),)
def reboot():
"Reboot Apache2 server."
sudo("apache2ctl graceful")
def pull():
require('fab_hosts', provided_by=[production])
for repo, parent, branch in config.repos:
config.repo = repo
config.parent = parent
config.branch = branch
invoke(git_pull)
def reset(repo, hash):
"""
Reset all git repositories to specified hash.
Usage:
fab reset:repo=my_repo,hash=etcetc123
"""
require("fab_hosts", provided_by=[staging, production])
config.hash = hash
config.repo = repo
invoke(git_reset)