nickderobertis/flexlate

can use get all renderables

Opened this issue · 0 comments

can use get all renderables

# TODO: can use get all renderables

            raise ValueError("repo working dir should not be none")

        project_root = Path(repo.working_dir)
        template = config_manager.get_template_by_name(
            template_name, project_root=project_root
        )

        # Determine location of config
        # Need to get renderable to render path in case it is templated
        # TODO: can use get all renderables
        renderables = config_manager.get_renderables_for_updates(
            config_manager.get_no_op_updates(project_root=project_root),
            project_root=project_root,
        )
        if len(renderables) == 0:
            raise CannotRemoveAppliedTemplateException(
                f"Cannot find any applied template with name {template_name} "
                f"because there are no applied templates"
            )
        renderable = renderables[0]
        new_relative_out_root = Path(
            renderer.render_string(
                str(template.render_relative_root_in_output), renderable
            )
        )
        full_local_config_out_root = out_root / new_relative_out_root
        config_path = determine_config_path_from_roots_and_add_mode(
            full_local_config_out_root, project_root, add_mode
        )

        expanded_out_root = get_expanded_out_root(
            out_root, project_root, template.render_relative_root_in_output, add_mode
        )

        if add_mode == AddMode.USER:
            # No need to commit config changes for user

e73e5fa7646353a64f7778a5bca6696392d679cd