1- # ------------------------------------------
1+ # -------------------------------------- #
22# Practicalli Makefile
33#
44# Consistent set of targets to support local book development
5- # ------------------------------------------
5+ # -------------------------------------- #
66
7+ # -- Makefile task config -------------- #
78# .PHONY: ensures target used rather than matching file name
89# https://makefiletutorial.com/#phony
9- .PHONY : all clean deps dist docs lint pre-commit-check repl test test-ci test-watch
10+ .PHONY : all clean docs lint pre-commit-check test
1011# -------------------------------------- #
1112
1213# -- Makefile Variables ---------------- #
1314# run help if no target specified
1415.DEFAULT_GOAL := help
15- SHELL := /usr/bin/zsh
16-
1716# Column the target description is printed from
1817HELP-DESCRIPTION-SPACING := 24
1918
19+ SHELL := /usr/bin/zsh
20+
2021# Tool Commands
2122MEGALINTER_RUNNER := npx mega-linter-runner --flavor documentation --env "'MEGALINTER_CONFIG=.github/config/megalinter.yaml'" --env "'VALIDATE_ALL_CODEBASE=true'" --remove-container
2223MKDOCS_SERVER := mkdocs serve --dev-addr localhost:7777
2324OUTDATED_FILE := outdated-$(shell date +% y-% m-% d-% T) .md
24-
25- # Makefile file and directory name wildcard
26- # EDN-FILES := $(wildcard *.edn)
27- # -------------------------------------- #
28-
29- # -- Help ------------------------------ #
30- # Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
31-
32- help : # # Describe available tasks in Makefile
33- @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
34- sort | \
35- awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
3625# -------------------------------------- #
3726
38- # -- Clojure Projects ------------------ #
39- service : # # New project with practicalli/service template
40- $(info -- Create Service Project ----------------)
41- clojure -T:project/create :template practicalli/service :name practicalli/gameboard
42-
43- service-donut : # # New project with practicalli/service template & Donut
44- $(info -- Create Service Project with Donut -----)
45- clojure -T:project/create :template practicalli/service :name practicalli/gameboard :target-dir gameboard-donut
46-
47- service-integrant : # # New project with practicalli/service template & Integrant
48- $(info -- Create Service Project with Integrant -)
49- clojure -T:project/create :template practicalli/service :name practicalli/gameboard :target-dir gameboard-integrant
50-
51- landing-page : # # New project with practicalli/landing-page template local
52- $(info -- Run Rebel REPL ------------------------)
53- clojure -T:project/create :template practicalli/landing-page :name practicalli/landing-page
54-
55- outdated : # # Check deps.edn & GitHub actions for new versions
56- $(info -- Search for outdated libraries ---------)
57- - clojure -T:search/outdated > $(OUTDATED_FILE )
58- # -------------------------------------- #
59-
60- # -- Code Quality ---------------------- #
27+ # -- Quality Checks ------------------ #
6128pre-commit-check : lint
6229
6330lint : # # Run MegaLinter with custom configuration (node.js required)
@@ -75,27 +42,28 @@ lint-clean: ## Clean MegaLinter report information
7542megalinter-upgrade : # # Upgrade MegaLinter config to latest version
7643 $(info -- MegaLinter Upgrade Config -------------)
7744 npx mega-linter-runner@latest --upgrade
78- # -------------------------------------- #
7945
80- # ------- Version Control -------------- #
81- git-sr : # # status list of git repos under current directory
82- $(info -- Multiple Git Repo Status --------------)
83- mgitstatus -e --flatten
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 )
8449
85- git-status : # # status details of git repos under current directory
86- $(info -- Multiple Git Status ---------- ---------)
87- mgitstatus
50+ dependencies-update : # # Update all library dependencies and GitHub action
51+ $(info -- Search for outdated libraries ---------)
52+ - clojure -T:update/dependency-versions > $( OUTDATED_FILE )
8853# -------------------------------------- #
8954
9055# --- Documentation Generation -------- #
91-
92- python-venv :
56+ python-venv : # # Create Python Virtual Environment
9357 $(info -- Create Python Virtual Environment -----)
9458 python3 -m venv ~ /.local/venv
9559
60+ python-activate : # # Activate Python Virtual Environment for MkDocs
61+ $(info -- Mkdocs Local Server -------------------)
62+ source ~ /.local/venv/bin/activate
63+
9664mkdocs-install :
9765 $(info -- Install Material for MkDocs -----------)
98- 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
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
9967
10068docs : # # Build and run mkdocs in local server (python venv)
10169 $(info -- MkDocs Local Server -------------------)
@@ -106,7 +74,35 @@ docs-changed: ## Build only changed files and run mkdocs in local server (pytho
10674 source ~ /.local/venv/bin/activate && $(MKDOCS_SERVER ) --dirtyreload
10775
10876docs-build : # # Build mkdocs (python venv)
109- $(info -- Mkdocs Local Server - ------------------)
77+ $(info -- Mkdocs Build Website ------------------)
11078 source ~ /.local/venv/bin/activate && mkdocs build
79+
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 -------------------- #
100+ # Source: https://nedbatchelder.com/blog/201804/makefile_help_target.html
101+
102+ help : # # Describe available tasks in Makefile
103+ @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | \
104+ sort | \
105+ awk -F ' :.*?## ' ' NF==2 {printf "\033[36m %-$(HELP-DESCRIPTION-SPACING)s\033[0m %s\n", $$1, $$2}'
111106# -------------------------------------- #
112107
108+ dist : deps-build # # Build mkdocs website
0 commit comments