Skip to content

Commit

Permalink
Merge pull request #398 from moremoban/dev
Browse files Browse the repository at this point in the history
release 0.8.0
  • Loading branch information
chfw authored Sep 2, 2020
2 parents 897cce9 + be97950 commit d132353
Show file tree
Hide file tree
Showing 25 changed files with 106 additions and 146 deletions.
1 change: 1 addition & 0 deletions .azure-pipelines-steps-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.x'
- script: |
export SETUPTOOLS_USE_DISTUTILS="stdlib"
python -m pip install --upgrade pip setuptools wheel
test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt
pip install -r requirements.txt
Expand Down
1 change: 1 addition & 0 deletions .azure-pipelines-steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ steps:
- task: UsePythonVersion@0
displayName: 'Use Python 3.x'
- script: |
set SETUPTOOLS_USE_DISTUTILS="stdlib"
python -m pip install --upgrade pip setuptools wheel
if exist rnd_requirements.txt pip install -r rnd_requirements.txt
pip install -r requirements.txt
Expand Down
1 change: 0 additions & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ Before raising the PR, here is a check list:
- [ ] have you updated the change log?
- [ ] can someone else understand your changes without your explanation?
- [ ] are you proud of your code changes?
- [ ] please add your name and github link to contributors.rst in alphabetical order.

29 changes: 29 additions & 0 deletions .github/workflows/moban-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
on: [push]

jobs:
run_moban:
runs-on: ubuntu-latest
name: synchronize templates via moban
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '3.7'
- name: check changes
run: |
pip install moban gitfs2 pypifs moban-jinja2-github
make update
git status
git diff --exit-code
- name: Auto-commit
if: failure()
uses: docker://cdssnc/auto-commit-github-action
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
args: >-
This is an auto-commit, updating project meta data,
such as changelog.rst, contributors.rst
11 changes: 11 additions & 0 deletions .moban.cd/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
name: moban
organisation: moremoban
releases:
- changes:
- action: Removed
details:
- moban.plugins.jinja2.tests.files is moved to moban-ansible package
- moban.plugins.jinja2.filters.github is moved to moban-jinja2-github package
- action: Fixed
details:
- "`#396`: custom jinja2 plugins(filters, tests and globals) are not
visible if a template is passed as a string."
date: 02.09.2020
version: 0.8.0
- changes:
- action: Updated
details:
Expand Down
9 changes: 5 additions & 4 deletions .moban.cd/moban.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: moban
project: moban
organisation: moremoban
author: C. W.
author: chfw
contact: wangc_2011@hotmail.com
license: MIT
version: 0.7.10
current_version: 0.7.10
release: 0.7.10
version: 0.8.0
current_version: 0.8.0
release: 0.8.0
branch: master
master: index
command_line_interface: "moban"
Expand All @@ -27,6 +27,7 @@ dependencies:
- crayons>= 0.1.0
- fs>=2.4.11
- jinja2-fsloader>=0.2.0
- moban-jinja2-github
description: General purpose static text generator
scm_host: github.com
lint_command: make install_test format git-diff-check lint
Expand Down
8 changes: 8 additions & 0 deletions .moban.d/moban_readme.jj2
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ mó bǎn - 模板 General purpose static text generator
Announcement
================================================================================


In version 0.8.0, `moban.plugins.jinja2.tests.files` is moved to moban-ansible
package. `moban.plugins.jinja2.filters.github` is moved to moban-jinja2-github
package Please install them for backward compatibility.


From 2020 onwards, minimum requirement is Python 3.6


For existing moban users, python 2 support has been dropped. Please stay with
versions lower than 0.7.0 if you are still using python 2.




Quick start
================================================================================

Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ stages:
env:
- MINREQ=0
stage: moban
install: pip install moban>=0.0.4 gitfs2 pypifs
install: pip install moban>=0.0.4 gitfs2 pypifs moban-jinja2-github
script: make update git-diff-check

jobs:
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
Change log
================================================================================

0.8.0 - 02.09.2020
--------------------------------------------------------------------------------

**Removed**

#. moban.plugins.jinja2.tests.files is moved to moban-ansible package
#. moban.plugins.jinja2.filters.github is moved to moban-jinja2-github package

**Fixed**

#. `#396 <https://github.com/moremoban/moban/issues/396>`_: custom jinja2
plugins(filters, tests and globals) are not visible if a template is passed
as a string.

0.7.10 - 16.08.2020
--------------------------------------------------------------------------------

Expand Down
18 changes: 10 additions & 8 deletions CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
Contributors

8 contributors
================================================================================

In alphabetical order:

* `Ayan Banerjee <https://github.com/ayan-b>`_
* `Charlie Liu <https://github.com/CLiu13>`_
* `John Vandenberg <https://github.com/jayvdb>`_
* `Joshua Chung <https://github.com/seeeturtle>`_
* `PRAJWAL M <https://github.com/PrajwalM2212>`_
* `salotz <https://github.com/salotz>`_
* `SerekKiri <https://github.com/SerekKiri>`_
* `Andrew Scheller <https://api.github.com/users/lurch>`_
* `Ayan Banerjee <https://api.github.com/users/ayan-b>`_
* `Charlie Liu <https://api.github.com/users/CLiu13>`_
* `John Vandenberg <https://api.github.com/users/jayvdb>`_
* `Joshua Chung <https://api.github.com/users/seeeturtle>`_
* `PRAJWAL M <https://api.github.com/users/PrajwalM2212>`_
* `salotz <https://api.github.com/users/salotz>`_
* `SerekKiri <https://api.github.com/users/SerekKiri>`_
11 changes: 8 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,21 @@ mó bǎn - 模板 General purpose static text generator
Announcement
================================================================================


In version 0.8.0, `moban.plugins.jinja2.tests.files` is moved to moban-ansible
package. `moban.plugins.jinja2.filters.github` is moved to moban-jinja2-github
package Please install them for backward compatibility.


From 2020 onwards, minimum requirement is Python 3.6


For existing moban users, python 2 support has been dropped. Please stay with
versions lower than 0.7.0 if you are still using python 2.




Quick start
================================================================================

Expand Down Expand Up @@ -189,9 +197,6 @@ Given a data.json file with the following content
$ moban --template-type slim -c data.json "{{person.firstname}} {{person.lastname}}"
Slimming <p>{{first... to moban.output
Slimmed 1 file.
$ cat moban.output
Smith Jones
Handlebars.js template
Expand Down
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@

project = 'moban'
copyright = '2017-2020 Onni Software Ltd.'
author = 'C. W.'
author = 'chfw'
# The short X.Y version
version = '0.7.10'
version = '0.8.0'
# The full version, including alpha/beta/rc tags
release = '0.7.10'
release = '0.8.0'

# -- General configuration ---------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions min_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ appdirs==1.4.3
crayons== 0.1.0
fs==2.4.11
jinja2-fsloader==0.2.0
moban-jinja2-github
4 changes: 2 additions & 2 deletions moban/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = "0.7.10"
__author__ = "C. W."
__version__ = "0.8.0"
__author__ = "chfw"
1 change: 0 additions & 1 deletion moban/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
# Command line options
LABEL_CONFIG = "configuration"
LABEL_CONFIG_DIR = "configuration_dir"
LABEL_PLUGIN_DIRS = "plugin_dir"
LABEL_TEMPLATE = "template"
POSITIONAL_LABEL_TEMPLATE = "template_in_string"
LABEL_TMPL_DIRS = "template_dir"
Expand Down
1 change: 1 addition & 0 deletions moban/core/mobanfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def handle_moban_file_v1(moban_file_configurations, command_line_options):
merged_options = merge(command_line_options, constants.DEFAULT_OPTIONS)

plugins_dirs = merged_options.get(constants.LABEL_PLUGIN_DIRS)

if plugins_dirs:
handle_plugin_dirs(plugins_dirs)

Expand Down
6 changes: 2 additions & 4 deletions moban/plugins/jinja2/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from importlib import import_module

import fs.errors
from jinja2 import Template, Environment
from jinja2 import Environment
from lml.loader import scan_plugins_regex
from lml.plugin import PluginInfo, PluginManager
from jinja2_fsloader import FSLoader
Expand All @@ -16,9 +16,7 @@
JINJA2_LIBRARIES = "^moban_jinja2_.+$"
JINJA2_EXTENSIONS = [
"moban.plugins.jinja2.filters.repr",
"moban.plugins.jinja2.filters.github",
"moban.plugins.jinja2.filters.text",
"moban.plugins.jinja2.tests.files",
]
JINJA2_THIRD_PARTY_EXTENSIONS = ["jinja2.ext.do", "jinja2.ext.loopcontrols"]
LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -135,7 +133,7 @@ def get_template(self, template_file):
raise exceptions.PassOn(str(e))

def get_template_from_string(self, string):
return Template(string)
return self.jj2_environment.from_string(string)

def apply_template(self, template, data, output):
"""
Expand Down
43 changes: 0 additions & 43 deletions moban/plugins/jinja2/filters/github.py

This file was deleted.

Empty file.
27 changes: 0 additions & 27 deletions moban/plugins/jinja2/tests/files.py

This file was deleted.

5 changes: 0 additions & 5 deletions moban/plugins/jinja2/tests/win32.py

This file was deleted.

2 changes: 2 additions & 0 deletions mobanfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ targets:
template: CHANGELOG.rst.jj2
- min_requirements.txt: min_requirements.txt.jj2
- ".github/workflows/pythonpublish.yml": "pythonpublish.yml"
- "CONTRIBUTORS.rst": "CONTRIBUTORS.rst.jj2"

1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ appdirs>=1.4.3
crayons>= 0.1.0
fs>=2.4.11
jinja2-fsloader>=0.2.0
moban-jinja2-github
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
locale.setlocale(locale.LC_ALL, "en_US.UTF-8")

NAME = "moban"
AUTHOR = "C. W."
VERSION = "0.7.10"
AUTHOR = "chfw"
VERSION = "0.8.0"
EMAIL = "wangc_2011@hotmail.com"
LICENSE = "MIT"
ENTRY_POINTS = {
Expand All @@ -53,7 +53,7 @@
"General purpose static text generator"
)
URL = "https://github.com/moremoban/moban"
DOWNLOAD_URL = "%s/archive/0.7.10.tar.gz" % URL
DOWNLOAD_URL = "%s/archive/0.8.0.tar.gz" % URL
FILES = ["README.rst", "CONTRIBUTORS.rst", "CHANGELOG.rst"]
KEYWORDS = [
"python",
Expand Down Expand Up @@ -85,6 +85,7 @@
"crayons>= 0.1.0",
"fs>=2.4.11",
"jinja2-fsloader>=0.2.0",
"moban-jinja2-github",
]
SETUP_COMMANDS = {}

Expand All @@ -96,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.7.10 " +
"Find 0.7.10 in changelog for more details")
GS_COMMAND = ("gs moban v0.8.0 " +
"Find 0.8.0 in changelog for more details")
NO_GS_MESSAGE = ("Automatic github release is disabled. " +
"Please install gease to enable it.")
UPLOAD_FAILED_MSG = (
Expand Down
Loading

0 comments on commit d132353

Please sign in to comment.