rts-commander / project_info.py
Luigi's picture
deploy(web): full clean snapshot with app code and assets
12d64f8
raw
history blame
3.21 kB
#!/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()