From 75eccddc5b31230186360f7c5d7f29a0de477c50 Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Sun, 29 Oct 2023 23:18:05 +0100 Subject: [PATCH] feat: Rename `types` key to `generators` --- README.md | 4 ++-- config.example.json | 8 ++++---- main.py | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 7967271..ec72310 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Repository to host a static API using GitHub workflows. When CI is ran, static files are generated and commited to the `gh-pages` branch. The file `generator.py` provides a list of static file generator classes. Each class has a name. The configuration file `config.json` is read which contains the configuration for the API. -By specifying the name of the generator in the `types` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator. +By specifying the name of the generator in the `generators` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator. The following API configuration generates the `contributor` and `release` API for selected repositories: @@ -15,7 +15,7 @@ The following API configuration generates the `contributor` and `release` API fo { "api": [ { - "types": ["release", "contributor"], + "generators": ["release", "contributor"], "repositories": ["user/repo"] } ] diff --git a/config.example.json b/config.example.json index 858d403..41caae2 100644 --- a/config.example.json +++ b/config.example.json @@ -1,7 +1,7 @@ { "api": [ { - "types": [ + "generators": [ "release+contributor" ], "repositories": [ @@ -9,7 +9,7 @@ ] }, { - "types": [ + "generators": [ "social" ], "socials": { @@ -17,13 +17,13 @@ } }, { - "types": [ + "generators": [ "team" ], "organization": "yourorg" }, { - "types": [ + "generators": [ "donation" ], "links": { diff --git a/main.py b/main.py index 523b9fe..d628f15 100644 --- a/main.py +++ b/main.py @@ -9,8 +9,8 @@ apis = config["api"] api_provider = DefaultApiProvider() for api in apis: - for type in api["types"]: - api_type = api_provider.get(type) - if api_type is None: + for generator_name in api["generators"]: + generator = api_provider.get(generator_name) + if generator is None: continue - api_type.generate(api, output) + generator.generate(api, output)