This commit is contained in:
2025-11-13 20:42:43 +01:00
parent 160be767aa
commit 74c9fd82d7
53 changed files with 74 additions and 73 deletions
+13 -12
View File
@@ -5,10 +5,10 @@ PIP := .venv/bin/pip
PYTEST := .venv/bin/pytest
BLACK := .venv/bin/black
RUFF := .venv/bin/ruff
RBOX := .venv/bin/rbox
MYWEBDAV := .venv/bin/mywebdav
all:
$(RBOX) --port 9004
$(MYWEBDAV) --port 9004
help:
@echo "RBox Development Makefile"
@@ -33,6 +33,7 @@ help:
install:
@echo "Installing dependencies..."
python -m venv .venv
$(PIP) install -e .
$(PIP) install -r requirements.txt
@echo "Dependencies installed successfully"
@@ -45,7 +46,7 @@ dev:
run:
@echo "Starting RBox application..."
@echo "Access the application at http://localhost:8000"
$(PYTHON) -m rbox.main
$(PYTHON) -m mywebdav.main
test:
@echo "Running all tests..."
@@ -68,33 +69,33 @@ e2e-setup:
test-coverage:
@echo "Running tests with coverage..."
$(PYTEST) tests/ -v --cov=rbox --cov-report=html --cov-report=term
$(PYTEST) tests/ -v --cov=mywebdav --cov-report=html --cov-report=term
@echo "Coverage report generated in htmlcov/index.html"
lint:
@echo "Running linting checks..."
$(RUFF) check rbox/
$(RUFF) check mywebdav/
@echo "Linting complete"
format:
@echo "Formatting code..."
$(BLACK) rbox/ tests/
$(BLACK) mywebdav/ tests/
@echo "Code formatting complete"
migrate:
@echo "Running database migrations..."
@echo "Tortoise ORM auto-generates schemas on startup"
$(PYTHON) -c "from rbox.main import app; print('Database schema will be created on first run')"
$(PYTHON) -c "from mywebdav.main import app; print('Database schema will be created on first run')"
init-db:
@echo "Initializing database with default data..."
$(PYTHON) -c "import asyncio; \
from tortoise import Tortoise; \
from rbox.settings import settings; \
from rbox.billing.models import PricingConfig; \
from mywebdav.settings import settings; \
from mywebdav.billing.models import PricingConfig; \
from decimal import Decimal; \
async def init(): \
await Tortoise.init(db_url=settings.DATABASE_URL, modules={'models': ['rbox.models', 'rbox.billing.models']}); \
await Tortoise.init(db_url=settings.DATABASE_URL, modules={'models': ['mywebdav.models', 'mywebdav.billing.models']}); \
await Tortoise.generate_schemas(); \
count = await PricingConfig.all().count(); \
if count == 0: \
@@ -114,7 +115,7 @@ init-db:
reset-db:
@echo "WARNING: This will delete all data!"
@read -p "Are you sure? (yes/no): " confirm && [ "$$confirm" = "yes" ] || exit 1
@rm -f rbox.db app/rbox.db storage/rbox.db
@rm -f mywebdav.db app/mywebdav.db storage/mywebdav.db
@echo "Database reset complete. Run 'make init-db' to reinitialize"
clean:
@@ -134,7 +135,7 @@ setup-env:
@echo "Setting up environment file..."
@if [ ! -f .env ]; then \
cp .env.example .env 2>/dev/null || \
echo "DATABASE_URL=sqlite:///app/rbox.db\nSECRET_KEY=$$(openssl rand -hex 32)\nSTRIPE_SECRET_KEY=\nSTRIPE_PUBLISHABLE_KEY=\nSTRIPE_WEBHOOK_SECRET=" > .env; \
echo "DATABASE_URL=sqlite:///app/mywebdav.db\nSECRET_KEY=$$(openssl rand -hex 32)\nSTRIPE_SECRET_KEY=\nSTRIPE_PUBLISHABLE_KEY=\nSTRIPE_WEBHOOK_SECRET=" > .env; \
echo ".env file created. Please update with your configuration."; \
else \
echo ".env file already exists"; \