<commit_before>
from fabric.api import local, run, cd, settings, sudo, env, put
import os

# http://stackoverflow.com/questions/1180411/activate-a-virtualenv-via-fabric-as-deploy-user
# FIXME: These should be env. variables.
PROJECT_DIR   = "/home/ubuntu/work/hasb.ug"
NVM_DIR       = "/home/ubuntu/.nvm"
VENV_ACTIVATE = os.path.join(PROJECT_DIR, "bin/activate")

env.use_ssh_config = True

def virtualenv(command):
    run(". " + VENV_ACTIVATE + ' && ' + command)

# Invokable commands:

def hello():
    print "Hello!"

# This should be a part of initial per-user setup
#def setup_pyenv():
#    with cd(PROJECT_DIR):
#        run("virtualenv pyenv --distribute")

def update():
    with cd(PROJECT_DIR):
        run("git pull origin master")
        run("export NVM_DIR={dir}".format(dir=NVM_DIR))
        virtualenv("pip install -r requirements.txt")
        virtualenv("npm install")
        virtualenv("bower install")
        put("confs/boto.conf", "confs/boto.conf")
        run("make clean all")

def reload_gunicorn():
    with cd(PROJECT_DIR):
        with settings(warn_only=True):
            sudo("stop gunicorn")
            sudo("/etc/init.d/nginx stop")
        sudo("cp confs/gunicorn-upstart.conf /etc/init/gunicorn.conf")
        sudo("cp confs/nginx.conf /etc/nginx/sites-enabled/hasbug.conf")
        sudo("cp confs/logrotate.conf /etc/logrotate.d/gunicorn")
        sudo("start --verbose gunicorn")
        sudo("/etc/init.d/nginx start")

def deploy():
    update()
    reload_gunicorn()
<commit_msg>Renamed possibly conflicting configuration files.<commit_after>
from fabric.api import local, run, cd, settings, sudo, env, put
import os

# http://stackoverflow.com/questions/1180411/activate-a-virtualenv-via-fabric-as-deploy-user
# FIXME: These should be env. variables.
PROJECT_DIR   = "/home/ubuntu/work/hasb.ug"
NVM_DIR       = "/home/ubuntu/.nvm"
VENV_ACTIVATE = os.path.join(PROJECT_DIR, "bin/activate")

env.use_ssh_config = True

def virtualenv(command):
    run(". " + VENV_ACTIVATE + ' && ' + command)

# Invokable commands:

def hello():
    print "Hello!"

# This should be a part of initial per-user setup
#def setup_pyenv():
#    with cd(PROJECT_DIR):
#        run("virtualenv pyenv --distribute")

def update():
    with cd(PROJECT_DIR):
        run("git pull origin master")
        run("export NVM_DIR={dir}".format(dir=NVM_DIR))
        virtualenv("pip install -r requirements.txt")
        virtualenv("npm install")
        virtualenv("bower install")
        put("confs/boto.conf", "confs/boto.conf")
        run("make clean all")

def reload_gunicorn():
    with cd(PROJECT_DIR):
        with settings(warn_only=True):
            sudo("stop gunicorn-hasbug")
            sudo("/etc/init.d/nginx stop")
        sudo("cp confs/gunicorn-upstart.conf /etc/init/gunicorn-hasbug.conf")
        sudo("cp confs/nginx.conf /etc/nginx/sites-enabled/hasbug.conf")
        sudo("cp confs/logrotate.conf /etc/logrotate.d/gunicorn-hasbug")
        sudo("start --verbose gunicorn-hasbug")
        sudo("/etc/init.d/nginx start")

def deploy():
    update()
    reload_gunicorn()

{'fraction_non_alphanumeric': 0.14372990353697748, 'fraction_numerical': 0.0045016077170418, 'mean_word_length': 3.104221635883905, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '5844409', 'n_tokens_mistral': 1098, 'n_tokens_neox': 1027, 'n_words': 218}