2025-07-08 21:39:40 -07:00
|
|
|
RED := \033[0;31m
|
|
|
|
|
GREEN := \033[0;32m
|
|
|
|
|
YELLOW := \033[0;33m
|
|
|
|
|
BLUE := \033[0;34m
|
|
|
|
|
MAGENTA := \033[0;35m
|
|
|
|
|
CYAN := \033[0;36m
|
|
|
|
|
WHITE := \033[0;37m
|
|
|
|
|
BOLD := \033[1m
|
|
|
|
|
RESET := \033[0m
|
|
|
|
|
|
2023-12-12 22:13:10 -08:00
|
|
|
.PHONY: default
|
|
|
|
|
default:
|
2025-07-08 21:39:40 -07:00
|
|
|
@echo "$(RED)Please specify a target to run, e.g., 'make live' for live deployment.$(RESET)"
|
2023-12-12 22:13:10 -08:00
|
|
|
|
2023-12-13 01:03:47 -08:00
|
|
|
# Define a common rule to check if ALMANACK_ROOT is set
|
|
|
|
|
.PHONY: check-activated
|
|
|
|
|
check-activated:
|
2023-12-12 22:13:10 -08:00
|
|
|
ifndef ALMANACK_ROOT
|
2023-12-13 01:03:47 -08:00
|
|
|
$(error ALMANACK_ROOT is undefined. Please run `source bin/a-activate` before running any targets.)
|
2023-12-12 22:13:10 -08:00
|
|
|
endif
|
2023-12-13 01:03:47 -08:00
|
|
|
|
|
|
|
|
# Define the 'live' target which will be triggered on 'make live'
|
2024-01-06 03:15:45 -08:00
|
|
|
RSYNC_OPTS := -avz --delete --delete-after --filter='dir-merge,-n /.gitignore' -e "a-ssh"
|
2025-07-08 21:39:40 -07:00
|
|
|
DESTINATIONS := boat:/var/local/www/www.almnck.com/ dallas:/var/local/www/www.almnck.com/ sj:/var/local/www/www.almnck.com/
|
|
|
|
|
|
2023-12-13 01:03:47 -08:00
|
|
|
.PHONY: live
|
|
|
|
|
live: check-activated
|
2025-07-08 21:39:40 -07:00
|
|
|
@test -d "$(ALMANACK_ROOT)/web" || (echo "ERROR: web directory not found" && exit 1)
|
|
|
|
|
@echo "Dry run preview:"
|
|
|
|
|
@$(foreach dest,$(DESTINATIONS),echo "$(BLUE)To $(dest)$(RESET)"; rsync $(RSYNC_OPTS) --dry-run $(ALMANACK_ROOT)/web/ $(dest);)
|
|
|
|
|
@read -p "Continue with deployment? (y/N): " confirm && [ "$$confirm" = "y" ]
|
|
|
|
|
@$(foreach dest,$(DESTINATIONS),echo "$(BLUE)To $(dest)$(RESET)"; rsync $(RSYNC_OPTS) $(ALMANACK_ROOT)/web/ $(dest);)
|
2023-12-13 00:10:12 -08:00
|
|
|
|
|
|
|
|
.PHONY: test-doc
|
2023-12-13 01:03:47 -08:00
|
|
|
test-doc: check-activated
|
2023-12-13 00:10:12 -08:00
|
|
|
@echo Running doc-check-links
|
|
|
|
|
@sh $(ALMANACK_ROOT)/src/tests/doc-check-links | tapview
|
|
|
|
|
|