.PHONY: all
all: precommit
.PHONY: format
format:
cargo fmt
.PHONY: lint
lint:
cargo fmt -- --check && \
cargo clippy --all-features -- -D warnings -W clippy::unwrap_used -W clippy::expect_used -W missing_docs && \
cargo clippy --tests -- -D warnings -W clippy::unwrap_used
.PHONY: build
build:
cargo build --verbose
.PHONY: clean
clean:
cargo clean
.PHONY: clean-build
clean-build: clean build
.PHONY: docs
docs:
RUSTDOCFLAGS="-D warnings" cargo doc
.PHONY: precommit
precommit: clean-build lint test build-examples
.PHONY: test-unit
test-unit:
cargo test --lib
.PHONY: test-doctests
test-doctests:
cargo test --doc
.PHONY: ci-test-setup
ci-test-setup:
cargo run --example test-setup
.PHONY: test-integration
test-integration:
cargo test --tests
.PHONY: ci-test-teardown
ci-test-teardown:
cargo run --example test-teardown
.PHONY: test
test: test-unit test-integration test-doctests
.PHONY: build-examples
build-examples:
cd example/rust && make lint && make build
.PHONY: run-examples
run-examples:
cd example/rust \
&& make lint \
&& cargo run --bin=readme \
&& cargo run --bin=cache \
&& cargo run --bin=topics \
&& cargo run --bin=docs_examples \
&& cargo run --bin=cheat_sheet_client_instantiation
.PHONY: help
help:
@echo "$$(tput bold)Available rules:$$(tput sgr0)";echo;sed -ne"/^## /{h;s/.*//;:d" -e"H;n;s/^## //;td" -e"s/:.*//;G;s/\\n## /---/;s/\\n/ /g;p;}" ${MAKEFILE_LIST}|LC_ALL='C' sort -f|awk -F --- -v n=$$(tput cols) -v i=19 -v a="$$(tput setaf 6)" -v z="$$(tput sgr0)" '{printf"%s%*s%s ",a,-i,$$1,z;m=split($$2,w," ");l=n-i;for(j=1;j<=m;j++){l-=length(w[j])+1;if(l<= 0){l=n-i-length(w[j])-1;printf"\n%*s ",-i," ";}printf"%s ",w[j];}printf"\n";}'|more $(shell test $(shell uname) == Darwin && echo '-Xr')
.PHONY: publish
publish:
cargo publish