From bc3f0f911f46171a8381715653c549bbdc0f3985 Mon Sep 17 00:00:00 2001 From: "Glenn Y. Rolland" Date: Fri, 16 Feb 2024 23:57:43 +0100 Subject: [PATCH] fix: ignore _* files and dirs & manage image subfolders --- Makefile | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/Makefile b/Makefile index 0edbaa2..d825f20 100755 --- a/Makefile +++ b/Makefile @@ -29,12 +29,12 @@ DOCS_PORT=5100 SLIDES_PORT=5200 ## Find .md slides -SLIDES_MDPP=$(shell find $(SLIDES_DIR) \( -name '*.mdpp' ! -name '_*' \)) +SLIDES_MDPP=$(shell find -L $(SLIDES_DIR) -regextype sed \( -name '*.mdpp' ! -regex '.*/_.*' \)) SLIDES_MDPP_MD=$(patsubst $(SLIDES_DIR)/%.mdpp,$(CACHE_SLIDES_DIR)/%.mdpp.md,$(SLIDES_MDPP)) SLIDES_MDPP_MD_PDF=$(patsubst $(CACHE_SLIDES_DIR)/%.mdpp.md,$(BUILD_SLIDES_DIR)/%.pdf,$(SLIDES_MDPP_MD)) SLIDES_MDPP_MD_PPTX=$(patsubst $(CACHE_SLIDES_DIR)/%.mdpp.md,$(BUILD_SLIDES_DIR)/%.pptx,$(SLIDES_MDPP_MD)) -SLIDES_MD=$(shell find $(SLIDES_DIR) \( -name '*.md' ! -name '_*' \)) $(SLIDES_MDPP_MD) +SLIDES_MD=$(shell find -L $(SLIDES_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \)) $(SLIDES_MDPP_MD) SLIDES_MD_PDF=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pdf,$(SLIDES_MD)) SLIDES_MD_PPTX=$(patsubst $(SLIDES_DIR)/%.md,$(BUILD_SLIDES_DIR)/%.pptx,$(SLIDES_MD)) @@ -42,22 +42,22 @@ SLIDES_MD_ALL=$(SLIDES_MDPP_MD) $(SLIDES_MD) $(SLIDES_DIR)/autoslide.md SLIDES_PDF_ALL=$(SLIDES_MDPP_MD_PDF) $(SLIDES_MD_PDF) $(BUILD_SLIDES_DIR)/autoslide.pdf SLIDES_PPTX_ALL=$(SLIDES_MDPP_MD_PPTX) $(SLIDES_MD_PPTX) $(BUILD_SLIDES_DIR)/autoslide.pptx -DOCS_MD=$(shell find $(DOCS_DIR) \( -name '*.md' ! -name '_*' \)) +DOCS_MD=$(shell find -L $(DOCS_DIR) -regextype sed \( -name '*.md' ! -regex '.*/_.*' \)) ## Find .uml graphs -DOCS_IMAGES_UML=$(shell find $(IMAGES_DIR) \( -name '*.uml' ! -name '_*' \)) +DOCS_IMAGES_UML=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.uml' ! -regex '.*/_.*' \)) DOCS_IMAGES_UML_SVG=$(patsubst $(IMAGES_DIR)/%.uml,$(BUILD_IMAGES_DIR)/%.uml.svg,$(DOCS_IMAGES_UML)) ## Find .dot graphs -DOCS_IMAGES_DOT=$(shell find $(IMAGES_DIR) \( -name '*.dot' ! -name '_*' \)) +DOCS_IMAGES_DOT=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.dot' ! -regex '.*/_.*' \)) DOCS_IMAGES_DOT_SVG=$(patsubst $(IMAGES_DIR)/%.dot,$(BUILD_IMAGES_DIR)/%.dot.svg,$(DOCS_IMAGES_DOT)) ## Find .circo graphs -DOCS_IMAGES_CIRCO=$(shell find $(IMAGES_DIR) \( -name '*.circo' ! -name '_*' \)) +DOCS_IMAGES_CIRCO=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.circo' ! -regex '.*/_.*' \)) DOCS_IMAGES_CIRCO_SVG=$(patsubst $(IMAGES_DIR)/%.circo,$(BUILD_IMAGES_DIR)/%.circo.svg,$(DOCS_IMAGES_CIRCO)) ## Find .ora images -DOCS_IMAGES_ORA=$(shell find $(IMAGES_DIR) \( -name '*.ora' ! -name '_*' \)) +DOCS_IMAGES_ORA=$(shell find -L $(IMAGES_DIR) -regextype sed \( -name '*.ora' ! -regex '.*/_.*' \)) DOCS_IMAGES_ORA_PNG=$(patsubst $(IMAGES_DIR)/%.ora,$(BUILD_IMAGES_DIR)/%.ora.png,$(DOCS_IMAGES_ORA)) ## Merge all lists @@ -74,15 +74,11 @@ prepare: prepare-slides prepare-docs ## install prerequisites prepare-slides: ## install prerequisites for PDF slides only npm install + npm rebuild node-sass npx browserslist@latest --update-db prepare-docs: ## install prerequisites for static docs site only pipenv install - # if [ "$(SYSTEM_INSTALL)" -eq 1 ]; then \ - # pipenv install --deploy --system ; \ - #else \ - # pipenv install ; \ - #fi .PHONY: prepare prepare-slides prepare-docs @@ -93,6 +89,9 @@ images: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG) ## build images @echo " dot: $(DOCS_IMAGES_DOT)" @echo " circo: $(DOCS_IMAGES_CIRCO)" @echo "Built: $(DOCS_IMAGES_SVG) $(DOCS_IMAGES_PNG)" + for dir in $$(find -L $(DOCS_DIR) -type d -regextype sed -regex '.*/[0-9][^/]*/images$$') $(DOCS_DIR)/images ; do \ + rsync -av $$dir/ $(SLIDES_DIR)/images/ || exit 1 ; \ + done .PHONY: images @@ -126,17 +125,19 @@ watch: ## run development server autoslide: $(SLIDES_DIR)/autoslide.md | $(BUILD_SLIDES_DIR) $(SLIDES_DIR)/autoslide.md: $(DOCS_MD) - find $(DOCS_DIR) -regextype sed -regex '.*/[0-9][^/]*\.md' -print0 \ + find -L $(DOCS_DIR) -regextype sed \( -regex '.*/[0-9][^/]*\.md' ! -regex '.*/_.*' \) -print0 \ | sort -z |xargs -0 cat \ > $(SLIDES_DIR)/autoslide.md watch-autoslide-internal: + # FIXME: use watchexec instead while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \ sleep 0.25 ; \ $(MAKE) autoslide ; \ done watch-tocupdate-internal: + # FIXME: use watchexec instead while inotifywait -q -e move -e modify -e create -e attrib -e delete -e moved_to -r $(DOCS_DIR) ; do \ sleep 2 ; \ $(MAKE) images ; \ @@ -148,6 +149,7 @@ watch-docs-internal: watch-slides-internal: .marp/theme.css PORT=$(SLIDES_PORT) \ npx marp \ + --allow-local-files \ --engine $$(pwd)/.marp/engine.js \ --html \ --theme $$(pwd)/.marp/theme.css \ @@ -229,7 +231,7 @@ build-docs-pdf: ## build pdf docs only pipenv run mkdocs build \ --site-dir $(BUILD_DOCS_DIR) pdftk \ - $$(find $(BUILD_DOCS_DIR) -name *.pdf -not -name index.pdf |sort ) \ + $$(find -L $(BUILD_DOCS_DIR) -name *.pdf -not -name index.pdf |sort ) \ cat output $(BUILD_DOCS_DIR)/docs.pdf build-docs-html: ## build static docs site only @@ -282,14 +284,14 @@ fixme: docker-build: ## build docker image docker build \ --file docker/Dockerfile \ - --tag glenux/teaching-boilerplate:$(BUILD_VERSION) \ + --tag glenux/docmachine:$(BUILD_VERSION) \ . docker tag \ - glenux/teaching-boilerplate:$(BUILD_VERSION) \ - glenux/teaching-boilerplate:latest + glenux/docmachine:$(BUILD_VERSION) \ + glenux/docmachine:latest docker-push: ## push docker image - env docker push glenux/teaching-boilerplate:latest + env docker push glenux/docmachine:latest docker-pull: ## download docker image - env docker pull glenux/teaching-boilerplate:latest + env docker pull glenux/docmachine:latest