From 1295cdc7d4f97f5b4625980b803131fe60a17022 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 2 Jun 2012 16:08:40 +0100 Subject: [PATCH] Add some more fabric commands --- fabfile.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/fabfile.py b/fabfile.py index fecf857..43e5863 100644 --- a/fabfile.py +++ b/fabfile.py @@ -32,22 +32,23 @@ def chdir(path): if env.local: with lcd(path): yield - with cd(path): - yield - + else: + with cd(path): + yield + @_contextmanager def virtualenv(): with chdir(env.path): with prefix('. %s' % os.path.join(env.path, 'env/bin/activate')): yield - + def manage(args): """Run and Django manage.py command""" with virtualenv(): - runcmd('%s %s' % (env.managepath, args)) - + runcmd('%s %s' % (env.managepath, args)) + ## Tasks - + @task def virtualenv_setup(): if not os.path.exists('env'): @@ -62,10 +63,14 @@ def runserver(port=3333): ip = runcmd("""ip addr list eth0 |grep "inet " |cut -d' ' -f6|cut -d/ -f1""", capture=True) manage('runserver %s:%s' % (ip, port)) +@task +def collectstatic(): + manage('collectstatic --link --noinput') + @task def syncdb(): manage('syncdb --migrate --noinput') - + @task def test(): manage('test --noinput --failfast') \ No newline at end of file