prole/installer/workstation.py
chrisfu 1f4b394e94 installer: split monolith into installer/* modules, update entry install.py to use them; remove nested prole/* references and prefer top-level proleStatus build
- Add root-level installer package: config, build, workstation, deploy
- Update install.py to import from installer.*
- Ensure build/deploy use top-level proleStatus only (no prole/proleStatus)
- Keep UI/behavior intact (wizard pages, embedded console)

This commit contains only files required to run ./install.py and the new installer/* modules.
2025-12-01 14:25:43 -08:00

27 lines
963 B
Python

"""
Workstation (Vagrant) build helpers for the Prole installer (root-level).
Select an environment-specific Vagrantfile when present and compose the
`vagrant up` command. UI remains elsewhere.
"""
from __future__ import annotations
from pathlib import Path
def select_vagrantfile(project_root: Path, env: str | None) -> Path:
env_key = (env or "Dev").strip().lower()
mapping = {"dev": "Vagrantfile.dev", "service": "Vagrantfile.service", "prod": "Vagrantfile.prod"}
ws = Path(project_root) / "workstation"
candidate = mapping.get(env_key)
if candidate and (ws / candidate).exists():
return ws / candidate
return ws / "Vagrantfile"
def get_vagrant_up_command(project_root: Path, env: str | None) -> str:
vf = select_vagrantfile(project_root, env)
ws = Path(project_root) / "workstation"
env_label = (env or "Dev").strip().title()
return f"cd \"{ws}\" && VAGRANT_VAGRANTFILE=\"{vf}\" vagrant up # {env_label}"