snipt/fabfile.py

29 lines
745 B
Python
Raw Normal View History

2012-03-12 21:16:19 -07:00
from fabric.api import cd, local, env, run, sudo
2011-10-23 20:13:37 -07:00
2011-10-23 20:07:59 -07:00
2012-03-05 13:48:03 -08:00
env.hosts = ['nick@beta.snipt.net:39039']
env.site_path = '/var/www/snipt'
2012-03-05 13:57:18 -08:00
env.venv_path = '/home/nick/.virtualenvs/snipt'
2012-01-25 07:20:52 -08:00
2012-03-05 13:57:18 -08:00
def _python(cmd):
return env.venv_path.rstrip('/') + '/bin/python ' + cmd
def deploy(m):
2012-03-05 13:48:03 -08:00
local('python manage.py collectstatic --ignore grappelli --ignore admin --noinput')
2012-03-05 13:57:18 -08:00
try:
2012-03-05 13:57:36 -08:00
local("hg commit -m '{}'".format(m))
2012-03-05 13:57:18 -08:00
except:
pass
2012-03-12 21:01:56 -07:00
local('hg push')
2012-03-05 13:57:18 -08:00
2012-03-05 13:48:03 -08:00
with cd(env.site_path):
run('hg pull -u')
2012-03-05 13:57:18 -08:00
run(_python('manage.py collectstatic --ignore grappelli --ignore admin --noinput'))
2012-03-12 21:16:19 -07:00
def re():
sudo('rc.d restart memcached')
with cd(env.site_path):
run('/var/www/snipt/gk')
run('/var/www/snipt/gs')