forked from audreyfeldroy/cookiecutter-pypackage
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
51 lines (42 loc) · 1.29 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
COOKIES_DIR = $(CURDIR)/cookies
BAKE_OPTIONS ?= --no-input
NO_CRUFT = generated_with_cruft=n
.DEFAULT_GOAL := all
.PHONY: all
all: help
.PHONY: help
help:
@echo "bake to generate project using defaults"
@echo "test to test cookiecutter template generation"
@echo "clean to remove baked cookies"
@echo "docs to generate Sphinx docs"
.PHONY: test
test:
@echo "Running all tests"
@bash -c 'pytest'
.PHONY: test-no-gdal
test-no-gdal:
@echo "Running all tests"
@bash -c 'pytest -m "not requires_gdal"'
.PHONY: clean
clean:
test -d $(COOKIES_DIR) && rm -v -rf $(COOKIES_DIR);
.PHONY: bake
bake:
@echo "Creating a new project with default settings"
@mkdir -p "cookies"
@bash -c 'cookiecutter $(BAKE_OPTIONS) . --output-dir $(COOKIES_DIR) --overwrite-if-exists $(NO_CRUFT)'
.PHONY: docs
docs:
@echo "Generating docs with Sphinx ..."
@-bash -c '$(MAKE) -C $@ clean html'
@echo "Opening browser to: file:/$(CURDIR)/docs/build/html/index.html"
@-bash -c 'xdg-open $(CURDIR)/docs/build/html/index.html'
# generate project using defaults and watch for changes
watch: bake
watchmedo shell-command -p '*.*' -c 'make bake -e BAKE_OPTIONS=$(BAKE_OPTIONS)' -W -R -D \{{cookiecutter.project_slug}}/
#
# replay last cookiecutter run and watch for changes
# replay: BAKE_OPTIONS=--replay
# replay: watch
# ;