aboutsummaryrefslogtreecommitdiffstats
path: root/make_repo.py
diff options
context:
space:
mode:
authorjwansek <eddie.atten.ea29@gmail.com>2022-09-19 19:08:29 +0100
committerjwansek <eddie.atten.ea29@gmail.com>2022-09-19 19:08:29 +0100
commit135f7ec31ccc691b626d465a70fcac97baa895f7 (patch)
treeb6783700415dda7c8f551e75b9e4a169365a4db0 /make_repo.py
parentcfa6e98a33e89291b19376e9e1ab25510afdfb7d (diff)
downloadgit-scripts-135f7ec31ccc691b626d465a70fcac97baa895f7.tar.gz
git-scripts-135f7ec31ccc691b626d465a70fcac97baa895f7.zip
Added automatically restarting the web ui when a new repo is created
Diffstat (limited to 'make_repo.py')
-rwxr-xr-xmake_repo.py15
1 files changed, 12 insertions, 3 deletions
diff --git a/make_repo.py b/make_repo.py
index 6d8f3eb..0e2c9d1 100755
--- a/make_repo.py
+++ b/make_repo.py
@@ -27,7 +27,7 @@ if not os.path.exists(conf_path):
CONFIG = configparser.ConfigParser()
CONFIG.read(conf_path)
-repo_name = urllib.parse.quote_plus(input("Input repository name: "))
+repo_name = input("Input repository name: ").replace(" ", "_")
if not repo_name.endswith(".git"):
repo_name += ".git"
repo_dir = os.path.join(CONFIG.get("git", "repo_path"), repo_name)
@@ -92,7 +92,7 @@ if input("Would you like the repository to remain bare? Useful for making mirror
print("")
selected_index = int(input("\nSelect .gitignore template: "))
- if selected_index != 0:
+ if selected_index != 1:
shutil.copy(os.path.join(gitignore_templates_dir, templates[selected_index - 1]) + ".gitignore", ".gitignore", follow_symlinks = True)
licenses_templates_dir = CONFIG.get("git", "license_templates")
@@ -104,7 +104,7 @@ if input("Would you like the repository to remain bare? Useful for making mirror
print("")
selected_index = int(input("\nSelect license template: "))
- if selected_index != 0:
+ if selected_index != 1:
with open(os.path.join(licenses_templates_dir, templates[selected_index - 1]) + ".txt", "r") as f:
jinja_template = jinja2.Template(f.read())
@@ -119,6 +119,15 @@ if input("Would you like the repository to remain bare? Useful for making mirror
subprocess.run(["git", "commit", "-m", "Initialized repository"])
subprocess.run(["git", "push", "origin", "master"])
+# could do this with the docker API instead maybe
+proc = subprocess.Popen(CONFIG.get("git", "restart_ui_cmd").split(), stdout = subprocess.PIPE)
+while True:
+ line = proc.stdout.readline()
+ if not line:
+ break
+ print(line.decode())
+
+
print("""
Repository created. You can now clone or add remote:
git remote add other %s