Пример #1
0
def build_repos(repos):
    from invoke import context
    # build repos
    for repo in repos:

        c = context.Context()
        with c.cd(repo):
            if repo == "haoduoyu-club":
                c.run("pip3 install -r requirement.txt")
            else:
                c.run("npm install")
                try:
                    c.run("npm run prepublish")
                except Exception as e:
                    print(str(e))
                c.run("npm run install-local")
Пример #2
0
def test_scenario(c=context.Context(), scenario='default', destroy=False):
    molecule_dir = os.path.join(PROJECT_ROOT_DIR, 'molecule/{scenario}'.format(scenario=scenario))
    ansible_cfg_filename = os.path.join(molecule_dir, 'ansible.cfg')
    inventory_filename = os.path.join(molecule_dir, 'inventory')
    molecule_data = read_molecule_yml(scenario=scenario)

    inventory_names = [x['name'] for x in molecule_data['platforms']]
    driver_name = molecule_data['driver']['name']
    inventory_items = []

    for name in inventory_names:
        inventory_items.append('{name} ansible_connection={driver}'.format(name=name, driver=driver_name))

    inventory = '\n'.join(inventory_items)
    inventory += '\n'

    original_dir = os.getcwd()
    os.chdir(molecule_dir)
    create_ansible_config(filename=ansible_cfg_filename)
    create_ansible_inventory(filename=inventory_filename, inventory=inventory)

    try:
        for run_on in inventory_names:
            os.environ.setdefault('MOLECULE_INVENTORY_FILE', 'inventory')
            cmd_args = [
                'pytest',
                '--connection={driver}'.format(driver=driver_name),
                '--hosts={run_on}'.format(run_on=run_on),
                '-vs',
                '-rs',
                'tests/'
            ]
            cmd = ' '.join(cmd_args)
            c.run(cmd, pty=True)

    finally:
        os.chdir(original_dir)

    if destroy:
        c.run('molecule destroy -s {scenario}'.format(scenario=scenario), hide=True)
Пример #3
0
def ctx():
    return context.Context(config=docker.CONFIG)
Пример #4
0
def ctx():
    return context.Context(config=helm.CONFIG)
Пример #5
0
def ctx():
    return context.Context(config=python.CONFIG)
Пример #6
0
def ctx():
    return context.Context()
Пример #7
0
def ctx():
    return context.Context(config=terraform.CONFIG)
Пример #8
0
        "gray": ["#8f8f8f", "#8f8f8f75", "#8f8f8f15", "#43B9D8", "#43B9D815"],
        "white": ["#f1f1f1", "#f1f1f175", "#f1f1f115", "#43B9D8", "#43B9D815"],
    }

    with open("themes/Monokai-Charcoal.json") as f:
        base_theme = json.load(f)

    for feature_name, colors in features.items():
        theme = copy.deepcopy(base_theme)
        theme["name"] = theme["name"] + f" ({feature_name})"

        for name, hex_code in theme["colors"].items():
            for i, base_hex_code in enumerate(base_colors):
                if base_hex_code == hex_code:
                    theme["colors"][name] = colors[i]

        file_name = f"themes/Monokai-Charcoal-{feature_name}.json"
        with open(file_name, "w") as f:
            json.dump(theme, f)
        c.run(f"npx prettier --write {file_name}")


@task
def deploy(c):
    c.run("npx vsce package")
    c.run("npx vsce publish")


if __name__ == "__main__":
    build_colors(context.Context())