Skip to content

Commit 4b9620f

Browse files
authored
Fix generation when documentation is set to none (#15)
1 parent 07889bd commit 4b9620f

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

.github/workflows/tests.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,19 @@ jobs:
7878
make package
7979
make doc
8080
cd .. && rm -rf /tmp/bit-trails
81+
82+
- name: run template (no docs)
83+
run: |
84+
cookiecutter --no-input -o /tmp . documentation='none'
85+
86+
[[ -d /tmp/python-project/src/python_project ]] || { >&2 echo "not generated?"; exit 1; }
87+
[[ ! -f /tmp/python-project/.github/workflows/docs.yml ]] || { >&2 echo "not expecting docs.yml"; exit 1; }
88+
89+
cd /tmp/python-project
90+
make dev
91+
make reformat
92+
make lint
93+
make test
94+
make package
95+
make doc
96+
cd .. && rm -rf /tmp/python-project

hooks/post_gen_project.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# We delete _cli.py and __main__.py if we're not generating a CLI.
66
"{% if cookiecutter.entry_point == '' %} {{ cookiecutter.__project_src_path }}/_cli.py {% endif %}",
77
"{% if cookiecutter.entry_point == '' %} {{ cookiecutter.__project_src_path }}/__main__.py {% endif %}",
8+
# We delete the docs GH workflow if the project has no documentation
9+
"{% if cookiecutter.documentation == 'none' %} .github/workflows/docs.yml {% endif %}",
810
]
911

1012
for path in REMOVE_PATHS:

{{cookiecutter.project_slug}}/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,14 @@ test tests: $(VENV)/pyvenv.cfg
8282
python -m coverage report -m $(COV_ARGS)
8383

8484
.PHONY: doc
85+
{%- if cookiecutter.documentation == 'pdoc' %}
8586
doc: $(VENV)/pyvenv.cfg
8687
. $(VENV_BIN)/activate && \
8788
pdoc -o html $(PY_IMPORT)
89+
{%- elif cookiecutter.documentation == 'none' %}
90+
doc:
91+
@echo "No documentation set up"
92+
{%- endif %}
8893

8994
.PHONY: package
9095
package: $(VENV)/pyvenv.cfg

0 commit comments

Comments
 (0)