Skip to content

Commit 0356213

Browse files
authored
✨ moban file inheritance (#346)
* ✨ allow .moban.yaml to inherit(overrides operator) any other yaml files * 🔬 unit test the new feature * 📚 🔬 update use case documentation and provide regression test suite * 👕 make yamllint happy * 🔥 remove debug print * 📰 add missing moban file
1 parent 3b19f86 commit 0356213

File tree

14 files changed

+89
-5
lines changed

14 files changed

+89
-5
lines changed

.moban.cd/changelog.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ name: moban
22
organisation: moremoban
33
releases:
44
- changes:
5-
- action: Updated
5+
- action: Added
6+
details:
7+
- "support moban file inheritance. one base moban file and child repos can inherit and override"
8+
date: tbd
9+
version: 0.6.6
10+
- changes:
11+
- action: Added
612
details:
713
- "`#335`: support intermediate targets in moban file"
814
date: 13.10.2019

CHANGELOG.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
Change log
22
================================================================================
33

4+
0.6.6 - tbd
5+
--------------------------------------------------------------------------------
6+
7+
**Added**
8+
9+
#. support moban file inheritance. one base moban file and child repos can
10+
inherit and override
11+
412
0.6.5 - 13.10.2019
513
--------------------------------------------------------------------------------
614

7-
**Updated**
15+
**Added**
816

917
#. `#335 <https://github.com/moremoban/moban/issues/335>`_: support intermediate
1018
targets in moban file

docs/README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ This section covers the use cases for moban. Please check them out individually.
2525
#. `Template files in a zip or tar`_
2626
#. `Template copying from a zip to a zip`_
2727
#. `Intermeidate targets`_
28+
#. `Mobanfile inheritance`_
2829

2930
.. _Jinja2 command line: level-1-jinja2-cli
3031
.. _Template inheritance: level-2-template-inheritance
@@ -48,3 +49,5 @@ This section covers the use cases for moban. Please check them out individually.
4849
.. _Template files in a zip or tar: level-20-templates-configs-in-zip-or-tar
4950
.. _Template copying from a zip to a zip: level-21-copy-templates-into-an-alien-file-system
5051
.. _Intermeidate targets: level-22-intermediate-targets
52+
.. _Mobanfile inheritance: level-23-inherit-organisational-moban-file
53+

docs/index.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ examples folder.
3737
level-20-templates-configs-in-zip-or-tar/README.rst
3838
level-21-copy-templates-into-an-alien-file-system/README.rst
3939
level-22-intermediate-targets/README.rst
40+
level-23-inherit-organisational-moban-file/README.rst
41+
4042

4143
For more complex use case, please look at `its usage in pyexcel project <http://pyexcel.readthedocs.io/en/latest/guide.html>`_
4244

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
overrides: parent.moban.yaml
2+
targets:
3+
- output_a: template_a.jj2
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Level 23: moban file inheritance
2+
================================================================================
3+
4+
It is a bit tedious to repeat a few common configuration in moban file. Why not
5+
create a parent moban file? Then allow child project to deviate from.
6+
7+
The answer is to use 'overrides' in `.moban.yaml`, so called moban file.
8+
9+
`overrides` could over ride any data file format in any location in theory. And
10+
it support override a specific key set.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
template_a: I am template a
2+
template_b: I am template b
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
configuration:
2+
configuration: data.yaml
3+
targets:
4+
- output_b: template_b.jj2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{template_a}}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{{template_b}}

0 commit comments

Comments
 (0)