diff --git a/.moban.cd/changelog.yml b/.moban.cd/changelog.yml index cb507900..ce785105 100644 --- a/.moban.cd/changelog.yml +++ b/.moban.cd/changelog.yml @@ -1,6 +1,19 @@ name: moban organisation: moremoban releases: + - changes: + - action: Updated + details: + - | + since version 0.5.0, when rendering a single file or string, moban would report + 'Templated 1 of 0 files', which should have been 'Templated 1 file.' + - action: Removed + details: + - | + python 3.4 support is gone because colorama requires + Python '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*' + date: 7.12.2019 + version: 0.6.8 - changes: - action: Updated details: diff --git a/.moban.cd/moban.yml b/.moban.cd/moban.yml index 43591b40..b73096a0 100644 --- a/.moban.cd/moban.yml +++ b/.moban.cd/moban.yml @@ -4,9 +4,9 @@ organisation: moremoban author: C. W. contact: wangc_2011@hotmail.com license: MIT -version: 0.6.7 -current_version: 0.6.7 -release: 0.6.7 +version: 0.6.8 +current_version: 0.6.8 +release: 0.6.8 branch: master master: index command_line_interface: "moban" diff --git a/.moban.d/moban_travis.yml.jj2 b/.moban.d/moban_travis.yml.jj2 index 91ba2fd4..5a68710f 100644 --- a/.moban.d/moban_travis.yml.jj2 +++ b/.moban.d/moban_travis.yml.jj2 @@ -12,7 +12,6 @@ python: - 3.7 - 3.6 - 3.5 - - 3.4 - 2.7 - - 3.8-dev + - 3.8 {%endblock%} diff --git a/.travis.yml b/.travis.yml index 47aad46d..11350c54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,9 +8,8 @@ python: - 3.7 - 3.6 - 3.5 - - 3.4 - 2.7 - - 3.8-dev + - 3.8 env: - MINREQ=0 - MINREQ=1 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 612dafce..06c2bf60 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,6 +1,19 @@ Change log ================================================================================ +0.6.8 - 7.12.2019 +-------------------------------------------------------------------------------- + +**Updated** + +#. since version 0.5.0, when rendering a single file or string, moban would + report 'Templated 1 of 0 files', which should have been 'Templated 1 file.' + +**Removed** + +#. python 3.4 support is gone because colorama requires Python '>=2.7, !=3.0.*, + !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*' + 0.6.7 - 1.12.2019 -------------------------------------------------------------------------------- diff --git a/README.rst b/README.rst index f4cf979c..41355eb6 100644 --- a/README.rst +++ b/README.rst @@ -38,11 +38,6 @@ haml, slim and tornado, can read other data format: json and yaml, and can acces template file and configuration file in any location: zip, git, pypi package, s3, etc. -Please look at our issues. We have many more template engines and data format on the -road map. - -All use cases are documented `here `_ - Support ================================================================================ @@ -76,6 +71,10 @@ or clone it and install it: Quick start ================================================================================ + +.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-intro.gif + + .. code-block:: bash $ export HELLO="world" @@ -120,6 +119,12 @@ moban.output will contain:: Please note that data.yml will take precedence over environment variables. +Moban in live action: + +.. image:: https://github.com/moremoban/moban/raw/dev/docs/images/moban-in-pyexcel-demo.gif + +All use cases are documented `here `_ + Work with files in a git repo ================================================================================ diff --git a/docs/conf.py b/docs/conf.py index 19387fcc..6350db0c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,9 +25,9 @@ copyright = '2017-2019 Onni Software Ltd.' author = 'C. W.' # The short X.Y version -version = '0.6.7' +version = '0.6.8' # The full version, including alpha/beta/rc tags -release = '0.6.7' +release = '0.6.8' # -- General configuration --------------------------------------------------- diff --git a/docs/images/moban-in-intro.gif b/docs/images/moban-in-intro.gif new file mode 100644 index 00000000..63642797 Binary files /dev/null and b/docs/images/moban-in-intro.gif differ diff --git a/docs/images/moban-in-pyexcel-demo.gif b/docs/images/moban-in-pyexcel-demo.gif new file mode 100644 index 00000000..cfa91282 Binary files /dev/null and b/docs/images/moban-in-pyexcel-demo.gif differ diff --git a/moban/_version.py b/moban/_version.py index 6293e594..fdefb44c 100644 --- a/moban/_version.py +++ b/moban/_version.py @@ -1,2 +1,2 @@ -__version__ = "0.6.7" +__version__ = "0.6.8" __author__ = "C. W." diff --git a/moban/core/moban_factory.py b/moban/core/moban_factory.py index 566aebed..b341802a 100644 --- a/moban/core/moban_factory.py +++ b/moban/core/moban_factory.py @@ -135,6 +135,8 @@ def render_to_file(self, template_file, data_file, output_file): self.engine_action, template_file, output_file ) self.templated_count += 1 + self.file_count += 1 + self.buffered_writer.close() def render_string_to_file( @@ -151,6 +153,7 @@ def render_string_to_file( self.engine_action, template_abs_path, output_file ) self.templated_count += 1 + self.file_count += 1 self.buffered_writer.close() def apply_template(self, template_abs_path, template, data, output_file): diff --git a/setup.py b/setup.py index bff29798..55393984 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ NAME = "moban" AUTHOR = "C. W." -VERSION = "0.6.7" +VERSION = "0.6.8" EMAIL = "wangc_2011@hotmail.com" LICENSE = "MIT" ENTRY_POINTS = { @@ -50,7 +50,7 @@ "Yet another jinja2 cli command for static text generation" ) URL = "https://github.com/moremoban/moban" -DOWNLOAD_URL = "%s/archive/0.6.7.tar.gz" % URL +DOWNLOAD_URL = "%s/archive/0.6.8.tar.gz" % URL FILES = ["README.rst", "CONTRIBUTORS.rst", "CHANGELOG.rst"] KEYWORDS = [ "python", @@ -97,8 +97,8 @@ } # You do not need to read beyond this line PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi".format(sys.executable) -GS_COMMAND = ("gs moban v0.6.7 " + - "Find 0.6.7 in changelog for more details") +GS_COMMAND = ("gs moban v0.6.8 " + + "Find 0.6.8 in changelog for more details") NO_GS_MESSAGE = ("Automatic github release is disabled. " + "Please install gease to enable it.") UPLOAD_FAILED_MSG = ( diff --git a/tests/core/test_moban_factory.py b/tests/core/test_moban_factory.py index 536d4eea..409b1d34 100644 --- a/tests/core/test_moban_factory.py +++ b/tests/core/test_moban_factory.py @@ -85,6 +85,21 @@ def test_file_tests(): with open(output, "r") as output_file: content = output_file.read() eq_(content, "yes\nhere") + eq_(engine.file_count, 1) + eq_(engine.templated_count, 1) + os.unlink(output) + + +def test_render_string_to_file(): + output = "test.txt" + path = fs.path.join("tests", "fixtures", "jinja_tests") + engine = ENGINES.get_engine("jinja2", [path], path) + engine.render_string_to_file("{{test}}", "file_tests.yml", output) + with open(output, "r") as output_file: + content = output_file.read() + eq_(content, "here") + eq_(engine.file_count, 1) + eq_(engine.templated_count, 1) os.unlink(output)