You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
3.6 KiB
Python
104 lines
3.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Validation script for Know Foolery project setup
|
|
Checks all files and configurations are in place
|
|
"""
|
|
|
|
import os
|
|
from pathlib import Path
|
|
|
|
def check_file_exists(filepath, description=""):
|
|
"""Check if a file exists and report status"""
|
|
if Path(filepath).exists():
|
|
print(f"✓ {description or filepath}")
|
|
return True
|
|
else:
|
|
print(f"❌ {description or filepath} - MISSING")
|
|
return False
|
|
|
|
def validate_setup():
|
|
"""Validate the complete project setup"""
|
|
print("🔍 Validating Know Foolery Project Setup...")
|
|
print("=" * 50)
|
|
|
|
issues = []
|
|
|
|
# Root files
|
|
print("\n📁 Root Configuration Files:")
|
|
root_files = [
|
|
("docker-compose.yml", "Docker Compose configuration"),
|
|
(".env", "Environment variables"),
|
|
("README.md", "Project documentation"),
|
|
("Makefile", "Development commands"),
|
|
("nginx.conf", "Nginx configuration"),
|
|
]
|
|
|
|
for filepath, desc in root_files:
|
|
if not check_file_exists(filepath, desc):
|
|
issues.append(f"Missing {desc}")
|
|
|
|
# Frontend files
|
|
print("\n🎨 Frontend Files:")
|
|
frontend_files = [
|
|
("frontend/package.json", "Frontend package configuration"),
|
|
("frontend/vite.config.ts", "Vite configuration"),
|
|
("frontend/tsconfig.json", "TypeScript configuration"),
|
|
("frontend/src/App.tsx", "Main React component"),
|
|
("frontend/src/main.tsx", "React entry point"),
|
|
("frontend/Dockerfile", "Frontend Docker configuration"),
|
|
]
|
|
|
|
for filepath, desc in frontend_files:
|
|
if not check_file_exists(filepath, desc):
|
|
issues.append(f"Missing {desc}")
|
|
|
|
# Backend services
|
|
print("\n🐍 Backend Services:")
|
|
services = ["api-gateway", "game-service", "question-service", "player-service", "admin-service"]
|
|
|
|
for service in services:
|
|
service_path = f"backend/services/{service}"
|
|
service_files = [
|
|
(f"{service_path}/app/main.py", f"{service} main application"),
|
|
(f"{service_path}/requirements.txt", f"{service} dependencies"),
|
|
(f"{service_path}/Dockerfile", f"{service} Docker config"),
|
|
]
|
|
|
|
for filepath, desc in service_files:
|
|
if not check_file_exists(filepath, desc):
|
|
issues.append(f"Missing {desc}")
|
|
|
|
# Shared backend files
|
|
print("\n🔧 Shared Backend Components:")
|
|
shared_files = [
|
|
("backend/shared/database/models.py", "Database models"),
|
|
("backend/shared/database/connection.py", "Database connection"),
|
|
("backend/shared/database/startup.py", "Database startup script"),
|
|
("backend/shared/auth/jwt_handler.py", "JWT authentication"),
|
|
("backend/shared/utils/scoring.py", "Scoring engine"),
|
|
("backend/database/schema.sql", "Database schema"),
|
|
("backend/database/seeds/sample_data.sql", "Sample data"),
|
|
]
|
|
|
|
for filepath, desc in shared_files:
|
|
if not check_file_exists(filepath, desc):
|
|
issues.append(f"Missing {desc}")
|
|
|
|
# Summary
|
|
print("\n" + "=" * 50)
|
|
if issues:
|
|
print(f"❌ Setup validation FAILED with {len(issues)} issues:")
|
|
for issue in issues:
|
|
print(f" • {issue}")
|
|
return False
|
|
else:
|
|
print("✅ Setup validation PASSED - All files in place!")
|
|
print("\n🚀 Ready to run:")
|
|
print(" make setup # Full setup with Docker")
|
|
print(" make up # Start services")
|
|
print(" make init-db # Initialize database")
|
|
return True
|
|
|
|
if __name__ == "__main__":
|
|
success = validate_setup()
|
|
exit(0 if success else 1) |