1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- .DEFAULT_GOAL := help
- RED=\033[0;31m
- GREEN=\033[0;32m
- ORANGE=\033[0;33m
- BLUE=\033[0;34m
- NC=\033[0m # No Color
-
- .PHONY: install
- install: ## Install the dependencies
- @echo "${GREEN}🤖 Installing dependencies${NC}"
- python3 -m pip install --upgrade pip
- python3 -m pip install --editable .
-
- .PHONY: dev
- dev: install ## Install the development dependencies
- python3 -m pip install --editable ".[dev]"
-
- .PHONY: deps
- deps: ## Generate dependencies from pyproject.toml
- @echo "${GREEN}🤖 Updating requirements${NC}"
- python3 -m piptools compile --upgrade --quiet --resolver=backtracking --output-file=requirements.txt pyproject.toml
- python3 -m piptools compile --upgrade --quiet --resolver=backtracking --extra=dev --output-file=requirements-dev.txt pyproject.toml
-
- .PHONY: lint
- lint: ## Ensure code consistency
- @echo "${GREEN}🤖 Linting code${NC}"
- @ruff site.py --fix
- @black . --quiet
- @djlint david/templates/article_2020.html \
- david/templates/base_2020.html \
- david/templates/blogroll.html \
- david/templates/profil.html \
- david/templates/recherche.html \
- david/templates/tag_2021.html \
- --reformat --quiet --format-js --format-css
-
-
- .PHONY: build
- build: ## Generate the site
- @python site.py pages tags feed home
-
-
- .PHONY: publish
- publish: ## Make heavy actions
- @python site.py search blogroll
-
-
- .PHONY: blogroll
- blogroll: ## Generate the blogroll
- @python site.py blogroll
-
-
- .PHONY: live
- live: ## Rebuild contents on file change.
- @echo "${ORANGE}⚠️ You need http://eradman.com/entrproject/${NC}"
- ls david/2024/_sources/* | entr -r make build
-
-
- .PHONY: toot
- toot: ## Pre-write the Mastodon message.
- @python site.py toot
-
-
- .PHONY: help
- help:
- @python -c "$$PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST)
-
- # See https://daniel.feldroy.com/posts/autodocumenting-makefiles
- define PRINT_HELP_PYSCRIPT # start of Python section
- import re, sys
-
- output = []
- # Loop through the lines in this file
- for line in sys.stdin:
- # if the line has a command and a comment start with
- # two pound signs, add it to the output
- match = re.match(r'^([a-zA-Z_-]+):.*?## (.*)$$', line)
- if match:
- target, help = match.groups()
- output.append("\033[36m%-10s\033[0m %s" % (target, help))
- # Sort the output in alphanumeric order
- output.sort()
- # Print the help result
- print('\n'.join(output))
- endef
- export PRINT_HELP_PYSCRIPT # End of python section
|