-
Notifications
You must be signed in to change notification settings - Fork 4
/
fabfile.py
60 lines (48 loc) · 1.84 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
from fabric.api import *
from fabric.colors import red, green, yellow
from fabric.contrib import django
import subprocess
import signal
# run
# fab hello
def hello():
print(red('printing!'))
print(green('printing!'))
print(yellow('printing!'))
def clean():
local('python manage.py clean_pyc')
# sass => css daemon
def saml():
local('sass --watch static/sass:static/css &')
# setup
def setup():
local('sudo easy_install pip')
local('sudo pip install -r requirements.txt')
local('mkdir -p logs')
local('python manage.py syncdb')
#local('python manage.py collectstatic')
def deploy():
with settings(warn_only=True):
#result = local('kill -HUP `cat /tmp/flink-crond.pid`', capture=True)
result = local('kill `cat /tmp/flink-cherrypy.pid`', capture=True)
#local('python manage.py crond --pidfile=/tmp/flink-crond.pid 2>&1')
local('python cherrypy_static_server.py')
local('python manage.py runserver')
#to run automated selenium tests
#have the selenium server running!!
# java -jar testing-utilities/selenium-server.jar
def test():
with settings(warn_only=True):
result = local('kill `cat /tmp/flink-cherrypy.pid`', capture=True)
local('yes no | python manage.py syncdb')
local('python manage.py loaddata test_fixture.json')
local('java -jar testing-utilities/selenium-server.jar &')
local('python cherrypy_static_server.py')
popen = subprocess.Popen('python manage.py runserver', shell=True)
with settings(warn_only=True):
local('python manage.py test app')
# End the manage.py processes... all of them.
popen.kill()
with settings(warn_only=True):
local("ps aux | grep 'runserver$' | grep -v grep | awk '/\d+/{print $2}' | xargs kill")
local("ps aux | grep 'selenium-server.jar$' | grep -v grep | awk '/\d+/{print $2}' | xargs kill")