Skip to content

Commit a1a43ba

Browse files
authored
Use templates(configuration files) over internet (#373)
* tmp do * 🚜 revert the changes in static files * 💄 make the implementation proper * 🔨 code refactoring * 💚 fix code to pass unit tests * 📚 update documentation * 🔬 📚 regression test and documentation * :micrscope: more unit tests * 📚 update version and documentation * 🔥 remove unused import * 🔥 remove unused codes * 📚 yaml > allows a v long string with new line. >- does the same but no new line * :eggs: 🎡 ready to release * 📰 add missing test fixture
1 parent 4d04635 commit a1a43ba

File tree

23 files changed

+206
-55
lines changed

23 files changed

+206
-55
lines changed

.moban.cd/changelog.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: moban
22
organisation: moremoban
33
releases:
4+
- changes:
5+
- action: Added
6+
details:
7+
- "Support for templates and configuration files over HTTP(S) protocol with httpfs! Yepee!"
8+
date: 1.5.2020
9+
version: 0.7.2
410
- changes:
511
- action: Fixed
612
details:

.moban.cd/moban.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ organisation: moremoban
44
author: C. W.
55
66
license: MIT
7-
version: 0.7.1
8-
current_version: 0.7.1
9-
release: 0.7.1
7+
version: 0.7.2
8+
current_version: 0.7.2
9+
release: 0.7.2
1010
branch: master
1111
master: index
1212
command_line_interface: "moban"

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Change log
22
================================================================================
33

4+
0.7.2 - 1.5.2020
5+
--------------------------------------------------------------------------------
6+
7+
**Added**
8+
9+
#. Support for templates and configuration files over HTTP(S) protocol with
10+
httpfs! Yepee!
11+
412
0.7.1 - 25.04.2020
513
--------------------------------------------------------------------------------
614

README.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ organisation.
5656

5757
And here is a list of other usages:
5858

59+
1. `Django Mobans <https://github.com/django-mobans>`_, templates for django, docker etc.
5960
1. `Math Sheets <https://github.com/chfw/math-sheets>`_, generate custom math sheets
6061
in pdf
6162

@@ -160,7 +161,23 @@ Moban in live action:
160161
All use cases are documented `here <http://moban.readthedocs.org/en/latest/#tutorial>`_
161162

162163

163-
Work with files in a git repo
164+
Templates and configuration files over HTTP(S)
165+
================================================================================
166+
167+
`httpfs <https://github.com/moremoban/httpfs>`_ should be installed first.
168+
169+
.. code-block:: bash
170+
171+
$ moban -t 'https://raw.githubusercontent.com/moremoban/pypi-mobans/dev/templates/_version.py.jj2'\
172+
-c 'https://raw.githubusercontent.com/moremoban/pypi-mobans/dev/config/data.yml'\
173+
-o _version.py
174+
175+
176+
In an edge case, if github repo's public url is given,
177+
this github repo shall not have sub repos. This library will fail to
178+
translate sub-repo as url. No magic.
179+
180+
Templates and configuration files in a git repo
164181
================================================================================
165182

166183
`gitfs2 <https://github.com/moremoban/gitfs2>`_ is optional since v0.7.0 but was
@@ -182,7 +199,7 @@ You can do the following with moban:
182199
__author__ = "C.W."
183200
184201
185-
Work with files in a python package
202+
Templates and configuration files in a python package
186203
================================================================================
187204

188205
`pypifs <https://github.com/moremoban/pypifs>`_ is optional since v0.7.0 but

docs/README.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ This section covers the use cases for moban. Please check them out individually.
2626
#. `Template copying from a zip to a zip`_
2727
#. `Intermeidate targets`_
2828
#. `Mobanfile inheritance`_
29+
#. `Files over http(s)`_
2930

3031
.. _Jinja2 command line: level-1-jinja2-cli
3132
.. _Template inheritance: level-2-template-inheritance
@@ -50,4 +51,4 @@ This section covers the use cases for moban. Please check them out individually.
5051
.. _Template copying from a zip to a zip: level-21-copy-templates-into-an-alien-file-system
5152
.. _Intermeidate targets: level-22-intermediate-targets
5253
.. _Mobanfile inheritance: level-23-inherit-organisational-moban-file
53-
54+
.. _Files over http(s): level-24-files-over-http

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
copyright = '2017-2020 Onni Software Ltd.'
2626
author = 'C. W.'
2727
# The short X.Y version
28-
version = '0.7.1'
28+
version = '0.7.2'
2929
# The full version, including alpha/beta/rc tags
30-
release = '0.7.1'
30+
release = '0.7.2'
3131

3232
# -- General configuration ---------------------------------------------------
3333

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ examples folder.
3838
level-21-copy-templates-into-an-alien-file-system/README.rst
3939
level-22-intermediate-targets/README.rst
4040
level-23-inherit-organisational-moban-file/README.rst
41+
level-24-files-over-http/README.rst
4142

4243

4344
For more complex use case, please look at `its usage in pyexcel project <http://pyexcel.readthedocs.io/en/latest/guide.html>`_
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
configuration:
2+
template_dir:
3+
- "https://raw.githubusercontent.com/moremoban/pypi-mobans/dev/templates/"
4+
- local
5+
configuration: config.yml
6+
configuration_dir: >-
7+
https://raw.githubusercontent.com/moremoban/pypi-mobans/dev/config/
8+
targets:
9+
- mytravis.yml: travis.yml.jj2
10+
- test.txt: demo.txt.jj2
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
level 24: templates and configuration files over http(s)
2+
================================================================================
3+
4+
.. note::
5+
6+
You will need to install httpfs
7+
8+
Why not to take a template off the web? Once a template is written somewhere
9+
by somebody, as long as it is good and useful, it is always to reuse it,
10+
isn't it? DRY principle kicks in.
11+
12+
Now with mobanfile, it is possible to package up your mobans/templates and
13+
configuration files from a HTTP(S) protocol.
14+
15+
16+
Here are the sample file::
17+
18+
configuration:
19+
template_dir:
20+
- "https://raw.githubusercontent.com/moremoban/pypi-mobans/dev/templates/"
21+
- local
22+
configuration: config.yml
23+
configuration_dir: "https://raw.githubusercontent.com/moremoban/pypi-mobans/dev/config/"
24+
targets:
25+
- mytravis.yml: travis.yml.jj2
26+
- test.txt: demo.txt.jj2
27+
28+
When you refer to it in configuration section, here is the syntax::
29+
30+
configuration:
31+
template_dir:
32+
- "https://raw.githubusercontent.com/moremoban/pypi-mobans/dev/templates/"
33+
34+
.. warn::
35+
36+
The trailing '/' must be there.
37+
38+
39+
Maintenance note
40+
--------------------------------------------------------------------------------
41+
42+
To the maintainer, in order to eat the dog food. Please checkout pypi-mobans
43+
and run a http server inside local pypi-mobans folder.
44+
45+
Then update moban's mobanfile to::
46+
47+
configuration:
48+
template_dir:
49+
- "http://localhost:8000/templates/"
50+
- "http://localhost:8000/statics/"
51+
- ".moban.d"
52+
53+
Then run `make update`
54+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
overrides: data.yml
2+
level24: "files over http protocol"

0 commit comments

Comments
 (0)