random fabric libraries to make fabric even better

Daniel Lawrence c3c17b6712 added GNUv2 LICENSE file 5 years ago
src db6757fbc2 fixed pep8 5 years ago
.env 8322bd22c5 added auto_env file .env 5 years ago
.gitignore 6d7781027a Added emacs file to gitignore 5 years ago
.travis.yml d3c6a924cd fixed up pyflakes call in travis.yml 5 years ago
LICENSE c3c17b6712 added GNUv2 LICENSE file 5 years ago
README.md a37dbfba31 Added imports to example 5 years ago
requirements-dev.txt 3072d248cf added requirements-dev.txt for testing 5 years ago
requirements.txt e1c6d59762 Added fabric to requirements.txt 5 years ago
setup.py 382b301f0c Added URL to setup.py 5 years ago

README.md

fabphile

Build Status

random fabric libraries to make fabric even better

example

from fabric.api import cd, put, run
from fabphile.virtualenv import mkvirtualenv, virtualenv
from fabphile.common import check
from fabphile.django import run_manage
from fabphile.pip import pip_install
from fabphile.git import archive

def deploy(application=None):
    """Deploy a gitrepo app to a remote service.
    You need to be in the local git repo of the application for this to work.
    """
    source_tar = "%s.tar" % application
    deploy_dir = "/opt/%s" % application

    check(application, "Must provide an application to deploy")
    
    archive(source_tar)
    put(source_tar, "/tmp/")

    run("mkdir -p %s" % deploy_dir)
    run("chown %s:%s %s" % (application, application, deploy_dir))
    
    mkvirtualenv(deploy_dir)
    with virtualenv(deploy_dir):
        pip_install("requirements.txt")
    
    with cd(deploy_dir):
        run("tar xf /tmp/%s" % source_tar)
        
    return deploy_dir