mirror of
https://github.com/iritmaximus/self-host.git
synced 2026-10-12 19:23:31 +03:00
46 lines
1.2 KiB
Python
46 lines
1.2 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"
|
|
BORT_URL="https://github.com/iritmaximus/bort.git"
|
|
|
|
|
|
projects = [
|
|
BREWERY_URL,
|
|
PUMPPI_URL,
|
|
TIMETRIALS_URL,
|
|
REAKTOR_BACKEND_URL,
|
|
BORT_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", "services/" + 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()
|