feat: init commit
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Web Adventure - Quick Verification Script
|
||||
Checks that all components are properly set up
|
||||
"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
def check_file_exists(path, description):
|
||||
if path.exists():
|
||||
size = path.stat().st_size
|
||||
print(f"✅ {description}: {path.name} ({size:,} bytes)")
|
||||
return True
|
||||
else:
|
||||
print(f"❌ {description}: {path.name} NOT FOUND")
|
||||
return False
|
||||
|
||||
def check_imports():
|
||||
"""Check that all required Python packages are installed"""
|
||||
packages = {
|
||||
'fastapi': 'FastAPI',
|
||||
'uvicorn': 'Uvicorn',
|
||||
'websockets': 'WebSockets',
|
||||
'pydantic': 'Pydantic',
|
||||
}
|
||||
|
||||
all_ok = True
|
||||
for module_name, display_name in packages.items():
|
||||
try:
|
||||
__import__(module_name)
|
||||
print(f"✅ {display_name} installed")
|
||||
except ImportError:
|
||||
print(f"❌ {display_name} NOT installed")
|
||||
all_ok = False
|
||||
|
||||
return all_ok
|
||||
|
||||
def verify_python_syntax(filepath):
|
||||
"""Verify Python file has valid syntax"""
|
||||
try:
|
||||
with open(filepath, 'r') as f:
|
||||
compile(f.read(), filepath, 'exec')
|
||||
return True
|
||||
except SyntaxError as e:
|
||||
print(f" Syntax error: {e}")
|
||||
return False
|
||||
|
||||
def main():
|
||||
print("\n" + "="*60)
|
||||
print("🔍 WEB ADVENTURE - Verification Script")
|
||||
print("="*60 + "\n")
|
||||
|
||||
script_dir = Path(__file__).parent.resolve()
|
||||
os.chdir(script_dir)
|
||||
|
||||
all_checks = []
|
||||
|
||||
# Check files
|
||||
print("📁 Checking files...")
|
||||
all_checks.append(check_file_exists(script_dir / "backend.py", "Backend"))
|
||||
all_checks.append(check_file_exists(script_dir / "index.html", "Frontend"))
|
||||
all_checks.append(check_file_exists(script_dir / "requirements.txt", "Dependencies"))
|
||||
all_checks.append(check_file_exists(script_dir / "launcher.py", "Launcher"))
|
||||
all_checks.append(check_file_exists(script_dir / "README.md", "Readme"))
|
||||
all_checks.append(check_file_exists(script_dir / "SETUP.md", "Setup Guide"))
|
||||
all_checks.append(check_file_exists(script_dir / "PROJECT_SUMMARY.md", "Project Summary"))
|
||||
|
||||
print("\n📦 Checking Python packages...")
|
||||
all_checks.append(check_imports())
|
||||
|
||||
print("\n🐍 Checking Python syntax...")
|
||||
for pyfile in [script_dir / "backend.py", script_dir / "launcher.py"]:
|
||||
print(f" Checking {pyfile.name}...", end=" ")
|
||||
if verify_python_syntax(pyfile):
|
||||
print("✅")
|
||||
all_checks.append(True)
|
||||
else:
|
||||
print("❌")
|
||||
all_checks.append(False)
|
||||
|
||||
print("\n" + "="*60)
|
||||
if all(all_checks):
|
||||
print("✅ All checks passed! Ready to play!")
|
||||
print("\nTo start the game, run:")
|
||||
print(" python launcher.py")
|
||||
print("\n" + "="*60 + "\n")
|
||||
return 0
|
||||
else:
|
||||
print("❌ Some checks failed. Please review above.")
|
||||
print("\n" + "="*60 + "\n")
|
||||
return 1
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
Reference in New Issue
Block a user