diff --git a/Makefile b/Makefile new file mode 100644 index 00000000..941d7b6f --- /dev/null +++ b/Makefile @@ -0,0 +1,136 @@ +# MarkiTect - Advanced Markdown Engine +# Makefile for common development tasks + +.PHONY: help setup install test build clean update status dev lint format check-deps + +# Default target +help: + @echo "MarkiTect Development Commands" + @echo "==============================" + @echo "" + @echo "Setup & Installation:" + @echo " setup - Initial project setup (venv + install)" + @echo " install - Install package in development mode" + @echo " dev - Install with development dependencies" + @echo "" + @echo "Development:" + @echo " test - Run all tests" + @echo " build - Build the package" + @echo " lint - Run code linting" + @echo " format - Format code" + @echo "" + @echo "Maintenance:" + @echo " update - Update from upstream (git + submodules)" + @echo " status - Show git status for repo and submodules" + @echo " clean - Clean build artifacts" + @echo " check-deps - Check dependency status" + +# Python and virtual environment setup +PYTHON := python3 +VENV := .venv +VENV_PYTHON := $(VENV)/bin/python +VENV_PIP := $(VENV)/bin/pip + +# Setup virtual environment and install package +setup: $(VENV)/bin/activate install + @echo "โœ… Project setup complete!" + +$(VENV)/bin/activate: + @echo "๐Ÿ”ง Creating virtual environment..." + $(PYTHON) -m venv $(VENV) + $(VENV_PIP) install --upgrade pip setuptools wheel + +# Install package in development mode +install: $(VENV)/bin/activate + @echo "๐Ÿ“ฆ Installing MarkiTect in development mode..." + $(VENV_PIP) install -e . + +# Install with development dependencies +dev: install + @echo "๐Ÿ› ๏ธ Installing development dependencies..." + $(VENV_PIP) install pytest pytest-cov black flake8 mypy + +# Run tests +test: $(VENV)/bin/activate + @echo "๐Ÿงช Running tests..." + @if [ -f $(VENV)/bin/pytest ]; then \ + $(VENV)/bin/pytest tests/ -v; \ + else \ + $(VENV_PYTHON) -m pytest tests/ -v 2>/dev/null || \ + $(VENV_PYTHON) -m unittest discover tests/ -v; \ + fi + +# Build the package +build: $(VENV)/bin/activate + @echo "๐Ÿ—๏ธ Building package..." + $(VENV_PYTHON) -m build 2>/dev/null || \ + $(VENV_PIP) install build && $(VENV_PYTHON) -m build + +# Code linting +lint: $(VENV)/bin/activate + @echo "๐Ÿ” Running linting..." + @if [ -f $(VENV)/bin/flake8 ]; then \ + $(VENV)/bin/flake8 markitect/ tests/; \ + else \ + echo "โš ๏ธ flake8 not installed. Run 'make dev' first."; \ + fi + +# Code formatting +format: $(VENV)/bin/activate + @echo "โœจ Formatting code..." + @if [ -f $(VENV)/bin/black ]; then \ + $(VENV)/bin/black markitect/ tests/; \ + else \ + echo "โš ๏ธ black not installed. Run 'make dev' first."; \ + fi + +# Update from upstream +update: + @echo "๐Ÿ”„ Updating from upstream..." + @git status --porcelain | grep -q . && echo "โš ๏ธ Working directory not clean. Commit or stash changes first." && exit 1 || true + git pull origin main + git submodule update --remote + @if git status --porcelain | grep -q "wiki"; then \ + echo "๐Ÿ“ Committing wiki submodule update..."; \ + git add wiki; \ + git commit -m "Update wiki submodule to latest"; \ + fi + @echo "โœ… Update complete!" + +# Show git status +status: + @echo "๐Ÿ“Š Repository Status" + @echo "===================" + @echo "" + @echo "Main Repository:" + git status --short + @echo "" + @echo "Wiki Submodule:" + @cd wiki && git status --short + @echo "" + @echo "Recent Commits:" + git log --oneline -5 + +# Clean build artifacts +clean: + @echo "๐Ÿงน Cleaning build artifacts..." + rm -rf build/ + rm -rf dist/ + rm -rf *.egg-info/ + find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true + find . -name "*.pyc" -delete 2>/dev/null || true + @echo "โœ… Clean complete!" + +# Check dependency status +check-deps: $(VENV)/bin/activate + @echo "๐Ÿ“‹ Dependency Status" + @echo "===================" + @echo "" + @echo "Python version:" + $(VENV_PYTHON) --version + @echo "" + @echo "Installed packages:" + $(VENV_PIP) list + @echo "" + @echo "Project dependencies:" + $(VENV_PIP) check \ No newline at end of file