-
Notifications
You must be signed in to change notification settings - Fork 0
/
fabfile.py
65 lines (48 loc) · 1.56 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
57
58
59
60
61
62
63
64
65
from fabric.api import local, task, lcd
from fabric import colors
@task
def init_env_local():
""" Setup development env. """
local('sudo apt-get install libpq-dev python-dev')
local('pip install -r deploy/requirements/local.txt')
local('cp bin/postactivate.local $VIRTUAL_ENV/bin/postactivate')
with lcd('sources'):
local('add2virtualenv `pwd`')
local("sudo npm install -g less")
local("sudo npm install -g coffee-script")
@task
def init_env_vagrant():
""" Re-create & configure vagrant vm. """
_vagrant_init()
_vagrant_run_ansible()
@task
def run_tests():
""" Run test suite. """
local('nosetests .')
@task
def clean():
""" Delete build & public dir. """
local('rm -rf docs/build/*')
local('rm -rf build/*')
local('rm -rf public/assets/*')
local('pyclean .')
@task
def build_wheel():
""" Create new wheel file. """
with lcd('deploy/fabric'):
local('fab build.wheel')
def _vagrant_run_ansible():
""" Start vagrant and run top.yml. """
print colors.yellow("[ Starting vagrant... ]")
local('vagrant up')
print colors.yellow("[ Running ansible playbooks... ]")
with lcd('deploy/ansible'):
local('ansible-playbook -i hosts/vagrant top.yml -v')
def _vagrant_init():
""" Destroy vagrant & recreate it. """
print colors.yellow("[ Initializing vagrant... ]")
local('vagrant destroy')
local('vagrant up')
print colors.yellow("[ Running fabric tasks... ]")
with lcd('deploy/fabric'):
local('fab staging.h_vagrant staging.setup_ssh_vagrant')