Skip to content
This repository has been archived by the owner on Apr 10, 2019. It is now read-only.

Commit

Permalink
Update fabfile to compress assets and restart apache as part of deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
paulosman committed Jun 16, 2011
1 parent ddef806 commit 3f26035
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions fabfile.py
@@ -1,11 +1,22 @@
import os

from fabric.api import cd, env, run
from fabric.operations import sudo

env.proj_root = '/var/webapps/betafarm/'
git_repo = 'https://github.com/mozilla/betafarm.git'


def run_manage_cmd(cmd):
"""Run a manage.py command."""
with cd(env.proj_root):
run('python manage.py %s' % (cmd,))


def restart_apache():
sudo('/etc/init.d/apache2 restart')


def clone():
"""Create project directory and clone repository."""
with cd(os.path.dirname(env.proj_root.rstrip('/'))):
Expand All @@ -20,9 +31,15 @@ def update():

def migrate():
"""Run database migrations."""
with cd(env.proj_root):
run('python manage.py migrate')
run_manage_cmd('migrate')


def compress():
"""Compress CSS / Javascript."""
run_manage_cmd('compress_assets')


def deploy():
update()
compress()
restart_apache()

0 comments on commit 3f26035

Please sign in to comment.