diff --git a/.moban.cd/changelog.yml b/.moban.cd/changelog.yml index 50692331..175c5d8f 100644 --- a/.moban.cd/changelog.yml +++ b/.moban.cd/changelog.yml @@ -3,6 +3,12 @@ organisation: moremoban releases: - changes: - action: Added + details: + - "`#322`: Implicit targets with template extensions default to copy" + date: tbd + version: 0.6.2 + - changes: + - action: Fixed details: - "`#328`: update backward compatibility" date: 10.09.2019 diff --git a/.moban.cd/moban.yml b/.moban.cd/moban.yml index b92eef9d..6acc0cb6 100644 --- a/.moban.cd/moban.yml +++ b/.moban.cd/moban.yml @@ -4,8 +4,8 @@ organisation: moremoban author: C. W. contact: wangc_2011@hotmail.com license: MIT -version: 0.6.1 -current_version: 0.6.1 +version: 0.6.2 +current_version: 0.6.2 release: 0.6.1 branch: master master: index diff --git a/.moban.d/setup.py b/.moban.d/moban_setup.py.jj2 similarity index 100% rename from .moban.d/setup.py rename to .moban.d/moban_setup.py.jj2 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3213bdc9..2e7e14c8 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,12 +1,21 @@ Change log ================================================================================ -0.6.1 - 10.09.2019 +0.6.2 - tbd -------------------------------------------------------------------------------- Added ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +#. `#322 `_: Implicit targets + with template extensions default to copy + +0.6.1 - 10.09.2019 +-------------------------------------------------------------------------------- + +Fixed +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + #. `#328 `_: update backward compatibility diff --git a/docs/conf.py b/docs/conf.py index 21913442..1bdbbf0e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -25,7 +25,7 @@ copyright = '2017-2019 Onni Software Ltd.' author = 'C. W.' # The short X.Y version -version = '0.6.1' +version = '0.6.2' # The full version, including alpha/beta/rc tags release = '0.6.1' diff --git a/docs/level-15-copy-templates-as-target/.moban.yml b/docs/level-15-copy-templates-as-target/.moban.yml index 72351dd3..2771111d 100644 --- a/docs/level-15-copy-templates-as-target/.moban.yml +++ b/docs/level-15-copy-templates-as-target/.moban.yml @@ -8,6 +8,7 @@ targets: - output: target_without_template_type template: file_extension_will_trigger.copy - target_in_short_form: as_long_as_this_one_has.copy + - output_is_copied.same_file_extension: when_source_have.same_file_extension - output: "misc-1-copying/can-create-folder/if-not-exists.txt" template: file-in-template-sources-folder.txt template_type: copy diff --git a/docs/level-15-copy-templates-as-target/README.rst b/docs/level-15-copy-templates-as-target/README.rst index 2e73a082..a153a0b5 100644 --- a/docs/level-15-copy-templates-as-target/README.rst +++ b/docs/level-15-copy-templates-as-target/README.rst @@ -23,7 +23,7 @@ Shorthand syntax:: targets: - explicit: template_file.copy - + - output_is_copied.same_file_extension: when_source_have.same_file_extension No implicit nor short hand syntax for the following directory copying unless you take a look at `force-template-type`. When you read @@ -64,6 +64,7 @@ Here is example moban file for copying:: - output: target_without_template_type template: file_extension_will_trigger.copy - target_in_short_form: as_long_as_this_one_has.copy + - output_is_copied.same_file_extension: when_source_have.same_file_extension - output: "misc-1-copying/can-create-folder/if-not-exists.txt" template: file-in-template-sources-folder.txt template_type: copy diff --git a/docs/level-15-copy-templates-as-target/template-sources/when_source_have.same_file_extension b/docs/level-15-copy-templates-as-target/template-sources/when_source_have.same_file_extension new file mode 100644 index 00000000..6ee981e1 --- /dev/null +++ b/docs/level-15-copy-templates-as-target/template-sources/when_source_have.same_file_extension @@ -0,0 +1 @@ +it is implicit copy as well \ No newline at end of file diff --git a/moban/_version.py b/moban/_version.py index 6f26cf69..bbb51f5d 100644 --- a/moban/_version.py +++ b/moban/_version.py @@ -1,2 +1,2 @@ -__version__ = "0.6.1" +__version__ = "0.6.2" __author__ = "C. W." diff --git a/moban/definitions.py b/moban/definitions.py index 982e3e5d..e72f3d88 100644 --- a/moban/definitions.py +++ b/moban/definitions.py @@ -1,5 +1,9 @@ +import logging + from moban import constants +LOG = logging.getLogger(__name__) + class TemplateTarget(object): def __init__( @@ -16,6 +20,7 @@ def __init__( self.output = self.original_output self.set_template_type(template_type) + LOG.info("create a target {}".format(self)) def set_template_type(self, new_template_type): self.template_type = new_template_type diff --git a/moban/mobanfile/templates.py b/moban/mobanfile/templates.py index 4042ac0e..893ee09d 100644 --- a/moban/mobanfile/templates.py +++ b/moban/mobanfile/templates.py @@ -1,6 +1,6 @@ import logging -from moban import reporter, file_system +from moban import reporter, constants, file_system LOG = logging.getLogger(__name__) @@ -33,6 +33,14 @@ def handle_template(template_file, output, template_dirs): yield a_triple else: template_type = _get_template_type(template_file) + # output.jj2: source.jj2 means 'copy' + if template_type and output.endswith("." + template_type): + LOG.info( + "template type switched to from {0} to {1}".format( + template_type, constants.TEMPLATE_COPY + ) + ) + template_type = constants.TEMPLATE_COPY yield (template_file, output, template_type) diff --git a/mobanfile b/mobanfile index 13ba64bc..e284e011 100644 --- a/mobanfile +++ b/mobanfile @@ -4,7 +4,7 @@ configuration: - ".moban.d" configuration: moban.yml targets: - - setup.py: setup.py + - setup.py: moban_setup.py.jj2 - moban/__init__.py: __init__.py.jj2 - moban/_version.py: _version.py.jj2 - docs/conf.py: custom_conf.py.jj2 diff --git a/setup.py b/setup.py index dcbae103..d2b70c4a 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ NAME = "moban" AUTHOR = "C. W." -VERSION = "0.6.1" +VERSION = "0.6.2" EMAIL = "wangc_2011@hotmail.com" LICENSE = "MIT" ENTRY_POINTS = { diff --git a/tests/test_docs.py b/tests/test_docs.py index 2c711357..e3cc36e9 100644 --- a/tests/test_docs.py +++ b/tests/test_docs.py @@ -233,6 +233,10 @@ def test_level_15_copy_templates_as_target(self): + "so as to trigger ContentForwardEngine, 'copy' engine.\n" ), ), + ( + "output_is_copied.same_file_extension", + "it is implicit copy as well", + ), ] self.run_moban(["moban"], folder, assertions)