diff --git a/Makefile b/Makefile index b09e46a..53453ac 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,65 @@ all: run clean: rm -rf venv build dist .pytest_cache .mypy_cache *.egg-info -DB_PATH=scipaperloader/papers.db +DB_PATH=scipaperloader/papers# Backup the database +backup-db: + @mkdir -p backups + @timestamp=$$(date +%Y%m%d_%H%M%S); \ + cp $(DB_PATH) backups/papers_$$timestamp.db && \ + echo "Database backed up to backups/papers_$$timestamp.db" + +# Create sample test data +sample-data: venv + $(PYTHON) scipaperloader/scripts/create_sample_data.py + +# Export database as SQL +export-db: venv + @mkdir -p exports + @timestamp=$$(date +%Y%m%d_%H%M%S); \ + $(PYTHON) -c "import sqlite3; conn = sqlite3.connect('$(DB_PATH)'); with open('exports/papers_$$timestamp.sql', 'w') as f: f.write(''.join(conn.iterdump()));" && \ + echo "Database exported to exports/papers_$$timestamp.sql" # Run with production settings + run-prod: venv + FLASK_ENV=production venv/bin/flask --app scipaperloader run --host=0.0.0.0 + +# Check for security vulnerabilities +security-check: venv +$(PIP) install safety +venv/bin/safety check + +# Run specific migration commands +db-migrate: venv + venv/bin/flask --app scipaperloader db migrate -m "$(message)" + +db-upgrade: venv + venv/bin/flask --app scipaperloader db upgrade + +db-downgrade: venv + venv/bin/flask --app scipaperloader db downgrade # Generate API documentation using sphinx + +docs: venv + $(PIP) install sphinx sphinx_rtd_theme + cd docs && venv/bin/sphinx-build -b html source build + +# Create a code coverage report +coverage: venv + $(PYTHON) -m pytest --cov=scipaperloader --cov-report=html + @echo "Coverage report generated in htmlcov/" + +# Generate a requirements.txt file +requirements: venv + $(PIP) freeze > requirements.txt + @echo "Requirements file updated" # Show project stats + stats: + @echo "Lines of Python code:" + @find scipaperloader -name "*.py" | xargs wc -l | sort -nr + @echo "Number of routes:" + @grep -r "@bp.route" scipaperloader | wc -l + @echo "Database file size:" + @du -h $(DB_PATH) 2>/dev/null || echo "Database file not found" + + # Show TODOs in code + todos: + @grep -r "TODO\|FIXME" scipaperloader || echo "No TODOs found".db reset-db: rm -f $(DB_PATH) diff --git a/contents b/contents deleted file mode 100644 index a1e7c8e..0000000 Binary files a/contents and /dev/null differ