108 lines
3.1 KiB
Makefile
108 lines
3.1 KiB
Makefile
.PHONY: help install run restart test test-xml test-html uninstall backup \
|
|
generate-env export-env make-messages compile-messages \
|
|
format check typecheck precommit clear
|
|
|
|
# Detect OS and set script paths
|
|
ifeq ($(OS),Windows_NT)
|
|
SCRIPT_DIR := scripts/Windows
|
|
SCRIPT_EXT := .ps1
|
|
RUN_SCRIPT = pwsh -ExecutionPolicy Bypass -File ./$(SCRIPT_DIR)/$(1)$(SCRIPT_EXT)
|
|
CLEAR_CMD := cls
|
|
else
|
|
SCRIPT_DIR := scripts/Unix
|
|
SCRIPT_EXT := .sh
|
|
RUN_SCRIPT = bash ./$(SCRIPT_DIR)/$(1)$(SCRIPT_EXT)
|
|
CLEAR_CMD := clear
|
|
endif
|
|
|
|
clear:
|
|
@$(CLEAR_CMD)
|
|
|
|
help: clear
|
|
@echo "Schon Project Management"
|
|
@echo ""
|
|
@echo "Usage: make [target]"
|
|
@echo ""
|
|
@echo "Targets:"
|
|
@echo " install Pull and build Docker images"
|
|
@echo " run Start all services"
|
|
@echo " restart Restart all services"
|
|
@echo " test Run tests with coverage"
|
|
@echo " test-xml Generate XML coverage report"
|
|
@echo " test-html Generate HTML coverage report"
|
|
@echo " uninstall Remove containers, volumes, and generated files"
|
|
@echo " backup Create a backup"
|
|
@echo " generate-env Generate .env file from template"
|
|
@echo " export-env Export environment variables"
|
|
@echo " make-messages Extract translation strings"
|
|
@echo " compile-messages Compile translation files"
|
|
@echo " format Format code with ruff"
|
|
@echo " check Lint code with ruff"
|
|
@echo " typecheck Typecheck code with ty"
|
|
@echo " precommit Run format, check, and typecheck"
|
|
@echo ""
|
|
@echo "Detected OS: $(if $(filter Windows_NT,$(OS)),Windows,Unix)"
|
|
@echo "Scripts directory: $(SCRIPT_DIR)"
|
|
|
|
install: clear
|
|
@$(call RUN_SCRIPT,install)
|
|
|
|
run: clear
|
|
@$(call RUN_SCRIPT,run)
|
|
|
|
restart: clear
|
|
@$(call RUN_SCRIPT,restart)
|
|
|
|
test: clear
|
|
@$(call RUN_SCRIPT,test)
|
|
|
|
test-xml: clear
|
|
ifeq ($(OS),Windows_NT)
|
|
@pwsh -ExecutionPolicy Bypass -File ./$(SCRIPT_DIR)/test$(SCRIPT_EXT) -r xml
|
|
else
|
|
@bash ./$(SCRIPT_DIR)/test$(SCRIPT_EXT) --report xml
|
|
endif
|
|
|
|
test-html: clear
|
|
ifeq ($(OS),Windows_NT)
|
|
@pwsh -ExecutionPolicy Bypass -File ./$(SCRIPT_DIR)/test$(SCRIPT_EXT) -r html
|
|
else
|
|
@bash ./$(SCRIPT_DIR)/test$(SCRIPT_EXT) --report html
|
|
endif
|
|
|
|
uninstall: clear
|
|
@echo "This will remove all Docker containers, volumes, and generated files."
|
|
ifeq ($(OS),Windows_NT)
|
|
@pwsh -Command "$$confirm = Read-Host 'Continue? [y/N]'; if ($$confirm -eq 'y') { pwsh -ExecutionPolicy Bypass -File ./$(SCRIPT_DIR)/uninstall$(SCRIPT_EXT) } else { Write-Host 'Uninstall cancelled.' }"
|
|
else
|
|
@read -p "Continue? [y/N] " confirm && [ "$$confirm" = "y" ] && bash ./$(SCRIPT_DIR)/uninstall$(SCRIPT_EXT) || echo "Uninstall cancelled."
|
|
endif
|
|
|
|
backup: clear
|
|
@$(call RUN_SCRIPT,backup)
|
|
|
|
generate-env: clear
|
|
@$(call RUN_SCRIPT,generate-environment-file)
|
|
|
|
export-env: clear
|
|
@$(call RUN_SCRIPT,export-environment-file)
|
|
|
|
make-messages: clear
|
|
@$(call RUN_SCRIPT,make-messages)
|
|
|
|
compile-messages: clear
|
|
@$(call RUN_SCRIPT,compile-messages)
|
|
|
|
format: clear
|
|
@ruff format
|
|
|
|
check: clear
|
|
@ruff check
|
|
|
|
typecheck: clear
|
|
@ty check
|
|
|
|
precommit: clear
|
|
@ruff format
|
|
@ruff check
|
|
@ty check
|