WIP implement patch

This commit is contained in:
bom 2023-02-08 11:52:15 +01:00
parent 09d08d6e43
commit c1928b8c44

View file

@ -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: