How to use the invoke.task function in invoke

To help you get started, we’ve selected a few invoke examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vhbit / rust-docset / docset / rust / tasks.py View on Github external
@task 
def cargo(feed_base_url = None):
    """Builds docset for cargo project

If feed base url is present also generates a feed file. \
Base url isn't checked, so it could be a marker, which will be \
processed later by other tools like sed."""
    proj_loc = cargo_result(["locate-project"])
    proj_root = os.path.dirname(proj_loc["root"])
    manifest = cargo_result(["read-manifest", "--manifest-path=%s" % proj_root])

    docset_dir = os.path.join(proj_root, "target", "docset")
    shutil.rmtree(docset_dir, True)

    ds = {
        "name": manifest["name"],
        "version": manifest["version"],
github assembl / assembl / assembl / tasks / sudoer.py View on Github external
@task
def install_yarn(c):
    """Install yarn."""
    if not c.run('which yarn', warn=True).failed:
        return
    if not exists('/etc/apt/sources.list.d/yarn.list'):
        c.run('echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee -a /etc/apt/sources.list.d/yarn.list')
        c.run('curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -')
        c.sudo('apt-get update')
    c.sudo('apt-get install -y yarn')
github sarugaku / pythonfinder / tasks / __init__.py View on Github external
@invoke.task()
def get_changelog(ctx):
    changelog = _render_log()
    print(changelog)
    return changelog
github sphericalpm / lektorium / tasks.py View on Github external
@task
def build_server_image(ctx):
    if 'key' not in ctx:
        raise RuntimeError('pleas provde key for access server to gitlab')

    server_dir = f'{CONTAINERS_BASE}/server'
    with (pathlib.Path(server_dir) / 'key').open('w') as key_file:
        key = os.linesep.join((
            '-----BEGIN RSA PRIVATE KEY-----',
            *ctx['key'],
            '-----END RSA PRIVATE KEY-----',
            '',
        ))
        key_file.write(key)
    ctx.run(f'rm {server_dir}/lektorium*.whl', warn=True)
    ctx.run(f'pip wheel -w {server_dir} --no-deps .')
    ctx.run((
github mozilla / kitsune / k8s / deployments.py View on Github external
@task(check_environment)
def delete_celery(ctx, apply=False):
    _delete('celery', ctx, apply)
github uranusjr / pythonup-windows / shims / __init__.py View on Github external
@invoke.task()
def build(ctx, release=False, verbose=False):
    build_params = [
        '--release' * release,
        '--verbose' * verbose,
    ]
    with ctx.cd(SHIMSDIR):
        ctx.run('cargo build {}'.format(' '.join(build_params)))
github python-cmd2 / cmd2 / tasks.py View on Github external
@invoke.task
def tox_clean(context):
    "Remove tox virtualenvs and logs"
    #pylint: disable=unused-argument
    rmrf('.tox')
namespace_clean.add_task(tox_clean, 'tox')
github jmcarp / neurotrends / tasks.py View on Github external
@task
def install_conda(yes=False):
    cmd = 'conda install --file conda-requirements.txt'
    if yes:
        cmd += ' --yes'
    run(cmd, pty=True)
github lsds / Faasm / tasks / aws.py View on Github external
@task
def invoke_lambda(ctx, lambda_name, async=False, payload=None, no_payload=False):
    client = boto3.client("lambda", region_name=AWS_REGION)

    kwargs = {
        "FunctionName": lambda_name,
        "InvocationType": "Event" if async else "RequestResponse",
    }

    if not no_payload:
        payload = payload if payload else {}
        payload["submitted"] = str(datetime.now())
        kwargs["Payload"] = dumps(payload)

    response = client.invoke(**kwargs)

    print(response)
github ndparker / rjsmin / tasks / clean.py View on Github external
@_invoke.task()
def cacheclean(ctx):
    """ Wipe Cache files """
    ctx.shell.rm_rf(
        '.tox',
        'bench/.tox',
        '.cache',
        'tests/.cache',
        'tests/.pytest_cache',
        '.mypy_cache',
    )