<commit_before># example invocation
# $ fab -H ubuntu@xx.x.xxx.xx deploy -i ~/.ssh/some.key

from fabric.api import local, run, cd, put

# this can be set by passing venv_path arg to deploy() target
local_venv_path = None

# /var/www/clients.seedscientific.com/uf/UF04
remote_work_path = '~/deploy/polio-work'
remote_backend_path = '/var/www/apps/polio/'
remote_frontend_path = '/var/www/apps/polio/static/'

# deploy build
# build-machine dependencies - node, gulp, bower, sass, compass, ruby, virtualenv, fabric-virtualenv
def deploy(venv_path=None):
    global local_venv_path
    local_venv_path = venv_path;

    # on local machine...
    _build_dependencies()

    # on target machine
    stop_apache()
    _push_to_remote()
    start_apache()

# apache controls
def stop_apache():
    run("sudo /etc/init.d/apache2 stop")

def start_apache():
    run("sudo /etc/init.d/apache2 start")


# build dependencies
def _build_dependencies():
    ### on build machine ###

    # only build with a virtualenv if one is passed in.
    if (local_venv_path):
        # make virtual env
        local('virtualenv %s' % local_venv_path)

        # enter virtual environment
        activate_this_file = "%s/bin/activate_this.py" % local_venv_path
        execfile(activate_this_file, dict(__file__=activate_this_file))

    # update/install dependencies
    local ("npm install")
    local("./node_modules/.bin/bower install")
    local ("pip install -r requirements.txt")

    # gulp styles is broken.. TODO build styles in webpack #

    local("rm assets/bundles/*")
    local("rm static/main*")


    local("./node_modules/.bin/webpack --config webpack.config.dev.js")
    local("./node_modules/.bin/gulp fonts")
    local("./node_modules/.bin/gulp dist")
    local("python manage.py collectstatic --noinput")

# push build to remote<commit_msg>fix fabfile and deploy final fix to ufadmin<commit_after># example invocation
# $ fab -H ubuntu@xx.x.xxx.xx deploy -i ~/.ssh/some.key

from fabric.api import local, run, cd, put

# this can be set by passing venv_path arg to deploy() target
local_venv_path = None

# /var/www/clients.seedscientific.com/uf/UF04
remote_work_path = '~/deploy/polio-work'
remote_backend_path = '/var/www/apps/polio/'
remote_frontend_path = '/var/www/apps/polio/static/'

# deploy build
# build-machine dependencies - node, gulp, bower, sass, compass, ruby, virtualenv, fabric-virtualenv
def deploy(venv_path=None):
    global local_venv_path
    local_venv_path = venv_path;

    # on local machine...
    _build_dependencies()

    # on target machine
    stop_apache()
    _push_to_remote()
    start_apache()

# apache controls
def stop_apache():
    run("sudo /etc/init.d/apache2 stop")

def start_apache():
    run("sudo /etc/init.d/apache2 start")


# build dependencies
def _build_dependencies():
    ### on build machine ###

    # only build with a virtualenv if one is passed in.
    if (local_venv_path):
        # make virtual env
        local('virtualenv %s' % local_venv_path)

        # enter virtual environment
        activate_this_file = "%s/bin/activate_this.py" % local_venv_path
        execfile(activate_this_file, dict(__file__=activate_this_file))

    # update/install dependencies
    local ("npm install")
    local("./node_modules/.bin/bower install")
    local ("pip install -r requirements.txt")

    # clean out old webpack builds
    local("rm assets/bundles/*")

    local("./node_modules/.bin/webpack --config webpack.config.dev.js")
    local("./node_modules/.bin/gulp fonts")
    local("./node_modules/.bin/gulp dist")

    # collect all of the static files to /static
    local("python manage.py collectstatic --noinput")

# push build to remote
{'fraction_non_alphanumeric': 0.12010796221322537, 'fraction_numerical': 0.0021592442645074223, 'mean_word_length': 3.4277180406212664, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5948140', 'n_tokens_mistral': 1229, 'n_tokens_neox': 1175, 'n_words': 306}