diff --git a/copier.yml b/copier.yml index 2a5abf1..e96aa60 100644 --- a/copier.yml +++ b/copier.yml @@ -101,6 +101,12 @@ apt_packages: build via apt-get on a Linux system. default: "libsndfile1," +gitignore_custom: + type: str + help: | + Enter a comma-separated list of files, directories, or file patterns for the .gitignore file. + default: "your/custom/path/," + valid_python_versions: when: false type: yaml diff --git a/template/.gitignore.jinja b/template/.gitignore.jinja new file mode 100644 index 0000000..4d68ec4 --- /dev/null +++ b/template/.gitignore.jinja @@ -0,0 +1,131 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ +docs/_autosummary + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints +*/.ipynb_checkpoints/* + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ + +# vs code +.vscode/ +.idea/ + +# macOS +.DS_Store + +# workaround for failing test discovery in vscode +tests/*/__init__.py +tests/private/ + +# ignore downloads from pyfar gallery +docs/header.rst +docs/_static/favicon.ico +docs/_static/header.rst +docs/_static/css/custom.css +docs/_static/js/custom.js +docs/resources/logos/pyfar_logos_fixed_size_pyfar.png +docs/{{ logo_path_gallery }} + +# custom +{{ pypi_license_classifier }} +{%- for key in gitignore_custom.split(',') %} +{{ key.strip() }} +{%- endfor %} diff --git a/tests/test_copier.py b/tests/test_copier.py index 98f3b11..4537084 100644 --- a/tests/test_copier.py +++ b/tests/test_copier.py @@ -30,6 +30,7 @@ def test_project_folder(default_project): ".readthedocs.yml", ".copier-answers.yml", ".editorconfig", + ".gitignore", ]) def test_generated_file_exists(default_project, file_name): assert default_project.project_dir.joinpath(file_name).exists() @@ -171,3 +172,12 @@ def test_content_readthedocs(default_project, desired): content = default_project.project_dir.joinpath( ".readthedocs.yml").read_text() assert desired in content + +@pytest.mark.parametrize("desired", [ + 'docs/resources/logos/pyfar_logos_fixed_size_my_project.png', + 'your/custom/path/', +]) +def test_content_gitignore(default_project, desired): + content = default_project.project_dir.joinpath( + ".gitignore").read_text() + assert desired in content