1
- # ------------------------------------------
1
+ # -------------------------------------- #
2
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
+ # -- Makefile Variables ---------------- #
10
12
11
- # ------- Makefile Variables --------- #
13
+ # -- Makefile Variables ------- --------- #
12
14
# run help if no target specified
13
15
.DEFAULT_GOAL := help
14
16
SHELL := /usr/bin/zsh
15
17
16
18
# Column the target description is printed from
17
19
HELP-DESCRIPTION-SPACING := 24
18
20
19
- # Tool Commands
20
- MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" -- remove-container
21
+ # Tool variables
22
+ MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --remove-container
21
23
MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
24
+ OUTDATED_FILE := outdated-$(shell date +% y-% m-% d-% T) .md
25
+ # -------------------------------------- #
26
+
27
+ # -- Help ------------------------------ #
28
+ # Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
29
+
30
+ help : # # Describe available tasks in Makefile
31
+ @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
32
+ sort | \
33
+ awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
34
+ # -------------------------------------- #
22
35
23
- # Makefile file and directory name wildcard
24
- EDN-FILES := $(wildcard * .edn)
25
- # ------------------------------------ #
26
36
27
- # ------ Quality Checks ------------ #
37
+ # ------ Quality Checks -------------- #
28
38
pre-commit-check : lint
29
39
30
40
lint : # # Run MegaLinter with custom configuration (node.js required)
@@ -42,31 +52,50 @@ lint-clean: ## Clean MegaLinter report information
42
52
megalinter-upgrade : # # Upgrade MegaLinter config to latest version
43
53
$(info --------- MegaLinter Upgrade Config ---------)
44
54
npx mega-linter-runner@latest --upgrade
45
- # ------------------------------------ #
46
55
47
- # --- Documentation Generation ------ #
48
- python-venv : # # Enable Python Virtual Environment for MkDocs
49
- $(info --------- Mkdocs Local Server ---------)
56
+ dependencies-outdated : # # Report new versions of library dependencies and GitHub action
57
+ $(info -- Search for outdated libraries ---------)
58
+ - clojure -T:search/outdated > $(OUTDATED_FILE )
59
+
60
+ dependencies-update : # # Update all library dependencies and GitHub action
61
+ $(info -- Search for outdated libraries ---------)
62
+ - clojure -T:update/dependency-versions > $(OUTDATED_FILE )
63
+ # -------------------------------------- #
64
+
65
+ # ------- Version Control -------------- #
66
+ git-sr : # # status list of git repos under current directory
67
+ $(info -- Multiple Git Repo Status --------------)
68
+ mgitstatus -e --flatten
69
+
70
+ git-status : # # status details of git repos under current directory
71
+ $(info -- Multiple Git Status -------------------)
72
+ mgitstatus
73
+ # -------------------------------------- #
74
+
75
+ # --- Documentation Generation -------- #
76
+
77
+ python-venv : # # Create Python Virtual Environment
78
+ $(info -- Create Python Virtual Environment -----)
79
+ python3 -m venv ~ /.local/venv
80
+
81
+ python-venv-activate : # # Active Python Virtual Environment
82
+ $(info -- Mkdocs Local Server -------------------)
50
83
source ~ /.local/venv/bin/activate
51
84
85
+ mkdocs-install :
86
+ $(info -- Install Material for MkDocs -----------)
87
+ 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
88
+
52
89
docs : # # Build and run mkdocs in local server (python venv)
53
- $(info --------- Mkdocs Local Server ---------)
90
+ $(info -- MkDocs Local Server ---------- ---------)
54
91
source ~ /.local/venv/bin/activate && $(MKDOCS_SERVER )
55
92
56
93
docs-changed : # # Build only changed files and run mkdocs in local server (python venv)
57
- $(info --------- Mkdocs Local Server ---------)
94
+ $(info -- Mkdocs Local Server ---------- ---------)
58
95
source ~ /.local/venv/bin/activate && $(MKDOCS_SERVER ) --dirtyreload
59
96
60
97
docs-build : # # Build mkdocs (python venv)
61
- $(info --------- Mkdocs Local Server ---------)
98
+ $(info -- Mkdocs Local Server ---------- ---------)
62
99
source ~ /.local/venv/bin/activate && mkdocs build
63
- # ------------------------------------ #
64
-
65
- # ------------ Help ------------------ #
66
- # Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
100
+ # -------------------------------------- #
67
101
68
- help : # # Describe available tasks in Makefile
69
- @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
70
- sort | \
71
- awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
72
- # ------------------------------------ #
0 commit comments