WIP Implement ReleaseLevel
This commit is contained in:
parent
68397ed0e4
commit
fbcd9ee398
2 changed files with 21 additions and 6 deletions
3
build.py
3
build.py
|
@ -21,8 +21,7 @@ def release(project):
|
||||||
# build()
|
# build()
|
||||||
# build.publish()
|
# build.publish()
|
||||||
# build.release_in_git()
|
# build.release_in_git()
|
||||||
# release_in_git()
|
# release_in_git()
|
||||||
|
|
||||||
|
|
||||||
@task
|
@task
|
||||||
def build(project):
|
def build(project):
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import json
|
import json
|
||||||
|
from enum import Enum
|
||||||
|
|
||||||
def init_project():
|
def init_project():
|
||||||
# validate_values()
|
# validate_values()
|
||||||
|
@ -13,22 +14,37 @@ def release_in_git():
|
||||||
|
|
||||||
class Version():
|
class Version():
|
||||||
|
|
||||||
|
class ReleaseLevel(Enum):
|
||||||
|
SNAPSHOT = 0
|
||||||
|
PATCH = 1
|
||||||
|
MINOR = 2
|
||||||
|
MAJOR = 3
|
||||||
|
|
||||||
def __init__(self, config_file_path):
|
def __init__(self, config_file_path):
|
||||||
self.version = "0.0.0"
|
self.version = "0.0.0"
|
||||||
self.config_file_path = config_file_path
|
self.config_file_path = config_file_path
|
||||||
print('init project')
|
print('init project')
|
||||||
|
|
||||||
def parse(self):
|
def parse(self):
|
||||||
if self.config_file_path.split('.').last() == 'json':
|
if self.config_file_path.split('.')[-1] == 'json':
|
||||||
self.__parse_json()
|
self.__parse_json()
|
||||||
|
|
||||||
def __parse_json(self):
|
def __parse_json(self):
|
||||||
with open(self.config_file_path, 'r') as json_file:
|
with open(self.config_file_path, 'r') as json_file:
|
||||||
json_data = json.load(json_file)
|
json_data = json.load(json_file)
|
||||||
print(json_data['version'])
|
self.version = json_data['version']
|
||||||
|
|
||||||
def increment(self, level):
|
def increment(self, level: ReleaseLevel):
|
||||||
pass
|
match level:
|
||||||
|
case ReleaseLevel.SNAPSHOT:
|
||||||
|
if "-SNAPSHOT" not in self.version
|
||||||
|
self.version = self.version + "-SNAPSHOT"
|
||||||
|
case ReleaseLevel.PATCH:
|
||||||
|
pass
|
||||||
|
case ReleaseLevel.MINOR:
|
||||||
|
pass
|
||||||
|
case ReleaseLevel.MAJOR:
|
||||||
|
pass
|
||||||
|
|
||||||
def get():
|
def get():
|
||||||
pass
|
pass
|
Loading…
Reference in a new issue