diff --git a/latest.json b/latest.json deleted file mode 100644 index eca7270..0000000 --- a/latest.json +++ /dev/null @@ -1 +0,0 @@ -{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718449299, "file": "realweather-0.9-SNAPSHOT.jar"} \ No newline at end of file diff --git a/latest/latest-v1.json b/latest/latest-v1.json new file mode 100644 index 0000000..31d6220 --- /dev/null +++ b/latest/latest-v1.json @@ -0,0 +1 @@ +{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718539114, "file": "realweather-0.9-SNAPSHOT.jar"} \ No newline at end of file diff --git a/release.py b/release.py index 5143a72..a3352c5 100755 --- a/release.py +++ b/release.py @@ -3,13 +3,17 @@ import json, os, time from typing import Tuple +meta_file_name = 'meta-v1.json' +latest_file_name = 'latest-v1.json' +latest_file_path = os.path.join('latest', latest_file_name) + def confirm(prompt: str) -> bool: confirmed = input(prompt + ' (Y/N) ') return confirmed.lower() == 'y' def load_latest_data() -> dict: - if os.path.isfile('latest.json'): - return json.loads(open('latest.json').read()) + if os.path.isfile(latest_file_path): + return json.loads(open(latest_file_path).read()) return {'id': 0} def match_name(filename: str, extension: str=None, exact_name: str=None): @@ -55,7 +59,7 @@ def wait_for_file(waiting_dir: str, extension: str=None, exact_name: str=None) - def write_metadata(metadata: dict): dir = metadata['label'] metadata = json.dumps(metadata) - for filepath in [os.path.join('releases', dir, 'meta.json'), 'latest.json']: + for filepath in [os.path.join('releases', dir, meta_file_name), latest_file_path]: file = open(filepath, 'w') file.write(metadata) file.close() diff --git a/releases/0.9-alpha.1/meta-v1.json b/releases/0.9-alpha.1/meta-v1.json new file mode 100644 index 0000000..31d6220 --- /dev/null +++ b/releases/0.9-alpha.1/meta-v1.json @@ -0,0 +1 @@ +{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718539114, "file": "realweather-0.9-SNAPSHOT.jar"} \ No newline at end of file diff --git a/releases/0.9-alpha.1/meta.json b/releases/0.9-alpha.1/meta.json deleted file mode 100644 index eca7270..0000000 --- a/releases/0.9-alpha.1/meta.json +++ /dev/null @@ -1 +0,0 @@ -{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718449299, "file": "realweather-0.9-SNAPSHOT.jar"} \ No newline at end of file diff --git a/reset.py b/reset.py index c126f5b..c07b2e1 100755 --- a/reset.py +++ b/reset.py @@ -4,12 +4,13 @@ from shutil import rmtree from os import remove, mkdir confirmation = input('If you really want to delete all releases, type CONFIRM: ') + if confirmation != 'CONFIRM': print('Cancelled') exit() -remove('latest.json') -rmtree('releases') -mkdir('releases') +for dir in ['releases', 'latest']: + rmtree(dir) + mkdir(dir) print('Reset complete')