-
-
Notifications
You must be signed in to change notification settings - Fork 102
/
Makefile
66 lines (52 loc) · 1.59 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
SOURCE_FILES = Makefile cookiecutter.json {{cookiecutter.project_name}}/* {{cookiecutter.project_name}}/*/*
GENERATED_PROJECT := TemplateDemo
ENV := .venv
# MAIN ########################################################################
.PHONY: all
all: build
make all -C $(GENERATED_PROJECT)
.PHONY: dev
dev: install clean
poetry run sniffer
# DEPENDENCIES ################################################################
.PHONY: bootstrap
bootstrap:
asdf plugin add python || asdf plugin update python
asdf plugin add poetry https://github.com/asdf-community/asdf-poetry.git || asdf plugin update poetry
asdf install
.PHONY: doctor
doctor:
{{cookiecutter.project_name}}/bin/verchew
.PHONY: install
install: $(ENV)
$(ENV): poetry.lock
@ poetry config virtualenvs.in-project true
ifdef CI
poetry install --no-dev
else
poetry install
endif
@ touch $@
ifndef CI
poetry.lock: pyproject.toml
poetry lock --no-update
@ touch $@
endif
# BUILD #######################################################################
.PHONY: build
build: install $(GENERATED_PROJECT)
$(GENERATED_PROJECT): $(SOURCE_FILES)
cat cookiecutter.json
poetry run cookiecutter . --no-input --overwrite-if-exists
ifndef CI
mkdir -p $(GENERATED_PROJECT)/.git
echo '[remote "origin"]\nurl = https://github.com/jacebrowning/template-python-demo' > $(GENERATED_PROJECT)/.git/config
endif
cd $(GENERATED_PROJECT) && poetry lock --no-update
@ touch $(GENERATED_PROJECT)
# CLEANUP #####################################################################
.PHONY: clean
clean:
rm -rf $(GENERATED_PROJECT)
rm -rf $(ENV)
.DEFAULT_GOAL := install