|
1 | | -# ------------------------------------------ |
2 | | -# Practicalli: Makefile |
| 1 | +# -------------------------------------- # |
| 2 | +# Practicalli Makefile |
3 | 3 | # |
4 | 4 | # Consistent set of targets to support local book development |
5 | | -# ------------------------------------------ |
| 5 | +# -------------------------------------- # |
6 | 6 |
|
| 7 | +# -- Makefile task config -------------- # |
7 | 8 | # .PHONY: ensures target used rather than matching file name |
8 | 9 | # https://makefiletutorial.com/#phony |
9 | 10 | .PHONY: all clean docs lint pre-commit-check test |
| 11 | +# -------------------------------------- # |
10 | 12 |
|
11 | | -# ------- Makefile Variables --------- # |
| 13 | +# -- Makefile Variables ---------------- # |
12 | 14 | # run help if no target specified |
13 | 15 | .DEFAULT_GOAL := help |
14 | | -SHELL := /usr/bin/zsh |
15 | | - |
16 | 16 | # Column the target description is printed from |
17 | 17 | HELP-DESCRIPTION-SPACING := 24 |
18 | 18 |
|
| 19 | +SHELL := /usr/bin/zsh |
| 20 | + |
19 | 21 | # Tool Commands |
20 | 22 | MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container |
21 | 23 | MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777 |
| 24 | +OUTDATED_FILE := outdated-$(shell date +%y-%m-%d-%T).md |
| 25 | +# -------------------------------------- # |
22 | 26 |
|
23 | | -# Makefile file and directory name wildcard |
24 | | -EDN-FILES := $(wildcard *.edn) |
25 | | -# ------------------------------------ # |
26 | | - |
27 | | -# ------ Quality Checks ------------ # |
| 27 | +# -- Quality Checks ------------------ # |
28 | 28 | pre-commit-check: lint |
29 | 29 |
|
30 | 30 | lint: ## Run MegaLinter with custom configuration (node.js required) |
31 | | - $(info --------- MegaLinter Runner ---------) |
| 31 | + $(info -- MegaLinter Runner ---------------------) |
32 | 32 | $(MEGALINTER_RUNNER) |
33 | 33 |
|
34 | | -lint-fix: ## Run MegaLinter with custom configuration (node.js required) |
35 | | - $(info --------- MegaLinter Runner ---------) |
| 34 | +lint-fix: ## Run MegaLinter with applied fixes and custom configuration (node.js required) |
| 35 | + $(info -- MegaLinter Runner fix errors ----------) |
36 | 36 | $(MEGALINTER_RUNNER) --fix |
37 | 37 |
|
38 | 38 | lint-clean: ## Clean MegaLinter report information |
39 | | - $(info --------- MegaLinter Clean Reports ---------) |
| 39 | + $(info -- MegaLinter Clean Reports --------------) |
40 | 40 | - rm -rf ./megalinter-reports |
41 | 41 |
|
42 | 42 | megalinter-upgrade: ## Upgrade MegaLinter config to latest version |
43 | | - $(info --------- MegaLinter Upgrade Config ---------) |
| 43 | + $(info -- MegaLinter Upgrade Config -------------) |
44 | 44 | npx mega-linter-runner@latest --upgrade |
45 | | -# ------------------------------------ # |
46 | 45 |
|
47 | | -# --- Documentation Generation ------ # |
48 | | -python-venv: ## Enable Python Virtual Environment for MkDocs |
49 | | - $(info --------- Mkdocs Local Server ---------) |
| 46 | +dependencies-outdated: ## Report new versions of library dependencies and GitHub action |
| 47 | + $(info -- Search for outdated libraries ---------) |
| 48 | + - clojure -T:search/outdated > $(OUTDATED_FILE) |
| 49 | + |
| 50 | +dependencies-update: ## Update all library dependencies and GitHub action |
| 51 | + $(info -- Search for outdated libraries ---------) |
| 52 | + - clojure -T:update/dependency-versions > $(OUTDATED_FILE) |
| 53 | +# -------------------------------------- # |
| 54 | + |
| 55 | +# --- Documentation Generation -------- # |
| 56 | +python-venv: ## Create Python Virtual Environment |
| 57 | + $(info -- Create Python Virtual Environment -----) |
| 58 | + python3 -m venv ~/.local/venv |
| 59 | + |
| 60 | +python-activate: ## Activate Python Virtual Environment for MkDocs |
| 61 | + $(info -- Mkdocs Local Server -------------------) |
50 | 62 | source ~/.local/venv/bin/activate |
51 | 63 |
|
| 64 | +mkdocs-install: |
| 65 | + $(info -- Install Material for MkDocs -----------) |
| 66 | + source ~/.local/venv/bin/activate && pip install mkdocs-material mkdocs-callouts mkdocs-glightbox mkdocs-git-revision-date-localized-plugin mkdocs-redirects mkdocs-rss-plugin pillow cairosvg --upgrade |
| 67 | + |
52 | 68 | docs: ## Build and run mkdocs in local server (python venv) |
53 | | - $(info --------- Mkdocs Local Server ---------) |
| 69 | + $(info -- MkDocs Local Server -------------------) |
54 | 70 | source ~/.local/venv/bin/activate && $(MKDOCS_SERVER) |
55 | 71 |
|
56 | 72 | docs-changed: ## Build only changed files and run mkdocs in local server (python venv) |
57 | | - $(info --------- Mkdocs Local Server ---------) |
| 73 | + $(info -- Mkdocs Local Server -------------------) |
58 | 74 | source ~/.local/venv/bin/activate && $(MKDOCS_SERVER) --dirtyreload |
59 | 75 |
|
60 | 76 | docs-build: ## Build mkdocs (python venv) |
61 | | - $(info --------- Mkdocs Local Server ---------) |
| 77 | + $(info -- Mkdocs Build Website ------------------) |
62 | 78 | source ~/.local/venv/bin/activate && mkdocs build |
63 | | -# ------------------------------------ # |
64 | 79 |
|
65 | | -# ------------ Help ------------------ # |
| 80 | +docs-debug: ## Run mkdocs local server in debug mode (python venv) |
| 81 | + $(info -- Mkdocs Local Server Debug -------------) |
| 82 | + . ~/.local/venv/bin/activate; $(MKDOCS_SERVER) -v |
| 83 | + |
| 84 | +docs-staging: ## Deploy to staging repository |
| 85 | + $(info -- Mkdocs Staging Deploy -----------------) |
| 86 | + source ~/.local/venv/bin/activate && mkdocs gh-deploy --force --no-history --config-file mkdocs-staging.yml |
| 87 | +# -------------------------------------- # |
| 88 | + |
| 89 | +# ------- Version Control -------------- # |
| 90 | +git-sr: ## status list of git repos under current directory |
| 91 | + $(info -- Multiple Git Repo Status --------------) |
| 92 | + mgitstatus -e --flatten |
| 93 | + |
| 94 | +git-status: ## status details of git repos under current directory |
| 95 | + $(info -- Multiple Git Status -------------------) |
| 96 | + mgitstatus |
| 97 | +# -------------------------------------- # |
| 98 | + |
| 99 | +# ------------ Help -------------------- # |
66 | 100 | # Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html |
67 | 101 |
|
68 | 102 | help: ## Describe available tasks in Makefile |
69 | 103 | @grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \ |
70 | 104 | sort | \ |
71 | 105 | awk -F ':.*?## ' 'NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}' |
72 | | -# ------------------------------------ # |
| 106 | +# -------------------------------------- # |
| 107 | + |
| 108 | +dist: deps-build ## Build mkdocs website |
0 commit comments