Files
self-host/setup.py
T

44 lines
1.1 KiB
Python

import subprocess
import sys
BUILDDIR = "services"
BREWERY_URL = "https://github.com/iritmaximus/brewery.git"
PUMPPI_URL = "https://github.com/iritmaximus/pumppistatus.git"
TIMETRIALS_URL = "https://github.com/iritmaximus/timetrials.git"
REAKTOR_BACKEND_URL = "https://github.com/iritmaximus/reaktor-backend.git"
projects = [
BREWERY_URL,
PUMPPI_URL,
TIMETRIALS_URL,
REAKTOR_BACKEND_URL
]
def main():
for project_url in projects:
if sys.argv[1] == "init":
pull_project_from_github(project_url)
if sys.argv[1] == "sync":
update_project(project_url)
else:
print("no.")
def pull_project_from_github(project_url: str):
curr_dir = f"{BUILDDIR}/{str(parse_name_from_url(project_url))}"
subprocess.run(["git", "clone", str(project_url), curr_dir])
subprocess.run(["touch", f"{curr_dir}/.env"])
def update_project(project_url: str):
subprocess.run(["git","-C", str(parse_name_from_url(project_url)), "pull"])
def parse_name_from_url(url: str):
return url.split("/")[-1].split(".")[0]
if __name__ == "__main__":
main()