From c1928b8c440671ec02c02e459b7529c879113eb8 Mon Sep 17 00:00:00 2001 From: bom Date: Wed, 8 Feb 2023 11:52:15 +0100 Subject: [PATCH] WIP implement patch --- devops_test.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/devops_test.py b/devops_test.py index 9ac7180..a0aa37f 100644 --- a/devops_test.py +++ b/devops_test.py @@ -5,7 +5,7 @@ def init_project(): # validate_values() version = Version('package.json') version.parse() - version.increment(ReleaseLevel.SNAPSHOT) + version.increment(ReleaseLevel.PATCH) print(version.get()) def prepare_release(): @@ -15,17 +15,17 @@ def release_in_git(): pass class ReleaseLevel(Enum): - SNAPSHOT = 0 - PATCH = 1 - MINOR = 2 - MAJOR = 3 + MAJOR = 0 + MINOR = 1 + PATCH = 2 + SNAPSHOT = 3 + class Version(): def __init__(self, config_file_path): self.version = "0.0.0" self.config_file_path = config_file_path - print('init project') def parse(self): if self.config_file_path.split('.')[-1] == 'json': @@ -42,7 +42,10 @@ class Version(): if "-SNAPSHOT" not in self.version: self.version = self.version + "-SNAPSHOT" case ReleaseLevel.PATCH: - pass + split_version = self.version.split('.') + patch_version = int(split_version[ReleaseLevel.PATCH.value]) + self.version = split_version[:ReleaseLevel.PATCH.value] + str(patch_version + 1) + print(self.version) case ReleaseLevel.MINOR: pass case ReleaseLevel.MAJOR: