Add change log and --output for app-json.py
continuous-integration/drone/push Build is passing Details

Closes coop-cloud/auto-apps-json#2.
This commit is contained in:
decentral1se 2021-06-17 21:25:29 +02:00
parent 4042e10985
commit e8510c8aeb
Signed by: decentral1se
GPG Key ID: 92DAD76BD9567B8A
2 changed files with 11 additions and 3 deletions

View File

@ -11,6 +11,8 @@
- Add `--bump` to `deploy` command to allow packagers to make minor package related releases ([#173](https://git.autonomic.zone/coop-cloud/abra/issues/173)) - Add `--bump` to `deploy` command to allow packagers to make minor package related releases ([#173](https://git.autonomic.zone/coop-cloud/abra/issues/173))
- Drop `--skip-version-check`/`--no-domain-poll`/`--no-state-poll` in favour of `--fast` ([#169](https://git.autonomic.zone/coop-cloud/abra/issues/169)) - Drop `--skip-version-check`/`--no-domain-poll`/`--no-state-poll` in favour of `--fast` ([#169](https://git.autonomic.zone/coop-cloud/abra/issues/169))
- Move `abra` image under the new `thecoopcloud/...` namespace ([#1](https://git.autonomic.zone/coop-cloud/auto-apps-json/issues/1))
- Add a `--output` flag to the `app-json.py` app generator for the CI environment ([#2](https://git.autonomic.zone/coop-cloud/auto-apps-json/issues/2))
# abra 9.0.0 (2021-06-10) # abra 9.0.0 (2021-06-10)

View File

@ -6,9 +6,11 @@
# ~/.abra/apps), and format it as JSON so that it can be hosted here: # ~/.abra/apps), and format it as JSON so that it can be hosted here:
# https://apps.coopcloud.tech # https://apps.coopcloud.tech
import argparse
from json import dump from json import dump
from os import chdir, getcwd, listdir from os import chdir, getcwd, listdir
from os.path import basename from os.path import basename
from pathlib import Path
from re import findall, search from re import findall, search
from subprocess import DEVNULL from subprocess import DEVNULL
@ -25,6 +27,9 @@ from abralib import (
log, log,
) )
parser = argparse.ArgumentParser(description="Generate a new apps.json")
parser.add_argument("--output", type=Path, default=f"{getcwd()}/apps.json")
def get_published_apps_json(): def get_published_apps_json():
"""Retrieve already published apps json.""" """Retrieve already published apps json."""
@ -195,11 +200,12 @@ def get_app_versions(app_path, cached_apps_json):
def main(): def main():
"""Run the script.""" """Run the script."""
args = parser.parse_args()
repos_json = get_repos_json() repos_json = get_repos_json()
clone_all_apps(repos_json) clone_all_apps(repos_json)
target = f"{getcwd()}/apps.json" with open(args.output, "w", encoding="utf-8") as handle:
with open(target, "w", encoding="utf-8") as handle:
dump( dump(
generate_apps_json(repos_json), generate_apps_json(repos_json),
handle, handle,
@ -208,7 +214,7 @@ def main():
sort_keys=True, sort_keys=True,
) )
log.info(f"Successfully generated {target}") log.info(f"Successfully generated {args.output}")
main() main()