-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathfabfile.py
More file actions
39 lines (31 loc) · 1012 Bytes
/
Copy pathfabfile.py
File metadata and controls
39 lines (31 loc) · 1012 Bytes
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
from __future__ import with_statement
from fabric.api import *
from fabric.contrib.console import confirm
from contextlib import contextmanager as _contextmanager
env.hosts = ['root@ryanmerrill.me']
env.user = 'www-data'
env.directory = '/sites/projects/message_board'
env.activate = 'source /sites/virtualenvs/message_board/bin/activate'
def push(message='updates'):
local('git add .')
local('git commit -m "%s"' % message)
local('git push')
def collect_static():
with virtualenv():
run('./manage.py collectstatic --noinput')
def pull():
code_dir = '/sites/projects/message_board'
with cd(code_dir):
sudo('git pull', user='www-data')
code_dir = '/sites/projects/message_board/github_webhooks'
with cd(code_dir):
sudo('git pull', user='www-data')
def deploy():
pull()
collect_static()
run('service apache2 restart')
@_contextmanager
def virtualenv():
with cd(env.directory):
with prefix(env.activate):
yield