How to use the honcho.environ.parse_procfile function in honcho

To help you get started, we’ve selected a few honcho 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 nickstenning / honcho / tests / test_environ.py View on Github external
def test_parse_procfile(content, processes):
    content = textwrap.dedent(content)
    p = environ.parse_procfile(content)
    assert p.processes == processes
github nickstenning / honcho / tests / test_environ.py View on Github external
def test_parse_procfile_ordered():
    content = textwrap.dedent("""
    one: onecommand
    two: twocommand
    three: twocommand
    four: fourcommand
    """)

    p = environ.parse_procfile(content)
    order = [k for k in p.processes]
    assert order == ['one', 'two', 'three', 'four']
github frascoweb / frasco / frasco / cli / run.py View on Github external
def run_command(info, host, port, procfile, process):
    processes = None
    if procfile:
        for filename in ["Procfile.%s" % info.env, "Procfile"]:
            if os.path.exists(filename):
                click.echo("Using %s" % filename)
                with open(filename) as f:
                    content = f.read()
                processes = honcho.environ.parse_procfile(content).processes
                break

    if not processes:
        processes = get_app_processes(info)

    if process:
        if process not in processes:
            click.echo('Unknown process %s' % process)
            sys.exit(1)
        click.echo('Only running process %s' % process)
        processes = dict([(process, processes[process])])

    start_honcho(processes, {"HOST": host, "PORT": port})
github nickstenning / honcho / honcho / command.py View on Github external
def _procfile(filename):
    try:
        with open(filename) as f:
            content = f.read()
    except IOError:
        raise CommandError('Procfile does not exist or is not a file')

    try:
        procfile = environ.parse_procfile(content)
    except AssertionError as e:
        raise CommandError(str(e))

    return procfile