.PHONY: generate build test clean help
OPENAPI_SPEC_URL ?= http://localhost:8080/openapi.json
help:
@echo "Refyne Rust SDK"
@echo ""
@echo "Usage: make [target]"
@echo ""
@echo "Targets:"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " %-15s %s\n", $$1, $$2}'
@echo ""
@echo "Environment variables:"
@echo " OPENAPI_SPEC_URL URL to fetch OpenAPI spec (default: $(OPENAPI_SPEC_URL))"
@echo " OPENAPI_SPEC_FILE Path to local OpenAPI spec file"
generate:
@echo "Generating types from OpenAPI spec..."
python3 scripts/generate.py --url "$(OPENAPI_SPEC_URL)"
@echo "Done. Running cargo check..."
cargo check
generate-file:
@if [ -z "$(OPENAPI_SPEC_FILE)" ]; then \
echo "Error: OPENAPI_SPEC_FILE is not set"; \
echo "Usage: make generate-file OPENAPI_SPEC_FILE=path/to/openapi.json"; \
exit 1; \
fi
@echo "Generating types from $(OPENAPI_SPEC_FILE)..."
python3 scripts/generate.py --file "$(OPENAPI_SPEC_FILE)"
@echo "Done. Running cargo check..."
cargo check
generate-prod:
@echo "Generating types from production API..."
python3 scripts/generate.py --url "https://api.refyne.uk/openapi.json"
@echo "Done. Running cargo check..."
cargo check
build:
cargo build
test:
cargo test
check:
cargo check
clippy:
cargo clippy -- -D warnings
fmt:
cargo fmt
fmt-check:
cargo fmt -- --check
clean:
cargo clean
doc:
cargo doc --no-deps --open
all: fmt clippy test build