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")
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)
def ctx(): return context.Context(config=docker.CONFIG)
def ctx(): return context.Context(config=helm.CONFIG)
def ctx(): return context.Context(config=python.CONFIG)
def ctx(): return context.Context()
def ctx(): return context.Context(config=terraform.CONFIG)
"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())