Files
turmlibar-calendar/Makefile
2025-10-30 13:33:08 +01:00

84 lines
2.4 KiB
Makefile

# Makefile for Turmli Bar Calendar Tool
.PHONY: help install run test clean docker-build docker-run docker-stop update dev
# Default target
help:
@echo "Turmli Bar Calendar Tool - Available commands:"
@echo " make install - Install dependencies with uv"
@echo " make run - Run the server locally"
@echo " make dev - Run the server in development mode with reload"
@echo " make test - Run the test suite"
@echo " make clean - Remove cache files and Python artifacts"
@echo " make update - Update all dependencies"
@echo " make docker-build - Build Docker container"
@echo " make docker-run - Run Docker container"
@echo " make docker-stop - Stop Docker container"
# Install dependencies
install:
@echo "Installing dependencies with uv..."
uv sync
# Run the server
run:
@echo "Starting Calendar Server..."
@echo "Access at: http://localhost:8000"
uv run uvicorn main:app --host 0.0.0.0 --port 8000
# Run in development mode with auto-reload
dev:
@echo "Starting Calendar Server in development mode..."
@echo "Access at: http://localhost:8000"
uv run uvicorn main:app --host 0.0.0.0 --port 8000 --reload
# Run tests
test:
@echo "Running test suite..."
@uv run python test_server.py
# Clean cache and temporary files
clean:
@echo "Cleaning cache and temporary files..."
rm -f calendar_cache.json
rm -rf __pycache__
rm -rf .pytest_cache
rm -rf .mypy_cache
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete 2>/dev/null || true
find . -type f -name "*.pyo" -delete 2>/dev/null || true
find . -type f -name "*~" -delete 2>/dev/null || true
@echo "Clean complete!"
# Update dependencies
update:
@echo "Updating dependencies..."
uv sync --upgrade
# Docker commands
docker-build:
@echo "Building Docker image..."
docker build -t turmli-calendar:latest .
docker-run:
@echo "Running Docker container..."
docker-compose up -d
@echo "Container started! Access at: http://localhost:8000"
docker-stop:
@echo "Stopping Docker container..."
docker-compose down
# Check if server is running
check:
@curl -s http://localhost:8000/api/events > /dev/null && \
echo "✓ Server is running" || \
echo "✗ Server is not running"
# Show logs (for Docker)
logs:
docker-compose logs -f
# Refresh calendar manually
refresh:
@echo "Refreshing calendar..."
@curl -X POST http://localhost:8000/api/refresh -s | python3 -m json.tool