rust-rule-engine 0.9.0

A high-performance rule engine for Rust with plugin system, built-in utilities, GRL support, and advanced pattern matching
Documentation
# Makefile for rust-rule-engine crate
# =================================

.PHONY: help build test clean check format lint docs examples publish-dry publish-real release setup git-commit

# Default target
help:
	@echo "๐Ÿš€ Rust Rule Engine - Makefile Commands"
	@echo "======================================="
	@echo ""
	@echo "๐Ÿ“ฆ Build & Test:"
	@echo "  make build      - Build the project"
	@echo "  make test       - Run all tests"
	@echo "  make examples   - Run all examples"
	@echo "  make check      - Run cargo check"
	@echo ""
	@echo "๐Ÿ”ง Code Quality:"
	@echo "  make format     - Format code with rustfmt"
	@echo "  make lint       - Run clippy lints"
	@echo "  make docs       - Generate documentation"
	@echo ""
	@echo "๐Ÿ“‹ Git & Publishing:"
	@echo "  make git-commit - Add all files and commit"
	@echo "  make publish-dry - Dry run publish (test only)"
	@echo "  make publish - Publish to crates.io"
	@echo "  make release     - Full release process"
	@echo ""
	@echo "๐Ÿงน Cleanup:"
	@echo "  make clean      - Clean build artifacts"
	@echo ""

# Build the project
build:
	@echo "๐Ÿ”จ Building rust-rule-engine..."
	cargo build

# Build in release mode
build-release:
	@echo "๐Ÿ”จ Building rust-rule-engine (release)..."
	cargo build --release

# Run tests
test:
	@echo "๐Ÿงช Running tests..."
	cargo test

# Run benchmarks
bench:
	@echo "โšก Running benchmarks..."
	cargo bench

# Run benchmarks with baseline
bench-baseline:
	@echo "โšก Running benchmarks with baseline..."
	cargo bench -- --save-baseline main

# Compare benchmarks
bench-compare:
	@echo "โšก Comparing benchmarks..."
	cargo bench -- --baseline main

# Open benchmark report
bench-report:
	@echo "๐Ÿ“Š Opening benchmark report..."
	@if [ -f target/criterion/index.html ]; then \
		echo "๐ŸŒ Opening benchmark report in browser..."; \
		xdg-open target/criterion/index.html 2>/dev/null || open target/criterion/index.html 2>/dev/null || echo "Please open target/criterion/index.html manually"; \
	else \
		echo "โŒ No benchmark report found. Run 'make bench' first."; \
	fi

# Run all examples
examples:
	@echo "๐ŸŽฏ Running all examples..."
	@echo "================================"
	@for example in ecommerce fraud_detection grule_demo method_calls_demo rule_file_functions_demo custom_functions_demo; do \
		echo ""; \
		echo "๐Ÿš€ Running example: $$example"; \
		echo "----------------------------"; \
		cargo run --example $$example || true; \
		echo ""; \
	done

# Check the project
check:
	@echo "โœ… Checking project..."
	cargo check

# Format code
format:
	@echo "๐ŸŽจ Formatting code..."
	cargo fmt

# Run clippy lints
lint:
	@echo "๐Ÿ” Running clippy lints..."
	cargo clippy -- -D warnings

# Generate documentation
docs:
	@echo "๐Ÿ“š Generating documentation..."
	cargo doc --open

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

# Git operations
git-status:
	@echo "๐Ÿ“‹ Git status:"
	git status --short

git-add:
	@echo "โž• Adding all files to git..."
	git add .

git-commit: git-add
	@echo "๐Ÿ’พ Committing changes..."
	@read -p "Enter commit message: " msg; \
	git commit -m "$$msg"

# Pre-publish checks
pre-publish: format lint test
	@echo "๐Ÿ” Pre-publish checks completed successfully!"

# Dry run publish (test only)
publish-dry: pre-publish
	@echo "๐Ÿงช Dry run publish to crates.io..."
	@echo "โš ๏ธ  This will test the publish process without actually publishing"
	@echo ""
	@echo "๐Ÿ“‹ Package info:"
	@grep "^name\|^version\|^description" Cargo.toml
	@echo ""
	@echo "๐Ÿ“ Files to be included:"
	@cargo package --list | head -20
	@echo ""
	@read -p "Continue with dry run? (y/N): " confirm; \
	if [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ]; then \
		cargo publish --dry-run --allow-dirty; \
	else \
		echo "โŒ Dry run cancelled"; \
	fi

# Real publish to crates.io
publish: pre-publish git-status
	@echo "๐Ÿš€ Publishing to crates.io..."
	@echo "โš ๏ธ  This will ACTUALLY publish the crate!"
	@echo ""
	@echo "๐Ÿ“‹ Package info:"
	@grep "^name\|^version\|^description" Cargo.toml
	@echo ""
	@echo "๐Ÿ” Git status:"
	@git status --short
	@echo ""
	@if [ -n "$$(git status --porcelain)" ]; then \
		echo "โš ๏ธ  Warning: You have uncommitted changes!"; \
		echo "Run 'make git-commit' first or use --allow-dirty"; \
		echo ""; \
		read -p "Publish with uncommitted changes? (y/N): " dirty; \
		if [ "$$dirty" = "y" ] || [ "$$dirty" = "Y" ]; then \
			echo "Publishing with --allow-dirty..."; \
			cargo publish --allow-dirty; \
		else \
			echo "โŒ Publish cancelled. Commit your changes first."; \
			exit 1; \
		fi; \
	else \
		read -p "Continue with publish? (y/N): " confirm; \
		if [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ]; then \
			cargo publish; \
		else \
			echo "โŒ Publish cancelled"; \
		fi; \
	fi

# Full release process
release: 
	@echo "๐ŸŽ‰ Starting full release process..."
	@echo "=================================="
	@echo ""
	@echo "This will:"
	@echo "1. ๐ŸŽจ Format code"
	@echo "2. ๐Ÿ” Run lints"
	@echo "3. ๐Ÿงช Run tests"
	@echo "4. ๐ŸŽฏ Run examples"
	@echo "5. ๐Ÿ’พ Commit changes (if needed)"
	@echo "6. ๐Ÿš€ Publish to crates.io"
	@echo ""
	@read -p "Continue with full release? (y/N): " confirm; \
	if [ "$$confirm" = "y" ] || [ "$$confirm" = "Y" ]; then \
		$(MAKE) format; \
		$(MAKE) lint; \
		$(MAKE) test; \
		$(MAKE) examples; \
		if [ -n "$$(git status --porcelain)" ]; then \
			echo ""; \
			echo "๐Ÿ’พ Changes detected, committing..."; \
			$(MAKE) git-commit; \
		fi; \
		echo ""; \
		echo "๐Ÿš€ Ready to publish!"; \
		$(MAKE) publish-real; \
	else \
		echo "โŒ Release cancelled"; \
	fi

# Setup development environment
setup:
	@echo "๐Ÿ”ง Setting up development environment..."
	@echo "Installing required tools..."
	rustup component add rustfmt clippy
	@echo "โœ… Setup complete!"

# Version bump helpers
version-patch:
	@echo "๐Ÿ“ˆ Bumping patch version..."
	@current=$$(grep "^version" Cargo.toml | cut -d'"' -f2); \
	echo "Current version: $$current"; \
	read -p "Enter new patch version (e.g., 0.1.1): " new_version; \
	sed -i 's/^version = ".*"/version = "'$$new_version'"/' Cargo.toml; \
	echo "โœ… Version updated to $$new_version"

version-minor:
	@echo "๐Ÿ“ˆ Bumping minor version..."
	@current=$$(grep "^version" Cargo.toml | cut -d'"' -f2); \
	echo "Current version: $$current"; \
	read -p "Enter new minor version (e.g., 0.2.0): " new_version; \
	sed -i 's/^version = ".*"/version = "'$$new_version'"/' Cargo.toml; \
	echo "โœ… Version updated to $$new_version"

version-major:
	@echo "๐Ÿ“ˆ Bumping major version..."
	@current=$$(grep "^version" Cargo.toml | cut -d'"' -f2); \
	echo "Current version: $$current"; \
	read -p "Enter new major version (e.g., 1.0.0): " new_version; \
	sed -i 's/^version = ".*"/version = "'$$new_version'"/' Cargo.toml; \
	echo "โœ… Version updated to $$new_version"

# Package information
package-info:
	@echo "๐Ÿ“ฆ Package Information"
	@echo "====================="
	@echo ""
	@echo "๐Ÿ“‹ Basic Info:"
	@grep "^name\|^version\|^description\|^authors" Cargo.toml
	@echo ""
	@echo "๐Ÿ“ Files to be packaged:"
	@cargo package --list 2>/dev/null | head -20 || echo "Run 'cargo check' first"
	@echo ""
	@echo "๐Ÿ“Š Package size:"
	@cargo package --list 2>/dev/null | wc -l || echo "Run 'cargo check' first" 
	@echo " files total"

# All quality checks
qa: format lint test
	@echo "โœ… All quality assurance checks passed!"