Example #1
0
def git_init_submodules(git_path):
    """
    Initialise and update git submodules
    """
    check_on_path('git')
    
    puts(info="Initialising git submodules")
    with cd(git_path):
        run('git submodule update --init')
    puts(success="Submodules initialised")
Example #2
0
File: lib.py Project: zhuf/pwlocker
def git_init_submodules(git_path):
    """
    Initialise and update git submodules
    """
    check_on_path('git')

    puts(info="Initialising git submodules")
    with cd(git_path):
        run('git submodule update --init')
    puts(success="Submodules initialised")
Example #3
0
def create_virtualenv(venv_path, user, permissions='0750'):
    "Creates a virtualenv"
    check_on_path('virtualenv')
    
    if not files.exists(os.path.join(venv_path, "bin/activate")):
        create_directories(venv_path, user, permissions)
        puts(info='Creating virtualenv at %s' % venv_path)
        run("virtualenv --no-site-packages %s" % venv_path)
        puts(success='virtualenv created')
        return 1
    else:
        puts(info='virtualenv already exists at %s' % venv_path)
Example #4
0
File: lib.py Project: zhuf/pwlocker
def create_virtualenv(venv_path, user, permissions='0750'):
    "Creates a virtualenv"
    check_on_path('virtualenv')

    if not files.exists(os.path.join(venv_path, "bin/activate")):
        create_directories(venv_path, user, permissions)
        puts(info='Creating virtualenv at %s' % venv_path)
        run("virtualenv --no-site-packages %s" % venv_path)
        puts(success='virtualenv created')
        return 1
    else:
        puts(info='virtualenv already exists at %s' % venv_path)
Example #5
0
def restart_services():
    """
    Restarts/reloads gunicorn, nginx and memcached
    """
    check_on_path('supervisorctl')
    
    # restart all processes controlled by supervisord
    sudo('supervisorctl restart all')

    # restart nginx
    sudo('/etc/init.d/nginx restart')
    
    # restart memcached
    sudo('/etc/init.d/memcached restart')
Example #6
0
File: lib.py Project: zhuf/pwlocker
def restart_services():
    """
    Restarts/reloads gunicorn, nginx and memcached
    """
    check_on_path('supervisorctl')

    # restart all processes controlled by supervisord
    sudo('supervisorctl restart all')

    # restart nginx
    sudo('/etc/init.d/nginx restart')

    # restart memcached
    sudo('/etc/init.d/memcached restart')
Example #7
0
def git_pull(destination):
    """
    Update the git repository at destination.
    """
    check_on_path('git')

    puts(info="Updating git repository in %s" % destination)

    if run("test -d %s" % destination).succeeded:
        with cd(destination):
            run('git pull')
            puts(success="Repository updated")
    else:
        puts(error="Unable to pull - destination directory doesn't exist")
        abort("Aborting")
Example #8
0
File: lib.py Project: zhuf/pwlocker
def git_pull(destination):
    """
    Update the git repository at destination.
    """
    check_on_path('git')

    puts(info="Updating git repository in %s" % destination)

    if run("test -d %s" % destination).succeeded:
        with cd(destination):
            run('git pull')
            puts(success="Repository updated")
    else:
        puts(error="Unable to pull - destination directory doesn't exist")
        abort("Aborting")
Example #9
0
def git_clone(repo_path, destination, user):
    """
    Clone the git repository at repo_path to destination.

    If destination doesn't exist, it will be created and owned by user.
    """
    check_on_path('git')

    puts(info="Cloning git repository %s into %s" % (repo_path, destination))

    with settings(warn_only=True):
        if run("test -d %s" % destination).failed:
            puts(info="Creating destination directory %s" % destination)
            create_directories(destination, user)
            puts(success="Destination directory created")

    run('git clone %s %s' % (repo_path, destination))
    puts(success="Repository cloned")
Example #10
0
File: lib.py Project: zhuf/pwlocker
def git_clone(repo_path, destination, user):
    """
    Clone the git repository at repo_path to destination.

    If destination doesn't exist, it will be created and owned by user.
    """
    check_on_path('git')

    puts(info="Cloning git repository %s into %s" % (repo_path, destination))

    with settings(warn_only=True):
        if run("test -d %s" % destination).failed:
            puts(info="Creating destination directory %s" % destination)
            create_directories(destination, user)
            puts(success="Destination directory created")

    run('git clone %s %s' % (repo_path, destination))
    puts(success="Repository cloned")