Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions .moban.cd/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .moban.cd/moban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.
11 changes: 10 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
Change log
================================================================================

0.6.1 - 10.09.2019
0.6.2 - tbd
--------------------------------------------------------------------------------

Added
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. `#322 <https://github.com/moremoban/moban/issues/322>`_: Implicit targets
with template extensions default to copy

0.6.1 - 10.09.2019
--------------------------------------------------------------------------------

Fixed
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. `#328 <https://github.com/moremoban/moban/issues/328>`_: update backward
compatibility

Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
1 change: 1 addition & 0 deletions docs/level-15-copy-templates-as-target/.moban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion docs/level-15-copy-templates-as-target/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
it is implicit copy as well
2 changes: 1 addition & 1 deletion moban/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.6.1"
__version__ = "0.6.2"
__author__ = "C. W."
5 changes: 5 additions & 0 deletions moban/definitions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import logging

from moban import constants

LOG = logging.getLogger(__name__)


class TemplateTarget(object):
def __init__(
Expand All @@ -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
Expand Down
10 changes: 9 additions & 1 deletion moban/mobanfile/templates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging

from moban import reporter, file_system
from moban import reporter, constants, file_system

LOG = logging.getLogger(__name__)

Expand Down Expand Up @@ -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)


Expand Down
2 changes: 1 addition & 1 deletion mobanfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
4 changes: 4 additions & 0 deletions tests/test_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down