fix_readme.py 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. import os
  2. file_path = "README.md"
  3. if os.path.exists(file_path):
  4. with open(file_path, "r", encoding="utf-8", errors="replace") as f:
  5. content = f.read()
  6. # Clean encoding issue
  7. content = content.replace("Lange FranA ois", "Francois Lange")
  8. content = content.replace("Lange FranAois", "Francois Lange")
  9. content = content.replace("Lange François", "Francois Lange")
  10. old_doc_part = """## Documentation (Capstone Deliverables)
  11. Please refer to the `docs/` folder for detailed guides:
  12. - [Architecture Map](docs/architecture.md)"""
  13. new_doc_part = """## Documentation (Capstone Deliverables)
  14. Please refer to the `docs/` folder for detailed guides:
  15. - [Detailed WSL Installation Guide (PDF)](docs/Installation_Guide.pdf) | [Markdown Version](docs/Installation_Guide.md)
  16. - [Architecture Map](docs/architecture.md)"""
  17. content = content.replace(old_doc_part, new_doc_part)
  18. quick_start = """
  19. ## Quick Start & WSL Installation
  20. This project is fully optimized to run on Windows Subsystem for Linux (WSL2) with Ubuntu 22.04 LTS.
  21. 1. **WSL Setup (Windows Host)**:
  22. Open an Administrator PowerShell window at the root of the repository and run:
  23. ```powershell
  24. powershell.exe -ExecutionPolicy Bypass -File setup_wsl.ps1
  25. ```
  26. *This enables WSL2 features and spins up a dedicated Ubuntu 22.04 LTS instance named `Dopro1` with user `lanfr144`.*
  27. 2. **Branch Checkout & App Setup (WSL Environment)**:
  28. Navigate to the repository home directory inside WSL:
  29. ```bash
  30. cd ~
  31. git clone https://git.btshub.lu/lanfr/LocalFoodAI_lanfr144.git
  32. cd LocalFoodAI_lanfr144
  33. # Always ensure you are on the primary main branch:
  34. git checkout main
  35. # Launch the installation script to set up Docker, configurations, and permissions:
  36. ./setup_app.sh
  37. ```
  38. 3. **Run services**:
  39. Configure database and app variables in a `.env` file at the root directory, then run:
  40. ```bash
  41. ./manage_services.sh start
  42. ```
  43. For detailed step-by-step instructions, please consult the [Installation Guide PDF](docs/Installation_Guide.pdf).
  44. """
  45. # Add quick start before Tech Stack
  46. content = content.replace("## Tech Stack", quick_start + "\n## Tech Stack")
  47. with open(file_path, "w", encoding="utf-8") as f:
  48. f.write(content)
  49. print("README.md successfully updated.")