From 3c2a10ce3cf8d9040c0da59319b1736515d043a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferit=20Yi=C4=9Fit=20BALABAN?= Date: Sat, 11 Feb 2023 00:41:39 +0300 Subject: [PATCH] + partially implement method deploy() --- dotman.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dotman.py b/dotman.py index d010b28..c3163fb 100755 --- a/dotman.py +++ b/dotman.py @@ -2,7 +2,8 @@ # # Ferit Yiğit BALABAN , 2023 # -import os.path +import os +import shlex from subprocess import run import sys from datetime import datetime as dt @@ -196,9 +197,11 @@ def deploy(): Kindly executes the steps to get a up-to-date local repository, deploy (copy) files and directories to the local config directory. """ - # if no local repo - # go to ../local_repo and clone remote_url - # go to local_repo and exec git fetch && git pull + if not os.path.exists(SETTINGS.DIR_REPO): + r = SETTINGS.DIR_REPO + r.removesuffix("/")[:r.removesuffix("/").rindex("/")] + run(shlex.split(f"/usr/bin/git clone {SETTINGS[URL_REPO]}"), text=True, cwd=r) + run(shlex.split("/usr/bin/git pull")) # copy files & directories