-
Notifications
You must be signed in to change notification settings - Fork 5
/
fabfile.py
56 lines (42 loc) · 1.64 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
import os
import fabric.api as _fab
from fabric.contrib.console import confirm
_fab.env.hosts = ['eventrevolution.net']
def test():
print "No tests yet"
def do_del_tmp():
"""Remove temporary files from the project dir"""
_fab.local("find %s -name '*.pyc' -depth -delete" % (
os.path.dirname(__file__),))
_fab.local("find %s -name '.*sw*' -depth -delete" % (
os.path.dirname(__file__),))
def pack():
do_del_tmp()
_fab.local('cd ./$(git rev-parse --show-cdup) && git archive --prefix="conman/" --format=tar HEAD | gzip > /tmp/conman_head.tar.gz')
# can do tags and versions too
#_fab.local('cd ./$(git rev-parse --show-cdup) && git archive --prefix=conman-$(git-version)/" --format=tar v1.4.0 | gzip > /tmp/conman_head.tar.gz')
def prepare_deploy ():
# run tests
test()
pack()
def _put_and_expand():
_fab.put('/tmp/conman_head.tar.gz', '/tmp')
with _fab.cd('/var/www/er.net/www/'):
_fab.run('tar xf /tmp/conman_head.tar.gz')
def do_deps():
_fab.run('wget http://sorl-thumbnail.googlecode.com/files/sorl-thumbnail-3.2.5.tar.gz -O /tmp/sorl-thumbnail-3.2.5.tar.gz')
_fab.run("tar xf /tmp/sorl-thumbnail-3.2.5.tar.gz -C /tmp")
with _fab.cd('/tmp/sorl-thumbnail-3.2.5/'):
_fab.sudo("python setup.py install")
def do_sync_db():
with _fab.cd('/var/www/er.net/www/'):
_fab.run('./manage.py syncdb')
def do_httpd_restart():
_fab.sudo('/etc/init.d/httpd restart')
def httpd_restart():
_fab.sudo('/etc/init.d/httpd restart')
def deploy_develop():
"""Deploy the latest conman release from HEAD"""
_put_and_expand()
_build_new_db()
httpd_restart()