def run_command(command):

    if command.startswith("dokku") and not command.startswith("dokkutils"):
        command = command.replace("dokku", '', 1)
        command = "%s %s" % (_env.dokku_command, command)
        res = _local(command)
    else:
        _local(command)
Example #2
0
def host_print(msg, remote=True, leading_chars='\n'):
    ''' Print a raw message on the host. '''
    cmd = 'echo "{0}{1}"'.format(leading_chars, msg)

    with hide('running'):
        if remote:
            _run(cmd)
        else:
            _local(cmd)
Example #3
0
def update_envs(args=""):
    """
    Setup all evironmnt varables
        example of usage:
        * fab staging update_envs_dokku

    """
    envs_map = environment_keys(_env.environment_variables)[1]
    if envs_map:
        _local(_env.dokku_command + " config:set %s %s %s " %
               (_env.app_name_dokku, envs_map, args))
Example #4
0
def local(*args, **kwargs):
    '''Override Fabric's local() to facilitate output logging.'''
    capture = kwargs.get('capture')

    kwargs['capture'] = True
    out = _local(*args, **kwargs)

    if capture:
        return out
    else:
        print out
def schema(initial=False):
    """Create a schema migration for any changes."""
    if south:
        if initial:
            _local('django-admin.py schemamigration {} --initial'.format(APP_NAME))
        else:
            _local('django-admin.py schemamigration {} --auto'.format(APP_NAME))
    else:
            _local('django-admin.py makemigrations')
def schema(initial=False):
    """Create a schema migration for any changes."""
    if south:
        if initial:
            _local('django-admin.py schemamigration {} --initial'.format(
                APP_NAME))
        else:
            _local(
                'django-admin.py schemamigration {} --auto'.format(APP_NAME))
    else:
        _local('django-admin.py makemigrations')
def schema():
    """Create a schema migration for any changes."""
    _local('django-admin.py schemamigration currencies --auto')
Example #8
0
def restart():
    if _is_local(env.host):
        _local("sudo apachectl graceful")
    else:
        _sudo("apache2ctl graceful")
Example #9
0
def ipdb_test():
    """
    Run the test suite with ipdbplugin enabled for errors and failures,
    stopping after first error or failure.
    """
    _local('django-admin.py test --ipdb --ipdb-failures -sx')
Example #10
0
def migrate(migration=''):
    """Update a testing database with south."""
    _local('django-admin.py migrate %s %s' % (APP_NAME, migration))
Example #11
0
def test_ipdb(test_case=''):
    """Run the test suite using ipdb to debug errors and failures."""
    _local('django-admin.py test %s --ipdb --ipdb-failures' % test_case)
Example #12
0
def syncdb():
    """Create a database for testing in the shell or server."""
    _local('django-admin.py syncdb')
Example #13
0
def local(cmd):
    if hasattr(env,'capture_default'):
        _local(cmd, env.capture_default)
    else:
        _local(cmd)
Example #14
0
def run(command, remote=True):
    ''' Run a command using fabric. '''
    if remote:
        return _run(command)
    else:
        return _local(command)
Example #15
0
def schema(initial=False):
    """Create a schema migration for any changes."""
    if initial:
        _local('django-admin.py schemamigration %s --initial' % APP_NAME)
    else:
        _local('django-admin.py schemamigration %s --auto' % APP_NAME)
Example #16
0
def pypi_upload():
    """build and upload to PyPi"""
    _local('python setup.py sdist bdist_egg upload')
def test(test_case=""):
    """Run the test suite."""
    _local("django-admin.py test %s" % test_case)
Example #18
0
def test():
    """Run the ratelimit test suite."""
    _local('django-admin.py test')
Example #19
0
def schema():
    """Create a schema migration for any changes."""
    _local('django-admin.py schemamigration waffle --auto')
Example #20
0
def install_requirements():
    """Installs the python requirements from lib."""
    # Remove any existing versions.
    _local('rm -rf flask jinja2 werkzeug simplejson')
    
    # Extract the tar files.
    _local('tar xzf lib/Flask-0.8.tar.gz')
    _local('tar xf lib/Jinja2-2.6.tar')
    _local('tar xf lib/Werkzeug-0.8.1.tar')
    _local('tar xzf lib/simplejson-2.3.0.tar.gz')
    
    # Move the relevant files to the directory root.
    _local('mv Flask-0.8/flask .')
    _local('mv Jinja2-2.6/jinja2 .')
    _local('mv Werkzeug-0.8.1/werkzeug .')
    _local('mv simplejson-2.3.0/simplejson .')
    
    # Clean up after ourselves!
    _local('rm -rf Flask-0.8')
    _local('rm -rf Jinja2-2.6')
    _local('rm -rf Werkzeug-0.8.1')
    _local('rm -rf simplejson-2.3.0')
def test(test_case=''):
    """Run the test suite."""
    _local('django-admin.py test {}'.format(test_case))
Example #22
0
def test():
    """Run the tests."""
    _local('nosetests -s')
def makemigrations():
    """Create a schema migration for any changes."""
    _local('django-admin.py makemigrations {}'.format(APP_NAME))
def schema(initial=False):
    """Create a schema migration for any changes."""
    if initial:
        _local('django-admin.py schemamigration %s --initial' % APP_NAME)
    else:
        _local('django-admin.py schemamigration %s --auto' % APP_NAME)
def initialmigrate(migration=''):
    """Initial migrations"""
    _local('django-admin.py migrate'.format(APP_NAME, migration))
Example #26
0
def test_coverage():
    _local('coverage run --source=%s --omit=*/migrations/*.py '
           '$(which django-admin.py) test' % APP_NAME)
Example #27
0
def schema():
    """Create a schema migration for any changes."""
    _local('django-admin.py schemamigration djenie_siterelease --auto')
Example #28
0
def migrate():
    """Update a testing database with south."""
    _local('django-admin.py migrate')
Example #29
0
def jenkins_test():
    """Run the test suite with Django Jenkins, cover, pep8 and pyflakes."""
    _local('django-admin.py jenkins')
Example #30
0
def schema(initial=False):
    """Create a schema migration for any changes."""
    _local('django-admin.py makemigrations %s' % APP_NAME)
Example #31
0
def manage(cmd):
    """Update a testing database"""
    _local('django-admin.py {}'.format(cmd))
Example #32
0
def makemigrations():
    """Django version > 1.6 - Create a schema migration for any changes."""
    _local('django-admin.py makemigrations waffle')
Example #33
0
def test(test_case=''):
    """Run the test suite."""
    _local('django-admin.py test {}'.format(test_case))
Example #34
0
def run(command, capture=False, shell=True, pty=True):
    if _is_local(env.host):
        return _local(command % (env), capture=capture)
    else:
        return _run(command % (env), shell=shell, pty=pty)
Example #35
0
def syncdb():
    """Create a database for testing in the shell or server."""
    if south:
        _local('django-admin.py syncdb')
    else:
        _local('django-admin.py migrate')
Example #36
0
def test(args=''):
    """Run the test suite."""
    _local('django-admin.py test %s' % args)
Example #37
0
def shell():
    """Start a Django shell with the test settings."""
    _local('django-admin.py shell')
Example #38
0
def shell():
    """Open a Django shell."""
    _local('django-admin.py shell')
Example #39
0
def serve():
    """Start the Django dev server."""
    _local('django-admin.py runserver')
Example #40
0
def coverage():
    """Run the tests with a coverage report."""
    _local('nosetests -s --with-coverage --cover-package=commonware')
Example #41
0
def schema():
    """Create a schema migration for any changes."""
    _local('django-admin.py schemamigration waffle --auto')
def test(test_case=''):
    """Run the test suite."""
    _local('django-admin.py test %s' % test_case)
Example #43
0
def shell():
    """Start a Django shell with the test settings."""
    _local('django-admin.py shell')
def migrate(migration=''):
    """Update a testing database with south."""
    _local('django-admin.py migrate %s %s' % (APP_NAME, migration))
Example #45
0
def cover():
    """Run the test suite with coverage."""
    _local('django-admin.py test --with-coverage --cover-package=' + APP_NAME)
Example #46
0
def test():
    """Run the Waffle test suite."""
    _local('django-admin.py test')
Example #47
0
def migrate(app_name='', migration=''):
    """Update a testing database"""
    _local('django-admin.py migrate {} {}'.format(APP_NAME, migration))
Example #48
0
def syncdb():
    """Create a database for testing in the shell or server."""
    _local('django-admin.py syncdb')
def test(args=''):
    """Run the test suite."""
    _local('django-admin.py test %s' % args)
Example #50
0
def migrate():
    """Update a testing database with south."""
    _local('django-admin.py migrate')
def ipdb_test():
    """
    Run the test suite with ipdbplugin enabled for errors and failures,
    stopping after first error or failure.
    """
    _local('django-admin.py test --ipdb --ipdb-failures -sx')
Example #52
0
def test():
    """Run the test suite."""
    _local('django-admin.py test')
def makemigrations():
    """Create a database for testing in the shell or server."""
    _local('django-admin.py makemigrations urlographer')
Example #54
0
def serve():
    """Start the Django dev server."""
    _local('django-admin.py runserver')
def schema():
    """Create a schema migration for any changes."""
    _local('django-admin.py schemamigration %s --auto' % APP_NAME)
Example #56
0
def schema():
    """Create a schema migration for any changes."""
    _local('django-admin.py schemamigration %s --auto' % APP_NAME)
Example #57
0
def test(test_case=''):
    """Run the test suite."""
    _local('django-admin.py test %s' % test_case)
Example #58
0
def podcast(cmd):
    _local('django-admin.py podcast %s' % cmd)
Example #59
0
def test_coverage():
    _local('coverage run --source=%s --omit=*/migrations/*.py $(which django-admin.py) test' % APP_NAME)