8000 :sparkles: moban file inheritance by chfw · Pull Request #346 · moremoban/moban · GitHub
[go: up one dir, main page]

Skip to content

✨ moban file inheritance #346

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

Merged
merged 6 commits into from
Nov 9, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
📚 🔬 update use case documentation and provide regression test suite
  • Loading branch information
chfw committed Nov 8, 2019
commit e60ff611441e77f9efbb1714b88874f107ce63a0
3 changes: 3 additions & 0 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ This section covers the use cases for moban. Please check them out individually.
#. `Template files in a zip or tar`_
#. `Template copying from a zip to a zip`_
#. `Intermeidate targets`_
#. `Mobanfile inheritance`_

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

2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ examples folder.
level-20-templates-configs-in-zip-or-tar/README.rst
level-21-copy-templates-into-an-alien-file-system/README.rst
level-22-intermediate-targets/README.rst
level-23-inherit-organisational-moban-file/README.rst


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

Expand Down
10 changes: 10 additions & 0 deletions docs/level-23-inherit-organisational-moban-file/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Level 23: moban file inheritance
================================================================================

It is a bit tedious to repeat a few common configuration in moban file. Why not
create a parent moban file? Then allow child project to deviate from.

The answer is to use 'overrides' in `.moban.yaml`, so called moban file.

`overrides` could over ride any data file format in any location in theory. And
it support override a specific key set.
2 changes: 2 additions & 0 deletions docs/level-23-inherit-organisational-moban-file/data.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
template_a: I am template a
template_b: I am template b
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
configuration:
configuration: data.yaml
targets:
- output_b: template_b.jj2
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{template_a}}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{template_b}}
8 changes: 8 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,14 @@ def test_level_22_intermediate_targets(self):
folder = "level-22-intermediate-targets"
self.run_moban(["moban"], folder, [("final", expected)])

def test_level_23_inherit_parent_moban_file(self):
folder = "level-23-inherit-organisational-moban-file"
self.run_moban(
["moban"],
folder,
[("output_a", "I am template a"), ("output_b", "I am template b")],
)

def test_misc_1(self):
expected = "test file\n"

Expand Down
0