Esempio n. 1
0
def project(_project: Repository, template: Repository) -> Repository:
    """Create a GitHub repository for a Cookiecutter template project."""
    _project.create_file(
        path=".cookiecutter.json",
        message="Create .cookiecutter.json",
        content=json.dumps({
            "_template": f"gh:{template.full_name}",
            "project": "example"
        }).encode(),
    )
    _project.create_file(
        path="README.md",
        message="Create README",
        content=b"# example",
    )
    return _project
Esempio n. 2
0
def template(_template: Repository) -> Repository:
    """Create a GitHub repository for a Cookiecutter template."""
    _template.create_file(
        path="cookiecutter.json",
        message="Create cookiecutter.json",
        content=json.dumps({
            "project": "example"
        }).encode(),
    )
    _template.create_file(
        path="{{cookiecutter.project}}/.cookiecutter.json",
        message="Create .cookiecutter.json in project",
        content=b"{{cookiecutter | jsonify}}",
    )
    _template.create_file(
        path="{{cookiecutter.project}}/README.md",
        message="Create README.md in project",
        content=b"# {{cookiecutter.project}}",
    )
    return _template