From 7ed84ab0bf6fda5fe4f2b7e6513393d613518d8a Mon Sep 17 00:00:00 2001 From: Brett Laptop Date: Thu, 7 Mar 2024 11:54:09 -0500 Subject: [PATCH] finished commit script? --- CMakeLists.txt | 2 +- commit.py | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f777403..f173b76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.5) include(cmake/color.cmake) -set(BLT_VERSION 0.13.12) +set(BLT_VERSION 0.14.0) set(BLT_TEST_VERSION 0.0.1) set(BLT_TARGET BLT) diff --git a/commit.py b/commit.py index 2893b33..ed6bead 100755 --- a/commit.py +++ b/commit.py @@ -13,8 +13,6 @@ VERSION_END_STR = ")" # DO NOT TOUCH #--------------------------------------- -type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") - def load_cmake(): cmake_file = open("CMakeLists.txt", 'r') cmake_text = cmake_file.read() @@ -46,11 +44,14 @@ def recombine(cmake_text, version_parts, begin, end): def inc_major(cmake_text): version_parts, begin, end = split_version(cmake_text) version_parts[0] = str(int(version_parts[0]) + 1) + version_parts[1] = '0' + version_parts[2] = '0' return recombine(cmake_text, version_parts, begin, end) def inc_minor(cmake_text): version_parts, begin, end = split_version(cmake_text) version_parts[1] = str(int(version_parts[1]) + 1) + version_parts[2] = '0' return recombine(cmake_text, version_parts, begin, end) def inc_patch(cmake_text): @@ -58,17 +59,21 @@ def inc_patch(cmake_text): version_parts[2] = str(int(version_parts[2]) + 1) return recombine(cmake_text, version_parts, begin, end) +cmake_text = load_cmake() +cmake_version = get_version(cmake_text)[0] +print(f"Current Version: {cmake_version}") +type = input("What kind of commit is this ((M)ajor, (m)inor, (p)atch)? ") + if type.startswith('M'): print("Selected major") - write_cmake(inc_major(load_cmake())) + write_cmake(inc_major(cmake_text)) elif type.startswith('m'): print("Selected minor") - write_cmake(inc_minor(load_cmake())) + write_cmake(inc_minor(cmake_text)) elif type.startswith('p') or type.startswith('P') or len(type) == 0: print("Selected patch") - write_cmake(inc_patch(load_cmake())) + write_cmake(inc_patch(cmake_text)) -#subprocess.call("./py_commit_helper.sh") subprocess.call(["git", "add", "*"]) subprocess.call(["git", "commit"]) subprocess.call(["sh", "-c", "git remote | xargs -L1 git push --all"])