Implement json Versioning POC
This commit is contained in:
parent
eb6f5eb568
commit
8a3e77aadf
2 changed files with 6 additions and 4 deletions
|
@ -6,6 +6,7 @@ def init_project():
|
||||||
version = Version('package.json')
|
version = Version('package.json')
|
||||||
version.parse()
|
version.parse()
|
||||||
version.increment(ReleaseLevel.MAJOR)
|
version.increment(ReleaseLevel.MAJOR)
|
||||||
|
version.write()
|
||||||
print(version.get())
|
print(version.get())
|
||||||
|
|
||||||
def prepare_release():
|
def prepare_release():
|
||||||
|
@ -19,7 +20,6 @@ class ReleaseLevel(Enum):
|
||||||
MINOR = 1
|
MINOR = 1
|
||||||
PATCH = 2
|
PATCH = 2
|
||||||
SNAPSHOT = 3
|
SNAPSHOT = 3
|
||||||
|
|
||||||
|
|
||||||
class Version():
|
class Version():
|
||||||
|
|
||||||
|
@ -63,10 +63,12 @@ class Version():
|
||||||
self.__write_json()
|
self.__write_json()
|
||||||
|
|
||||||
def __write_json(self):
|
def __write_json(self):
|
||||||
with open(self.config_file_path, 'wr') 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)
|
||||||
json_data['version'] = self.get()
|
json_data['version'] = self.get()
|
||||||
json.dump(json_data, json_file)
|
json_file.seek(0)
|
||||||
|
json.dump(json_data, json_file, indent=4)
|
||||||
|
json_file.truncate()
|
||||||
|
|
||||||
def get(self) -> str:
|
def get(self) -> str:
|
||||||
version_string = ".".join([str(x) for x in self.version])
|
version_string = ".".join([str(x) for x in self.version])
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"name": "dummy",
|
"name": "dummy",
|
||||||
"description": "Generate c4k yaml for a jitsi deployment.",
|
"description": "Generate c4k yaml for a jitsi deployment.",
|
||||||
"author": "meissa GmbH",
|
"author": "meissa GmbH",
|
||||||
"version": "1.3.2-SNAPSHOT",
|
"version": "3.0.0",
|
||||||
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-jitsi#readme",
|
"homepage": "https://gitlab.com/domaindrivenarchitecture/c4k-jitsi#readme",
|
||||||
"repository": "https://www.npmjs.com/package/c4k-jitsi",
|
"repository": "https://www.npmjs.com/package/c4k-jitsi",
|
||||||
"license": "APACHE2",
|
"license": "APACHE2",
|
||||||
|
|
Loading…
Reference in a new issue