This repository has been archived by the owner on Aug 6, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
/
fabfile.py
61 lines (51 loc) · 1.65 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
from fabric.api import cd, env, local, prefix, run, sudo
deploy_path = '/srv/http/staff.sitcon.org'
env.user = env.user.lower()
env.hosts = ['staff.sitcon.org']
env.roledefs['heroku'] = ['sitcon-staff.herokuapps.com']
class Compass:
require = ['zurb-foundation']
arguments = {
'css_dir': 'core/static/css',
'sass_dir': 'core/scss',
'images_dir': 'core/static/img',
'javascripts_dir': 'core/static/js',
'output_style': 'compressed',
}
def compass(action):
if action == 'watch':
local("compass watch")
elif action == 'compile':
commands = ["-r %s" % i for i in Compass.require]
commands += ["--%s %s" % (k.replace('_', '-'), v) for k, v in Compass.arguments.items()]
local("compass compile " + ' '.join(commands))
else:
local("compass " + action)
def shell():
if 'heroku' in env.roles:
local('heroku run ./manage.py shell')
else:
with cd(deploy_path), prefix('source venv/bin/activate'):
env.output_prefix = False
run
run('./manage.py shell')
def log():
if 'heroku' in env.roles:
local('heroku logs')
else:
env.output_prefix = False
run('cat /var/log/roboconf.log')
def dev():
local('./manage.py runserver')
def deploy(branch='master'):
if 'heroku' in env.roles:
local('git push heroku %s:master' % branch)
else:
local('git push origin %s' % branch)
if branch == 'master':
with cd(deploy_path):
run('git stash')
run('git pull --rebase')
run('git stash pop')
def restart():
sudo('apachectl -k restart')