Spaces:
Sleeping
Sleeping
File size: 3,208 Bytes
12d64f8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
#!/usr/bin/env python3
"""
Display project structure and file information
"""
import os
from pathlib import Path
def get_file_size(file_path):
"""Get file size in human readable format"""
size = os.path.getsize(file_path)
for unit in ['B', 'KB', 'MB', 'GB']:
if size < 1024.0:
return f"{size:.1f}{unit}"
size /= 1024.0
return f"{size:.1f}TB"
def count_lines(file_path):
"""Count lines in a file"""
try:
with open(file_path, 'r', encoding='utf-8') as f:
return len(f.readlines())
except:
return 0
def main():
print("๐ฎ RTS Commander - Project Structure")
print("=" * 60)
print()
web_dir = Path(__file__).parent
files_info = {
'Core Application': [
'app.py',
'requirements.txt',
],
'Frontend': [
'static/index.html',
'static/styles.css',
'static/game.js',
],
'Docker & Deployment': [
'Dockerfile',
'.dockerignore',
],
'Documentation': [
'README.md',
'ARCHITECTURE.md',
'MIGRATION.md',
'DEPLOYMENT.md',
'QUICKSTART.md',
'PROJECT_SUMMARY.md',
],
'Scripts': [
'start.py',
'test.sh',
'project_info.py',
]
}
total_lines = 0
total_size = 0
for category, files in files_info.items():
print(f"\n๐ {category}")
print("-" * 60)
for file in files:
file_path = web_dir / file
if file_path.exists():
size = os.path.getsize(file_path)
lines = count_lines(file_path)
total_lines += lines
total_size += size
print(f" โ
{file:30s} {get_file_size(file_path):>8s} {lines:>6d} lines")
else:
print(f" โ {file:30s} NOT FOUND")
print()
print("=" * 60)
print(f"๐ Total Statistics")
print(f" Total files: {sum(len(f) for f in files_info.values())}")
print(f" Total lines: {total_lines:,}")
print(f" Total size: {total_size / 1024:.1f} KB")
print()
# Check dependencies
print("=" * 60)
print("๐ Checking Dependencies")
print("-" * 60)
try:
import fastapi
print(f" โ
FastAPI {fastapi.__version__}")
except ImportError:
print(f" โ FastAPI not installed")
try:
import uvicorn
print(f" โ
Uvicorn {uvicorn.__version__}")
except ImportError:
print(f" โ Uvicorn not installed")
try:
import websockets
print(f" โ
WebSockets {websockets.__version__}")
except ImportError:
print(f" โ WebSockets not installed")
print()
print("=" * 60)
print("โจ Project is ready for deployment!")
print()
print("๐ Next steps:")
print(" 1. Test locally: python3 start.py")
print(" 2. Build Docker: docker build -t rts-game .")
print(" 3. Deploy to HuggingFace Spaces")
print()
if __name__ == "__main__":
main()
|