<commit_before># -*- coding: utf-8 -*-

# http://docs.fabfile.org/en/1.5/tutorial.html
from __future__ import with_statement
from fabric.api import *
from contextlib import contextmanager as _contextmanager

@_contextmanager
def virtualenv():
    with prefix(env.virtualenv_activate):
        yield

env.hosts = ['172.16.17.32']
env.user = 'rootio'
env.project_root = '/home/rootio/public_python/rootio_web'
env.virtualenv_activate = 'source venv/bin/activate'
env.forward_agent = True

def git_update():
    stash_str = run("git stash")
    run("git pull origin master")
    if stash_str.strip() != 'No local changes to save':
        run("git stash pop")


def restart_apache():
    sudo("/etc/init.d/apache2 graceful")


def restart_cache():
    sudo("/etc/init.d/memcached restart", pty=False)


def touch_wsgi():
    # Touching the deploy.wsgi file will cause apache's mod_wsgi to
    # reload all python modules having to restart apache.
    with cd(env.project_root):
        run("touch deploy/rootio_web.wsgi")


def update(full=False):
    with cd(env.project_root):
        git_update()
        with virtualenv():
            run("pip install -r requirements.txt")
            run("python manage.py migrate up")
            #todo: static files
    touch_wsgi()
    #restart_cache()
    #restart_apache()


def deploy():
    update()


def initdb():
    local("python manage.py initdb")    


def reset():
    """
    Reset local debug env.
    """
    local("rm -rf /tmp/instance")
    local("mkdir /tmp/instance")


def runserver():
    """
    Run local server, for debugging only.
    Need to move up one directory, from deploy to see manage.py
    """
    with lcd('..'):
        reset()
        initdb()
        with virtualenv():
            local("python manage.py run")


<commit_msg>light changes to fab file, allowing local commit<commit_after># -*- coding: utf-8 -*-

# http://docs.fabfile.org/en/1.5/tutorial.html
from __future__ import with_statement
from fabric.api import *
from contextlib import contextmanager as _contextmanager


@_contextmanager
def virtualenv():
    with prefix(env.virtualenv_activate):
        yield

env.hosts = ['172.16.17.32']
env.user = 'csik'
env.project_root = '/home/csik/public_python/rootio_telephony'
env.virtualenv_activate = 'source venv/bin/activate'
env.forward_agent = Truebranch = 'master'

def git_up(branch = "master"):
    local("git add -p && git commit")
    local("git push origin {0}".format(branch))

def git_update(branch = 'master'):
    with cd(env.project_root):
        stash_str = run("git stash")
        run("git pull origin {0}".format(branch))
        if stash_str.strip() != 'No local changes to save':
            run("git stash pop")


def restart_apache():
    sudo("/etc/init.d/apache2 graceful")


def restart_cache():
    sudo("/etc/init.d/memcached restart", pty=False)


def touch_wsgi():
    # Touching the deploy.wsgi file will cause apache's mod_wsgi to
    # reload all python modules having to restart apache.
    with cd(env.project_root):
        run("touch deploy/rootio_web.wsgi")


def update(full=False):
    with cd(env.project_root):
        git_update()
        with virtualenv():
            run("pip install -r requirements.txt")
            run("python manage.py migrate up")
            #todo: static files
    touch_wsgi()
    #restart_cache()
    #restart_apache()


def deploy():
    update()


def initdb():
    local("python manage.py initdb")    


def reset():
    """
    Reset local debug env.
    """
    local("rm -rf /tmp/instance")
    local("mkdir /tmp/instance")


def runserver():
    """
    Run local server, for debugging only.
    Need to move up one directory, from deploy to see manage.py
    """
    with lcd('..'):
        reset()
        initdb()
        with virtualenv():
            local("python manage.py run")



{'fraction_non_alphanumeric': 0.12924993511549443, 'fraction_numerical': 0.007267064624967558, 'mean_word_length': 2.8617234468937878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2294283', 'n_tokens_mistral': 1255, 'n_tokens_neox': 1189, 'n_words': 329}