43 lines
1.2 KiB
Python
43 lines
1.2 KiB
Python
from version_repository import VersionRepository
|
|
from release_type import ReleaseType
|
|
|
|
class InitReleaseService():
|
|
|
|
def __init__(self, commit_id, file):
|
|
self.commit_id = commit_id
|
|
self.file = file
|
|
self.version_repo = None
|
|
|
|
def __read_commit_message(self):
|
|
pass
|
|
|
|
def __calculate_release_type(self):
|
|
pass
|
|
|
|
def get_version(self, release_type):
|
|
self.version_repo = VersionRepository(self.file)
|
|
return self.version_repo.get_version(release_type)
|
|
|
|
def create_release_version(self):
|
|
commit_message = self.read_commit_message(self.commit_id)
|
|
release_type = self.calculate_release_type(commit_message)
|
|
version = self.get_version(release_type).create_release_version()
|
|
|
|
self.version_repo.write_file(version.get_version_string())
|
|
|
|
def create_bump_version(self):
|
|
if self.version_repo == None:
|
|
raise Exception('VersionRepo was not created. Did you run create_lease_version()?')
|
|
version = self.get_version(ReleaseType.BUMP).create_bump_version()
|
|
|
|
self.version_repo.write_file(version.get_version_string())
|
|
|
|
|
|
|
|
|
|
class PrepareReleaseService():
|
|
pass
|
|
|
|
class TagAndPushReleaseService():
|
|
pass
|
|
|