Spaces:
Sleeping
Sleeping
| #!/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() | |