reorganize
This commit is contained in:
parent
ca6744f9e0
commit
d0ba477db8
6 changed files with 13 additions and 8 deletions
|
@ -1 +0,0 @@
|
|||
{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718449299, "file": "realweather-0.9-SNAPSHOT.jar"}
|
1
latest/latest-v1.json
Normal file
1
latest/latest-v1.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718539114, "file": "realweather-0.9-SNAPSHOT.jar"}
|
10
release.py
10
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()
|
||||
|
|
1
releases/0.9-alpha.1/meta-v1.json
Normal file
1
releases/0.9-alpha.1/meta-v1.json
Normal file
|
@ -0,0 +1 @@
|
|||
{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718539114, "file": "realweather-0.9-SNAPSHOT.jar"}
|
|
@ -1 +0,0 @@
|
|||
{"label": "0.9-alpha.1", "id": 1, "timestamp": 1718449299, "file": "realweather-0.9-SNAPSHOT.jar"}
|
7
reset.py
7
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')
|
||||
|
|
Loading…
Reference in a new issue