BLUE := \033[36m
BOLD := \033[1m
RESET := \033[0m
.DEFAULT_GOAL := ci
.PHONY: ci fmt clippy test snapshots update-snapshots publish-check release clean help
ci: fmt clippy test snapshots publish-check
fmt:
@printf "$(BLUE)fmt$(RESET)\n"
@cargo fmt --all -- --check
clippy:
@printf "$(BLUE)clippy$(RESET)\n"
@cargo clippy --all-targets --all-features -- -D warnings
test:
@printf "$(BLUE)test$(RESET)\n"
@cargo test --all-features
@cargo test --no-default-features
@cargo doc --no-deps --all-features
snapshots:
@printf "$(BLUE)snapshots$(RESET)\n"
@cargo build --release 2>/dev/null
@cd example && ../target/release/jemdoc-rs -c mysite.conf *.jemdoc
@git diff --exit-code -- example/*.html || { \
echo ""; \
echo "Example HTML is out of date. Run: make update-snapshots"; \
exit 1; \
}
update-snapshots:
@printf "$(BLUE)update-snapshots$(RESET)\n"
@cargo build --release 2>/dev/null
@cd example && ../target/release/jemdoc-rs -c mysite.conf *.jemdoc
@printf "$(BLUE)Snapshots updated. Stage with: git add example/*.html$(RESET)\n"
release:
@VERSION=$$(grep '^version' Cargo.toml | head -1 | sed 's/.*= *"\(.*\)"/\1/'); \
TAG="v$$VERSION"; \
printf "$(BLUE)Tagging $$TAG$(RESET)\n"; \
git tag -a "$$TAG" -m "$$TAG" && git push --tags
publish-check:
@printf "$(BLUE)publish-check$(RESET)\n"
@cargo publish --dry-run
clean:
@cargo clean
help:
@printf "$(BOLD)Usage:$(RESET)\n"
@printf " make $(BLUE)<target>$(RESET)\n\n"
@printf "$(BOLD)Targets:$(RESET)\n"
@awk 'BEGIN {FS = ":.*##"} /^[a-zA-Z_-]+:.*?##/ { printf " $(BLUE)%-20s$(RESET) %s\n", $$1, $$2 }' $(MAKEFILE_LIST)