Skip to content

Commit

Permalink
Fabfile tweaks; added a local requirements file.
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobian committed Apr 25, 2012
1 parent 248c309 commit 256200d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
*.pyc
11 changes: 10 additions & 1 deletion fabfile.py
@@ -1,4 +1,4 @@
from fabric.api import cd, env, puts, sudo, task
from fabric.api import cd, env, local, puts, sudo, task
from fabric.contrib import files
from unipath import FSPath as Path

Expand Down Expand Up @@ -36,12 +36,14 @@ def deploy_trac_media():
"""Deploy Trac media for static serving."""
sudo('%s/bin/trac-admin %s/trac-env deploy /home/www/trac-media' % (env.virtualenv, env.code_dir))

@task
def apache(cmd):
"""
Manage the apache service. For example, `fab apache:restart`.
"""
sudo('invoke-rc.d apache2 %s' % cmd)

@task
def update_dependencies():
"""
Update dependencies in the virtualenv.
Expand All @@ -50,3 +52,10 @@ def update_dependencies():
reqs = env.code_dir.child('requirements.txt')
sudo('%s -q install -U pip' % pip)
sudo('%s -q install -r %s' % (pip, reqs))

@task
def copy_db():
"""
Copy the production DB locally for testing.
"""
local('ssh %s pg_dump -U code.djangoproject -c code.djangoproject | psql code.djangoproject' % env.hosts[0])
4 changes: 4 additions & 0 deletions local-requirements.txt
@@ -0,0 +1,4 @@
# Requirements for working with this code locally.

Fabric
Unipath

0 comments on commit 256200d

Please sign in to comment.