diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index de36220..3052b48 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,14 +28,14 @@ jobs: - name: Install Dependencies run: | python -m pip install -U pip - python -m pip install -U pycodestyle==2.12.1 autopep8 + python -m pip install -U black python -m pip install -U -r test/pip_reqs.txt - - name: Apply AutoPEP8 + - name: Apply Black run: | - autopep8 --in-place --recursive --max-line-length=100 . + black . --line-length 80 --skip-string-normalization - - name: Commit AutoPEP8 + - name: Commit Black uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: "[ci] auto-format" diff --git a/test/plugman_json_updater.py b/test/plugman_json_updater.py new file mode 100644 index 0000000..3461fd6 --- /dev/null +++ b/test/plugman_json_updater.py @@ -0,0 +1,26 @@ +# crafted by brostos +import json + +plugin_category = ["maps", "minigames", "utilities"] +plugin_names_by_category = {} + +for category in plugin_category: + with open(f"plugins/{category}/{category}.json", "r+") as file: + data = json.load(file) + plugins = data["plugins"] + plugin_names_by_category[category] = list(plugins.keys()) + + for plugin in plugin_names_by_category[category]: + latest_version = int(next(iter(plugins[plugin]["versions"])).replace(".", "")) + current_version = ".".join(str(latest_version + 1)) + plugins[plugin]["versions"][current_version] = None + # Ensure latest version appears first + plugins[plugin]["versions"] = dict( + sorted(plugins[plugin]["versions"].items(), reverse=True) + ) + # json.dump(plugins, indent=2) + file.seek(0) + json.dump(data, file, indent=2, ensure_ascii=False) + # Ensure old content is removed + file.truncate() + print(f"All {category} version have been upgraded")