Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mobanfile to include data from arbitrary config files #126

Closed
jayvdb opened this issue Nov 15, 2018 · 4 comments
Closed

Allow mobanfile to include data from arbitrary config files #126

jayvdb opened this issue Nov 15, 2018 · 4 comments
Assignees
Milestone

Comments

@jayvdb
Copy link
Member

jayvdb commented Nov 15, 2018

Currently a mobanfile can only include one overrides: to list a yaml file which contains more settings.

In order to split input data into multiple files, the following is needed: A.yaml overrides: B.yaml overrides: C.yaml

However B and C may have unrelated set of data, so it is an annoyance that B should refer to C.

This also reduces re-usability.

Another project (Z) might want to use the values in B , but not the values in C.

A should be able to directly include B and C, while Z includes B only.

@jayvdb
Copy link
Member Author

jayvdb commented Nov 15, 2018

An approach which requires little introduction of new terminology or concepts is to allow overrides: to be an mapping.

A.yaml:

overrides:
  B.yaml:
  C.yaml:

...

but still support the old shorter syntax
Z.yaml

overrides: B.yaml

...

For this approach, it would be very acceptable that B & C are not allowed to have the same keys, because there is no defined order in how they should be merged (which is why it is a mapping instead of an array).

This could then be extended to have the mapping value select only a subset of values to be obtained from the mentioned files. e.g.

A.yaml:

overrides:
  B.yaml: translations
  C.yaml: dependencies

...

And array syntax is available in the future if there is a need to have mutliple includes which contain the same keys.

@jayvdb
Copy link
Member Author

jayvdb commented Nov 16, 2018

The other place where multiple yaml files could be introduces is the inner configuration: key.
i.e.

configuration:
  template_dir:
    - "setupmobans:templates"
    - ".moban.d"
  configuration:
    moban.yml:
    other.yaml:

and

targets:
  - output: CHANGELOG.rst
    template: CHANGELOG.rst.jj2
    configuration:
      changelog.yml:
      mobanfile:

The latter example could be used to remove the name and organisation keys in changelog.yml , which duplicate values in mobanfile.

@chfw
Copy link
Member

chfw commented Nov 16, 2018

overrides definition is somewhat changed to include in C/C++, or '@import' in scss:

so a yaml file (A) can include any number of header(yaml) files and keys in A will override any in the included yaml files.

Then in the list of yaml files in A's include list, keys in latter ones will override former ones. I.e.:

overrides:
- B.yaml
- C.yaml

keys in C will overrides B.

@jayvdb jayvdb added this to the 0.4.0 milestone Jan 24, 2019
@chfw
Copy link
Member

chfw commented Feb 17, 2019

the following syntax will introduce order

overrides:
  - B.yaml
  - C.yaml

@jayvdb jayvdb changed the title Allow mobanfile to include data from arbitrary yaml files Allow mobanfile to include data from arbitrary config files Feb 18, 2019
@ayan-b ayan-b self-assigned this Mar 4, 2019
@chfw chfw modified the milestones: 0.4.0, 0.6.0 Aug 22, 2019
chfw added a commit that referenced this issue Aug 22, 2019
@chfw chfw mentioned this issue Aug 23, 2019
5 tasks
@chfw chfw closed this as completed in 930a34f Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants