diff --git a/Makefile b/Makefile index 991d2a6..7d8b2d8 100644 --- a/Makefile +++ b/Makefile @@ -172,14 +172,30 @@ install-precommit: $(GIT_HOOKS) ## Sets up pre-commit hooks $(GIT_HOOKS): .pre-commit-config.yaml $(PRECOMMIT) install -.PHONY: does-path-have-reqs -does-path-have-reqs: ## Check if shell $PATH has expected elements - @echo "$(COLOR_BLUE)Checking PATH elements for evidence of package managers…$(COLOR_RESET)" - @( (echo $${PATH} | grep -q poetry ) && echo "found poetry") || (echo "missing poetry" && false) - @( (echo $${PATH} | grep -q homebrew ) && echo "found homebrew") || (echo "missing homebrew" && false) - @( (echo $${PATH} | grep -q pyenv ) && echo "found pyenv") || (echo "missing pyenv" && false) +.PHONY: deps-reqs-versions +deps-reqs-versions: ## Check if shell $PATH has requirements and show their version + @echo "$(COLOR_BLUE)Checking PATH elements for evidence of required tools. The first in each section is what's used.$(COLOR_RESET)" + @$(MAKE) paths-version-for-cmd CMD=poetry + @$(MAKE) paths-version-for-cmd CMD=pyenv + @$(MAKE) paths-version-for-cmd CMD=brew + @$(MAKE) paths-version-for-cmd CMD=curl + @$(MAKE) paths-version-for-cmd CMD=git + @$(MAKE) paths-version-for-cmd CMD=pre-commit @echo "$(COLOR_GREEN)All expected PATH elements found$(COLOR_RESET)" +CMD_VERSION_FLAG ?= --version +WHICH ?= which +.PHONY: paths-version-for-cmd +paths-version-for-cmd: ## Display version for all executable paths for an executable, set CMD & CMD_VERSION_FLAG + @( if [ -z "$$(which -a $(CMD))" ]; then \ + echo "==> $(COLOR_RED)missing $(CMD)$(COLOR_RESET)"; \ + else \ + echo "==> $(COLOR_ORANGE)$(CMD) $(COLOR_BLUE)commands' versions are:$(COLOR_RESET)"; \ + for pth in $$($(WHICH) -a $(CMD)); do \ + echo "$(COLOR_BLUE)$${pth}$(COLOR_RESET) : $$("$${pth}" $(CMD_VERSION_FLAG))"; \ + done; \ + fi ) + ##@ Dependencies .PHONY: python-current