Created
November 4, 2013 11:06
-
-
Save pirhoo/7301089 to your computer and use it in GitHub Desktop.
Detective.io fabfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Encoding: utf-8 | |
from fabric.api import local | |
PROD_APP = 'detective-io' | |
PROD_REMOTE = 'prod' | |
STAGING_APP = 'detective-staging' | |
STAGING_REMOTE = 'staging' | |
def prod(hard=False, full=False, branch='master'): | |
# Environement variable must be available during app compilation | |
# to allow our script to process a "./manage.py bower_install" | |
local("heroku labs:enable user-env-compile --app=%s" % PROD_APP) | |
# Push the app to production | |
local('git push %s %s:master --force' % (PROD_REMOTE, branch) ) | |
if hard: collectstatic(PROD_APP, full) | |
local("heroku labs:disable user-env-compile --app=%s" % PROD_APP) | |
def staging(hard=False, full=False, branch='master'): | |
# Environement variable must be available during app compilation | |
# to allow our script to process a "./manage.py bower_install" | |
local("heroku labs:enable user-env-compile --app=%s" % STAGING_APP) | |
# Push the app to staging | |
local('git push %s %s:master --force' % (STAGING_REMOTE, branch) ) | |
if hard: collectstatic(STAGING_APP, full) | |
local("heroku labs:disable user-env-compile --app=%s" % STAGING_APP) | |
def collectstatic(app, full=False): | |
if full: | |
local("heroku run 'python manage.py collectstatic --noinput' --app %s" % app) | |
else: | |
local("heroku run 'python manage.py collectstatic --noinput -i admin -i components' --app %s" % app) | |
local("heroku run 'python manage.py compress --force' --app %s" % app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment