updates makefil. deletes unnecessary files

This commit is contained in:
Michael Beck 2025-04-02 21:59:19 +02:00
parent 3a73aaf8aa
commit 039f9190e6
2 changed files with 59 additions and 1 deletions

View File

@ -8,7 +8,65 @@ all: run
clean: clean:
rm -rf venv build dist .pytest_cache .mypy_cache *.egg-info 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: reset-db:
rm -f $(DB_PATH) rm -f $(DB_PATH)

BIN
contents

Binary file not shown.