Example #1
0
File: db.py Project: ydaniv/quilt
def put(local_file):
    """Put a DB dump, available locally, in the remote dump location."""

    utilities.notify(u'Loading a local db dump to the remote dump location.')

    execute(rebuild)
    operations.put(local_file, env.db_dump_file)
Example #2
0
File: vcs.py Project: ydaniv/quilt
def merge():
    utilities.notify(u'Now merging from the remote repository.')

    with prefix(env.workon):
        run('git merge ' + env.repository_branch + ' origin/' + env.repository_branch)
        run('git checkout ' + env.repository_branch)
        run(env.deactivate)
Example #3
0
File: vcs.py Project: ydaniv/quilt
def clone():
    utilities.notify(u'Now cloning from the remote repository.')

    with prefix(env.workon):
        run('git clone ' + env.repository_location + ' .')
        run('git checkout ' + env.repository_branch)
        run(env.deactivate)
Example #4
0
File: db.py Project: ydaniv/quilt
def load():
    """Load the DB from a valid SQL file."""

    utilities.notify(u'Loading data into the database.')

    execute(rebuild)
    run('psql ' + env.db_name + ' --username='******' --file=' + env.db_dump_file)
Example #5
0
File: db.py Project: ydaniv/quilt
def create():
    """Create the DB."""

    utilities.notify(u'Creating a new database.')

    run('createdb --template template0 --encoding UTF-8 '
        '--owner {user} {name}'.format(user=env.db_user, name=env.db_name))
Example #6
0
File: app.py Project: ydaniv/quilt
def ensure():
    """Ensures the app configuration and process management is in place."""

    utilities.notify(u'Ensuring the app is configured correctly.')

    execute(config)
    execute(management)
Example #7
0
def sanity():
    """Run a check on all project dependencies."""

    utilities.notify(u'Starting the project sanity check. '
                     'Here come the notifications:\n')

    utilities.sanity_check()
def clone():
    utilities.notify(u'Now cloning from the remote repository.')

    with prefix(env.workon):
        run('git clone ' + env.repository_location + ' .')
        run('git checkout ' + env.repository_branch)
        run(env.deactivate)
Example #9
0
def e(e='local'):
    """Sets properties for the target, based on declared configuration."""

    utilities.notify(u'Setting the environment for this task run.')

    DEFAULT_CONFIG = os.path.join(HERE, 'config.yaml')
    TARGETS_CONFIG = os.path.join(THERE, 'config.yaml')
    SENSITIVE_CONFIG = os.path.join(THERE, 'sensitive.yaml')

    if not os.path.exists(TARGETS_CONFIG):
        utilities.alert(u'No Quilt configuration file was found. Aborting.')
        return

    with open(DEFAULT_CONFIG) as default_file:
        default = yaml.load(default_file)

    with open(TARGETS_CONFIG) as targets_file:
        targets = yaml.load(targets_file)

    utilities.set_on_env(default, env)
    utilities.set_on_env(targets[e], env)

    if os.path.exists(SENSITIVE_CONFIG):
        with open(SENSITIVE_CONFIG) as sensitive_file:
            sensitives = yaml.load(sensitive_file)
            utilities.set_on_env(sensitives[e], env)

    utilities.notify(u'The target environment is ' + unicode(e))
def merge():
    utilities.notify(u'Now merging from the remote repository.')

    with prefix(env.workon):
        run('git merge ' + env.repository_branch + ' origin/' +
            env.repository_branch)
        run('git checkout ' + env.repository_branch)
        run(env.deactivate)
Example #11
0
def collectstatic():
    """Run static resource management for the project."""

    utilities.notify(u'Now running Django static asset collector.')

    with prefix(env.workon):
        run('python manage.py collectstatic')
        run(env.deactivate)
Example #12
0
def validate():
    """Run validation checks over the codebase."""

    utilities.notify(u'Now running Django validations.')

    with prefix(env.workon):
        run('python manage.py validate')
        run(env.deactivate)
Example #13
0
def migrate():
    """Run data migrations for the project."""

    utilities.notify(u'Now running Django migrations.')

    with prefix(env.workon):
        run('python manage.py syncdb --noinput --migrate')
        run(env.deactivate)
Example #14
0
File: app.py Project: ydaniv/quilt
def config():
    """Ensures the app configuration is in place."""

    utilities.notify(u'Ensuring the app configuration settings.')

    context = env
    cuisine.mode_sudo()
    content = cuisine.text_template(env.app_config_template, context)
    cuisine.file_write(env.app_config_file, content)
    execute(restart)
Example #15
0
File: db.py Project: ydaniv/quilt
def initial_data():
    """Load any initial data into the DB."""

    utilities.notify(u'Loading initial data.')

    with prefix(env.workon):
        if env.project_initial_data:
            for f in env.project_initial_data:
                local('python manage.py loaddata ' + f)
        run(env.deactivate)
Example #16
0
def upgrade():
    """A sequence that upgrades the project codebase and dependencies."""

    utilities.notify(u'Now starting the project upgrade sequence.')

    vcs.fetch()
    vcs.merge()
    environ.ensure()
    validate()
    migrate()
Example #17
0
File: app.py Project: ydaniv/quilt
def management():
    """Ensures the app process management is in place."""

    utilities.notify(u'Ensuring the app management settings.')

    context = env
    cuisine.mode_sudo()
    content = cuisine.text_template(env.app_management_template, context)
    cuisine.file_write(env.app_management_file, content)
    execute(update)
    execute(restart)
Example #18
0
def command(cmd, activate='no'):
    """Execute a command."""

    utilities.notify(u'Now executing the command you passed.')

    if activate == 'yes':

        with prefix(env.workon):
            run(cmd)
            run(env.deactivate)
    else:
        run(cmd)
Example #19
0
def deploy():
    """A sequence that deploys new code to a target."""

    utilities.notify(u'Now starting the project deploy sequence.')

    execute(vcs.fetch)
    execute(vcs.merge)
    execute(validate)
    execute(migrate)
    execute(collectstatic)
    execute(app.restart)
    execute(proxy.restart)
Example #20
0
def test():
    """Run tests for the project code."""

    utilities.notify(u'Running the project test suite.')

    project_namespace = env.project_name + '.apps.'
    project_apps = []

    for a in env.project_packages:
        if a.startswith(project_namespace):
            project_apps.append(a[len(project_namespace):])

    run('python manage.py test ' + ' '.join(project_apps))
Example #21
0
def upgrade():
    """A sequence that upgrades the project codebase and dependencies."""

    utilities.notify(u'Now starting the project upgrade sequence.')

    execute(vcs.fetch)
    execute(vcs.merge)
    execute(environ.ensure)
    execute(validate)
    execute(migrate)
    execute(collectstatic)
    execute(proxy.ensure)
    execute(app.ensure)
    execute(queue.ensure)
Example #22
0
def build():
    """A sequence that makes the initial build of the project environment."""

    utilities.notify(u'Now building out the remote environment.')

    execute(environ.make)
    execute(vcs.clone)
    execute(environ.ensure)
    execute(db.create)
    execute(validate)
    execute(migrate)
    execute(db.initial_data)
    execute(collectstatic)
    execute(proxy.ensure)
    execute(app.ensure)
    execute(queue.ensure)
Example #23
0
def bootstrap(initial='no', environment='no', clear_cache='no'):
    """A sequence the cleans and rebuilds the project environment."""

    utilities.notify(u'Bootstrapping the project. Hold on tight.')

    if initial == 'yes':
        db.create()
    else:
        db.rebuild()

    migrate()
    db.initial_data()

    if environment == 'yes':
        env.ensure()

    if clear_cache == 'yes':
        cache.flush()
Example #24
0
def bootstrap(initial='no', environment='no', clear_cache='no'):
    """A sequence the cleans and rebuilds the project environment."""

    utilities.notify(u'Bootstrapping the project. Hold on tight.')

    if initial == 'yes':
        execute(db.create)
    else:
        execute(db.rebuild)

    execute(migrate)
    execute(db.initial_data)

    if environment == 'yes':
        execute(env.ensure)

    if clear_cache == 'yes':
        execute(cache.flush)

    execute(app.restart)
    execute(proxy.restart)
Example #25
0
def ensure():
    utilities.notify(u'Ensuring all project dependencies are present.')

    pip()
Example #26
0
def npm():
    utilities.notify(u'Ensuring all Node.js dependencies are present.')

    local('npm install')
Example #27
0
def bower():
    utilities.notify(u'Ensuring all client-side dependencies are present.')

    local('bower install')
Example #28
0
def pip():
    utilities.notify(u'Ensuring all Python dependencies are present.')

    local('pip install -U -r requirements.txt')
Example #29
0
def ensure_settings():
    utilities.notify(u'Configuring local settings.')

    context = env
    content = cuisine.text_template(env.project_config_template, context)
    cuisine.file_write(env.project_config_file, content)
Example #30
0
File: vcs.py Project: ydaniv/quilt
def clone():
    utilities.notify(u'Now cloning from the remote repository.')

    local('git clone ' + env.repository_location + ' .')
    local('git checkout ' + env.repository_branch)
Example #31
0
File: vcs.py Project: ydaniv/quilt
def merge():
    utilities.notify(u'Now merging from the remote repository.')

    local('git merge ' + env.repository_branch + ' origin/' + env.repository_branch)
    local('git checkout ' + env.repository_branch)
Example #32
0
File: vcs.py Project: ydaniv/quilt
def fetch():
    utilities.notify(u'Now fetching from the remote repository.')

    local('git fetch')
def fetch():
    utilities.notify(u'Now fetching from the remote repository.')

    with prefix(env.workon):
        run('git fetch')
        run(env.deactivate)
def fetch():
    utilities.notify(u'Now fetching from the remote repository.')

    local('git fetch')
def merge():
    utilities.notify(u'Now merging from the remote repository.')

    local('git merge ' + env.repository_branch + ' origin/' +
          env.repository_branch)
    local('git checkout ' + env.repository_branch)
def clone():
    utilities.notify(u'Now cloning from the remote repository.')

    local('git clone ' + env.repository_location + ' .')
    local('git checkout ' + env.repository_branch)