diff --git a/cookiecutter/target-template/hooks/post_gen_project.py b/cookiecutter/target-template/hooks/post_gen_project.py new file mode 100644 index 000000000..c80aa2806 --- /dev/null +++ b/cookiecutter/target-template/hooks/post_gen_project.py @@ -0,0 +1,16 @@ +#!/usr/bin/env python +from pathlib import Path +import shutil + + +BASE_PATH = Path('{{cookiecutter.library_name}}') + + +if __name__ == '__main__': + + if '{{ cookiecutter.license }}' != 'Apache-2.0': + Path('LICENSE').unlink() + + if '{{ cookiecutter.include_ci_files }}' != 'GitHub': + shutil.rmtree(Path('.github')) + diff --git a/cookiecutter/target-template/{{cookiecutter.target_id}}/.github/{% if cookiecutter.include_ci_files == 'GitHub' %}dependabot.yml{%endif%} b/cookiecutter/target-template/{{cookiecutter.target_id}}/.github/dependabot.yml similarity index 100% rename from cookiecutter/target-template/{{cookiecutter.target_id}}/.github/{% if cookiecutter.include_ci_files == 'GitHub' %}dependabot.yml{%endif%} rename to cookiecutter/target-template/{{cookiecutter.target_id}}/.github/dependabot.yml diff --git a/cookiecutter/target-template/{{cookiecutter.target_id}}/.github/workflows/{% if cookiecutter.include_ci_files == 'GitHub' %}test.yml{%endif%} b/cookiecutter/target-template/{{cookiecutter.target_id}}/.github/workflows/test.yml similarity index 100% rename from cookiecutter/target-template/{{cookiecutter.target_id}}/.github/workflows/{% if cookiecutter.include_ci_files == 'GitHub' %}test.yml{%endif%} rename to cookiecutter/target-template/{{cookiecutter.target_id}}/.github/workflows/test.yml diff --git a/cookiecutter/target-template/{{cookiecutter.target_id}}/{%if 'Apache-2.0' == cookiecutter.license %}LICENSE{%endif%} b/cookiecutter/target-template/{{cookiecutter.target_id}}/LICENSE similarity index 100% rename from cookiecutter/target-template/{{cookiecutter.target_id}}/{%if 'Apache-2.0' == cookiecutter.license %}LICENSE{%endif%} rename to cookiecutter/target-template/{{cookiecutter.target_id}}/LICENSE