option_type 0.1.0

Option contract type definitions including exotic options: Asian, Barrier, Binary, Lookback, Rainbow, and more.
Documentation
# =============================================================================
# Makefile for option_type
# Option contract type definitions including exotic options
# =============================================================================

# Detect current branch
CURRENT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD)

# Project name for packaging
PROJECT_NAME := option_type

# =============================================================================
# Default target
# =============================================================================
.PHONY: all
all: fmt lint test build

# =============================================================================
# ๐Ÿ”ง Build & Run
# =============================================================================

.PHONY: build
build:
	@echo "๐Ÿ”จ Building debug version..."
	cargo build

.PHONY: release
release:
	@echo "๐Ÿš€ Building release version..."
	cargo build --release

.PHONY: clean
clean:
	@echo "๐Ÿงน Cleaning build artifacts..."
	cargo clean

# =============================================================================
# ๐Ÿงช Test & Quality
# =============================================================================

.PHONY: test
test:
	@echo "๐Ÿงช Running all tests..."
	RUST_LOG=warn cargo test --all-features

.PHONY: test-lib
test-lib:
	@echo "๐Ÿงช Running library tests..."
	RUST_LOG=warn cargo test --lib

.PHONY: test-doc
test-doc:
	@echo "๐Ÿงช Running documentation tests..."
	cargo test --doc

.PHONY: fmt
fmt:
	@echo "โœจ Formatting code..."
	cargo +stable fmt --all

.PHONY: fmt-check
fmt-check:
	@echo "๐Ÿ” Checking code formatting..."
	cargo +stable fmt --all --check

.PHONY: lint
lint:
	@echo "๐Ÿ” Running clippy lints..."
	cargo clippy --all-targets --all-features -- -D warnings

.PHONY: lint-fix
lint-fix:
	@echo "๐Ÿ”ง Auto-fixing lint issues..."
	cargo clippy --fix --all-targets --all-features --allow-dirty --allow-staged -- -D warnings

.PHONY: fix
fix:
	@echo "๐Ÿ”ง Applying cargo fix suggestions..."
	cargo fix --allow-staged --allow-dirty

.PHONY: check
check: fmt-check lint test
	@echo "โœ… All checks passed!"

.PHONY: pre-push
pre-push: fix fmt lint-fix test doc
	@echo "โœ… All pre-push checks passed!"

# =============================================================================
# ๐Ÿ“ฆ Packaging & Docs
# =============================================================================

.PHONY: doc
doc:
	@echo "๐Ÿ“š Generating documentation..."
	cargo doc --no-deps --document-private-items

.PHONY: doc-open
doc-open:
	@echo "๐Ÿ“š Opening documentation in browser..."
	cargo doc --no-deps --open

.PHONY: publish
publish:
	@echo "๐Ÿ“ฆ Publishing to crates.io..."
	cargo publish --dry-run
	@echo "Dry run complete. Run 'cargo publish' to actually publish."

# =============================================================================
# ๐Ÿ“ˆ Coverage
# =============================================================================

.PHONY: coverage
coverage:
	@echo "๐Ÿ“Š Generating code coverage report (XML)..."
	@command -v cargo-tarpaulin > /dev/null || cargo install cargo-tarpaulin
	@mkdir -p coverage
	RUST_LOG=warn cargo tarpaulin --verbose --all-features --timeout 120 --out Xml --output-dir coverage

# =============================================================================
# ๐Ÿš€ Release
# =============================================================================

.PHONY: version
version:
	@echo "๐Ÿ“‹ Current version:"
	@grep '^version' Cargo.toml | head -1

.PHONY: tag
tag:
	@echo "๐Ÿท๏ธ  Creating git tag..."
	@version=$$(grep '^version' Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/'); \
	git tag -a "v$$version" -m "Release v$$version"; \
	echo "Created tag v$$version"