forked from chartit/django-chartit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
executable file
·56 lines (37 loc) · 1.28 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import fabric
from fabric.api import env, local, sudo, cd, prefix
env.hosts = ['[email protected]']
env.master_repo = 'ssh://[email protected]/pgollakota/django-chartit'
env.sec_repo = 'git+ssh://[email protected]/pgollakota/django-chartit.git'
env.activate = 'source /work/virtualenvs/chartit/bin/activate'
env.project_root = '/home/praveen/cows/django-chartit'
def run(cmd):
with cd(env.project_root):
with prefix(env.activate):
fabric.api.run(cmd)
def push():
local('hg push %(master_repo)s' % env)
local('hg push %(sec_repo)s' % env)
run('hg pull -u %(master_repo)s' % env)
def upload_to_pypi():
local('python setup.py sdist upload')
def build_docs():
with prefix('export DJANGO_SETTINGS_MODULE=demoproject.settings'):
run('cd docs && make html')
def install_requirements():
run('pip install -r requirements.txt -q')
def upgrade_db():
run('cd demoproject && python manage.py syncdb')
def deploy_static():
run('cd demoproject && python manage.py collectstatic -v0 --noinput')
def restart_webserver():
sudo('supervisorctl restart nginx')
sudo('supervisorctl restart chartit')
def deploy():
push()
build_docs()
install_requirements()
upgrade_db()
deploy_static()
restart_webserver()