From eb998cfdbbb0ab85c91c605405fe2b0fd80a993d Mon Sep 17 00:00:00 2001 From: erik Date: Mon, 20 Feb 2023 14:45:15 +0100 Subject: [PATCH] Implement creation of release version --- services.py | 27 ++++++++++++++------------- version.py | 2 +- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/services.py b/services.py index 74cfa99..b4ba72f 100644 --- a/services.py +++ b/services.py @@ -3,7 +3,7 @@ class InitReleaseService(): def __init__(self, commit_id, file): self.commit_id = commit_id self.file = file - self.version_repo = none + self.version_repo = None def __read_commit_message(self): pass @@ -11,23 +11,24 @@ class InitReleaseService(): def __calculate_release_type(self): pass - def get_version(self): + def get_version_repo(self): + self.version_repo = VersionRepository.get(self.file) - version_repo = VersionRepository.get(self.file) - commit_message = self.read_commit_message(self.commit_id) - release_type = self.calculate_release_type(commit_message) - - release_version = create_release_version(version_repo.version_list, release_type) - bump_version = create_bump_version(version_repo.version_list, release_type) - - release_and_bump_version = tuple(release_version, bump_version) - - return release_and_bump_version + def get_version_list(self): + self.get_version_repo() + return self.version_repo.version_list def create_release_version(self): - pass + commit_message = self.read_commit_message(self.commit_id) + release_type = self.calculate_release_type(commit_message) + version_list = self.get_version_list() + + release_version = Version.create_release_version(version_list, release_type) + self.version_repo.write_file(release_version.get_version_string()) + def create_bump_version(self): + bump_version = create_bump_version(version_repo.version_list, release_type) pass diff --git a/version.py b/version.py index 8d1ea87..162e28c 100644 --- a/version.py +++ b/version.py @@ -24,8 +24,8 @@ class Version(): def __init__(self, version_list, release_type): self.version_list = None - self.is_snapshot = None self.version_string = None + self.is_snapshot = None def increment(self, release_type: ReleaseType): self.is_snapshot = False