From 8bd2511fbf29e7b1288f1138b1f172d0903b4d66 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 19:00:20 +0700 Subject: [PATCH 1/7] :art: lint changelog.yml --- .moban.cd/changelog.yml | 623 +++++++++++++++++++++------------------- CHANGELOG.rst | 4 +- Makefile | 1 + tests/requirements.txt | 1 + 4 files changed, 325 insertions(+), 304 deletions(-) diff --git a/.moban.cd/changelog.yml b/.moban.cd/changelog.yml index 6560d83d..fb0e3148 100644 --- a/.moban.cd/changelog.yml +++ b/.moban.cd/changelog.yml @@ -1,305 +1,324 @@ name: moban organisation: moremoban releases: -- changes: - - action: Updated - details: - - "`#271`: support git branch change in later run." - date: 07.07.2019 - version: 0.4.5 -- changes: - - action: Updated - details: - - "`#265`: Use simple `read binary` to read instead of encoding" - date: 26.05.2019 - version: 0.4.4 -- changes: - - action: Removed - details: - - "`#253`: symbolic link in regression pack causes python setup.py to do recursive include" - - action: Added - details: - - "`#209`: Alert moban user when `git` is not available and is used." - - action: Updated - details: - - "`#261`: since moban group template files per template type, this fill use first come first register to order moban group" - date: 16.03.2019 - version: 0.4.3 -- changes: - - action: Added - details: - - "`#234`: Define template parameters on the fly inside `targets` section" - - "`#62`: select a group target to run" - - action: Updated - details: - - "`#180`: No longer two statistics will be shown in v0.4.x. legacy copy targets are injected into a normal targets. cli target is made a clear priority." - - "`#244`: version 0.4.2 is first version which would work perfectly on windows since 17 Nov 2018. Note that: file permissions are not used on windows. Why the date? because samefile is not avaiable on windows, causing unit tests to fail hence it lead to my conclusion that moban version between 17 Nov 2018 and March 2019 wont work well on Windows." - date: 08.03.2019 - version: 0.4.2 -- changes: - - action: Added - details: - - "`#235`: user defined template types so that custom file extensions, template configurations can be controlled by moban user" - - "`#232`: the package dependencies have been fine tuning to lower versions, most of them are dated back to 2017." - date: 28.02.2019 - version: 0.4.1 -- changes: - - action: Added - details: - - "`#165`: Copy as plugins" - - action: Updated - details: - - "`#219`: git clone depth set to 2" - - "`#186`: lowest dependecy on ruamel.yaml is 0.15.5, Jun 2017" - date: 20.02.2019 - version: 0.4.0 -- changes: - - action: Added - details: - - "`#174`: Store git cache in XDG_CACHE_DIR" - - "`#107`: Add -v to show current moban version" - - "`#164`: support additional data formats" - - action: Updated - details: - - "`#178`: UnboundLocalError: local variable 'target' referenced before assignment" - - "`#169`: uses GitPython instead of barebone git commands" - date: 03.02.2019 - version: 0.3.10 -- changes: - - action: Updated - details: - - "`#90`: allow adding extra jinja2 extensions. `jinja2.ext.do`, `jinja2.ext.loopcontrols` are included by default. what's more, any other template enigne are eligible for extension additions." - - "`#158`: Empty file base_engine.py is finally removed" - date: 18-1-2019 - version: 0.3.9 -- changes: - - action: Updated - details: - - "`#141`: disable file permissions copy feature and not to check file permission changes on windows." - - "`#154`: introduce first ever positional argument for string base template." - - "`#157`: the exit code behavior changed. for backward compactibility please use --exit-code. Otherwise, moban will not tell if there is any changes." - date: 12-1-2019 - version: 0.3.8 -- changes: - - action: Updated - details: - - "`#146`: added a low-setup usage mode via environment variables to moban" - - "`#148`: include test related files in the package for package validation when distributing via linux system, i.e. OpenSuse" - date: 6-1-2019 - version: 0.3.7 -- changes: - - action: Updated - details: - - "`#143`: moban shall report permission error and continue the rest of the copying task." - - "`#122`: Since 0.3.6, moban is tested on windows and macos too, using azure build pipelines. It is already tested extensively on travis-ci on linux os." - date: 30-12-2018 - version: 0.3.6 -- changes: - - action: Updated - details: - - "`#37`: moban will report line number where the value is empty and the name of mobanfile. Switch from pyyaml to ruamel.yaml." - date: 10-12-2018 - version: 0.3.5 -- changes: - - action: Updated - details: - - "`#137`: missing contributors.rst file" - date: 28-11-2018 - version: 0.3.4.1 -- changes: - - action: Added - details: - - "global variables to store the target and template file names in the jinja2 engine" - - "moban-handlebars is tested to work well with this version and above" - - action: Updated - details: - - Template engine interface has been clarified and documented - date: 18-11-2018 - version: 0.3.4 -- changes: - - action: Added - details: - - "alternative and expanded syntax for requires, so as to accomendate github submodule recursive" - date: 05-11-2018 - version: 0.3.3 -- changes: - - action: Added - details: - - "`requires` shall support configuration dirs. In other words, configuration file could be stored in python package or git repository." - date: 04-11-2018 - version: 0.3.2 -- changes: - - action: Added - details: - - "`#97`: requires will clone a repo if given. Note: only github, gitlab, bitbucket for now" - date: 02-11-2018 - version: 0.3.1 -- changes: - - action: Added - details: - - "`#89`: Install pypi-hosted mobans through requires syntax" - - action: Updated - details: - - "`#96`: Fix for FileNotFoundError for plugins" - - "various documentation updates" - - action: Removed - details: - - "`#88`: removed python 2.6 support" - - removed python 3.3 support - date: 27-18-2018 - version: 0.3.0 -- changes: - - action: Added - details: - - "`#32`: option 1 copy a directory without its subdirectories." - - "`#30`: command line template option is ignore when a moban file is present" - date: 14-07-2018 - version: 0.2.4 -- changes: - - action: Added - details: - - "`#76`: running moban as a module from python command" - - "`#32`: copy a directory recusively" - - "`#33`: template all files in a directory" - date: 10-07-2018 - version: 0.2.3 -- changes: - - action: Added - details: - - "`#31`: create directory if missing during copying" - - action: Updated - details: - - "`#28`: if a template has been copied once before, it is skipped in the next moban call" - date: 16-06-2018 - version: 0.2.2 -- changes: - - action: Updated - details: - - templates using the same template engine will be templated as a group - - update lml dependency to 0.0.3 - date: 13-06-2018 - version: 0.2.1 -- changes: - - action: Added - details: - - '`#18`: file exists test' - - "`#23`: custom jinja plugins" - - '`#26`: repr filter' - - "`#47`: allow the expansion of template engine" - - "`#58`: allow template type per template" - - action: Updated - details: - - "`#34`: fix plural message if single file is processed" - date: 11-06-2018 - version: 0.2.0 -- changes: - - action: Updated - details: - - '`#21`: targets become optional' - - "`#19`: transfer symlink's target file's file permission under unix/linux systems" - - '`#16`: introduce copy key word in mobanfile' - date: 29-May-2018 - version: 0.1.4 -- changes: - - action: Updated - details: - - handle unicode on python 2 - date: 12-Mar-2018 - version: 0.1.3 -- changes: - - action: Added - details: - - '`#13`: strip off new lines in the templated file' - date: 10-Jan-2018 - version: 0.1.2 -- changes: - - action: Added - details: - - the ability to present a long text as multi-line paragraph with a custom upper - limit - - 'speical filter expand github references: pull request and issues' - - '`#15`: fix templating syntax to enable python 2.6' - date: 08-Jan-2018 - version: 0.1.1 -- changes: - - action: Added - details: - - '`#14`, provide shell exit code' - date: 19-Dec-2017 - version: 0.1.0 -- changes: - - action: Added - details: - - '`#11`, recognize .moban.yaml as well as .moban.yml.' - - '`#9`, preserve file permissions of the source template.' - - '`-m` option is added to allow you to specify a custom moban file. kinda related - to issue 11.' - - action: Updated - details: - - 'use explicit version name: `moban_file_spec_version` so that `version` can - be used by users. `#10` Please note: moban_file_spec_version is reserved for - future file spec upgrade. For now, all files are assumed to be ''1.0''. When - there comes a new version i.e. 2.0, new moban file based on 2.0 will have to - include ''moban_file_spec_version: 2.0''' - date: 24-Nov-2017 - version: 0.0.9 -- changes: - - action: Added - details: - - '`#8`, verify the existence of custom template and configuration directories. - default .moban.td, .moban.cd are ignored if they do not exist.' - - action: Updated - details: - - Colorize error messages and processing messages. crayons become a dependency. - date: 18-Nov-2017 - version: 0.0.8 -- changes: - - action: Added - details: - - 'Bring the visibility of environment variable into jinja2 templating process: `#7`' - date: 19-Jul-2017 - version: 0.0.7 -- changes: - - action: Added - details: - - added '-f' flag to force moban to template all files despite of .moban.hashes - - action: Updated - details: - - 'moban will not template target file in the situation where the changes occured - in target file than in the source: the template file + the data configuration - after moban has been applied. This new release will remove the change during - mobanization process.' - date: 16-Jun-2017 - version: 0.0.6 -- changes: - - action: Added - details: - - Create a default hash store when processing a moban file. It will save unnecessary - file write to the disc if the rendered content is not changed. - - Added summary reports - date: 17-Mar-2017 - version: 0.0.5 -- changes: - - action: Updated - details: - - Bug fix `#5`, should detect duplicated targets in `.moban.yml` file. - date: 11-May-2016 - version: 0.0.4 -- changes: - - action: Updated - details: - - Bug fix `#4`, keep trailing new lines - date: 09-May-2016 - version: 0.0.3 -- changes: - - action: Updated - details: - - Bug fix `#1`, failed to save utf-8 characters - date: 27-Apr-2016 - version: 0.0.2 -- changes: - - action: Added - details: - - Initial release - date: 23-Mar-2016 - version: 0.0.1 + - changes: + - action: Updated + details: + - "`#271`: support git branch change in later run." + date: 07.07.2019 + version: 0.4.5 + - changes: + - action: Updated + details: + - "`#265`: Use simple `read binary` to read instead of encoding" + date: 26.05.2019 + version: 0.4.4 + - changes: + - action: Removed + details: + - "`#253`: symbolic link in regression pack causes python setup.py to do recursive include" + - action: Added + details: + - "`#209`: Alert moban user when `git` is not available and is used." + - action: Updated + details: + - "`#261`: since moban group template files per template type, + this fill use first come first register to order moban group" + date: 16.03.2019 + version: 0.4.3 + - changes: + - action: Added + details: + - "`#234`: Define template parameters on the fly inside `targets` section" + - "`#62`: select a group target to run" + - action: Updated + details: + - "`#180`: No longer two statistics will be shown in v0.4.x. legacy + copy targets are injected into a normal targets. cli target is made + a clear priority." + - "`#244`: version 0.4.2 is first version which would work perfectly + on windows since 17 Nov 2018. + Note that: file permissions are not used on windows. + Why the date? because samefile is not avaiable on windows, causing + unit tests to fail hence it lead to my conclusion that moban version + between 17 Nov 2018 and March 2019 wont work well on Windows." + date: 08.03.2019 + version: 0.4.2 + - changes: + - action: Added + details: + - "`#235`: user defined template types so that custom file extensions, + template configurations can be controlled by moban user" + - "`#232`: the package dependencies have been fine tuning to lower + versions, most of them are dated back to 2017." + date: 28.02.2019 + version: 0.4.1 + - changes: + - action: Added + details: + - "`#165`: Copy as plugins" + - action: Updated + details: + - "`#219`: git clone depth set to 2" + - "`#186`: lowest dependecy on ruamel.yaml is 0.15.5, Jun 2017" + date: 20.02.2019 + version: 0.4.0 + - changes: + - action: Added + details: + - "`#174`: Store git cache in XDG_CACHE_DIR" + - "`#107`: Add -v to show current moban version" + - "`#164`: support additional data formats" + - action: Updated + details: + - "`#178`: UnboundLocalError: local variable 'target' referenced before assignment" + - "`#169`: uses GitPython instead of barebone git commands" + date: 03.02.2019 + version: 0.3.10 + - changes: + - action: Updated + details: + - "`#90`: allow adding extra jinja2 extensions. `jinja2.ext.do`, + `jinja2.ext.loopcontrols` are included by default. what's more, + any other template enigne are eligible for extension additions." + - "`#158`: Empty file base_engine.py is finally removed" + date: 18-1-2019 + version: 0.3.9 + - changes: + - action: Updated + details: + - "`#141`: disable file permissions copy feature and not to check file permission changes on windows." + - "`#154`: introduce first ever positional argument for string base template." + - "`#157`: the exit code behavior changed. for backward compactibility + please use --exit-code. Otherwise, moban will not tell if there is + any changes." + date: 12-1-2019 + version: 0.3.8 + - changes: + - action: Updated + details: + - "`#146`: added a low-setup usage mode via environment variables to moban" + - "`#148`: include test related files in the package for package + validation when distributing via linux system, i.e. OpenSuse" + date: 6-1-2019 + version: 0.3.7 + - changes: + - action: Updated + details: + - "`#143`: moban shall report permission error and continue the rest of the copying task." + - "`#122`: Since 0.3.6, moban is tested on windows and macos too, + using azure build pipelines. It is already tested extensively on + travis-ci on linux os." + date: 30-12-2018 + version: 0.3.6 + - changes: + - action: Updated + details: + - "`#37`: moban will report line number where the value is empty and + the name of mobanfile. Switch from pyyaml to ruamel.yaml." + date: 10-12-2018 + version: 0.3.5 + - changes: + - action: Updated + details: + - "`#137`: missing contributors.rst file" + date: 28-11-2018 + version: 0.3.4.1 + - changes: + - action: Added + details: + - "global variables to store the target and template file names in the jinja2 engine" + - "moban-handlebars is tested to work well with this version and above" + - action: Updated + details: + - Template engine interface has been clarified and documented + date: 18-11-2018 + version: 0.3.4 + - changes: + - action: Added + details: + - "alternative and expanded syntax for requires, so as to accomendate github submodule recursive" + date: 05-11-2018 + version: 0.3.3 + - changes: + - action: Added + details: + - configuration dirs may be located by `requires`, i.e. + configuration files may be in a python package or git repository. + date: 04-11-2018 + version: 0.3.2 + - changes: + - action: Added + details: + - "`#97`: requires will clone a repo if given. Note: only github, gitlab, bitbucket for now" + date: 02-11-2018 + version: 0.3.1 + - changes: + - action: Added + details: + - "`#89`: Install pypi-hosted mobans through requires syntax" + - action: Updated + details: + - "`#96`: Fix for FileNotFoundError for plugins" + - "various documentation updates" + - action: Removed + details: + - "`#88`: removed python 2.6 support" + - removed python 3.3 support + date: 27-18-2018 + version: 0.3.0 + - changes: + - action: Added + details: + - "`#32`: option 1 copy a directory without its subdirectories." + - "`#30`: command line template option is ignore when a moban file is present" + date: 14-07-2018 + version: 0.2.4 + - changes: + - action: Added + details: + - "`#76`: running moban as a module from python command" + - "`#32`: copy a directory recusively" + - "`#33`: template all files in a directory" + date: 10-07-2018 + version: 0.2.3 + - changes: + - action: Added + details: + - "`#31`: create directory if missing during copying" + - action: Updated + details: + - "`#28`: if a template has been copied once before, it is skipped in the next moban call" + date: 16-06-2018 + version: 0.2.2 + - changes: + - action: Updated + details: + - templates using the same template engine will be templated as a group + - update lml dependency to 0.0.3 + date: 13-06-2018 + version: 0.2.1 + - changes: + - action: Added + details: + - '`#18`: file exists test' + - "`#23`: custom jinja plugins" + - '`#26`: repr filter' + - "`#47`: allow the expansion of template engine" + - "`#58`: allow template type per template" + - action: Updated + details: + - "`#34`: fix plural message if single file is processed" + date: 11-06-2018 + version: 0.2.0 + - changes: + - action: Updated + details: + - '`#21`: targets become optional' + - "`#19`: transfer symlink's target file's file permission under unix/linux systems" + - '`#16`: introduce copy key word in mobanfile' + date: 29-May-2018 + version: 0.1.4 + - changes: + - action: Updated + details: + - handle unicode on python 2 + date: 12-Mar-2018 + version: 0.1.3 + - changes: + - action: Added + details: + - '`#13`: strip off new lines in the templated file' + date: 10-Jan-2018 + version: 0.1.2 + - changes: + - action: Added + details: + - the ability to present a long text as multi-line paragraph with a custom upper + limit + - 'speical filter expand github references: pull request and issues' + - '`#15`: fix templating syntax to enable python 2.6' + date: 08-Jan-2018 + version: 0.1.1 + - changes: + - action: Added + details: + - '`#14`, provide shell exit code' + date: 19-Dec-2017 + version: 0.1.0 + - changes: + - action: Added + details: + - '`#11`, recognize .moban.yaml as well as .moban.yml.' + - '`#9`, preserve file permissions of the source template.' + - '`-m` option is added to allow you to specify a custom moban file. kinda related + to issue 11.' + - action: Updated + details: + - 'use explicit version name: `moban_file_spec_version` so that `version` can + be used by users. `#10` Please note: moban_file_spec_version is reserved for + future file spec upgrade. For now, all files are assumed to be ''1.0''. When + there comes a new version i.e. 2.0, new moban file based on 2.0 will have to + include ''moban_file_spec_version: 2.0''' + date: 24-Nov-2017 + version: 0.0.9 + - changes: + - action: Added + details: + - '`#8`, verify the existence of custom template and configuration directories. + default .moban.td, .moban.cd are ignored if they do not exist.' + - action: Updated + details: + - Colorize error messages and processing messages. crayons become a dependency. + date: 18-Nov-2017 + version: 0.0.8 + - changes: + - action: Added + details: + - 'Bring the visibility of environment variable into jinja2 templating process: `#7`' + date: 19-Jul-2017 + version: 0.0.7 + - changes: + - action: Added + details: + - added '-f' flag to force moban to template all files despite of .moban.hashes + - action: Updated + details: + - 'moban will not template target file in the situation where the changes occured + in target file than in the source: the template file + the data configuration + after moban has been applied. This new release will remove the change during + mobanization process.' + date: 16-Jun-2017 + version: 0.0.6 + - changes: + - action: Added + details: + - Create a default hash store when processing a moban file. It will save unnecessary + file write to the disc if the rendered content is not changed. + - Added summary reports + date: 17-Mar-2017 + version: 0.0.5 + - changes: + - action: Updated + details: + - Bug fix `#5`, should detect duplicated targets in `.moban.yml` file. + date: 11-May-2016 + version: 0.0.4 + - changes: + - action: Updated + details: + - Bug fix `#4`, keep trailing new lines + date: 09-May-2016 + version: 0.0.3 + - changes: + - action: Updated + details: + - Bug fix `#1`, failed to save utf-8 characters + date: 27-Apr-2016 + version: 0.0.2 + - changes: + - action: Added + details: + - Initial release + date: 23-Mar-2016 + version: 0.0.1 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b2a846a4..d1f1d298 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -215,8 +215,8 @@ Added Added ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -#. `requires` shall support configuration dirs. In other words, configuration - file could be stored in python package or git repository. +#. configuration dirs may be located by `requires`, i.e. configuration files may + be in a python package or git repository. 0.3.1 - 02-11-2018 -------------------------------------------------------------------------------- diff --git a/Makefile b/Makefile index 6315255a..7deeda0c 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ test: lint: bash lint.sh + yamllint -d "{extends: default, rules: {line-length: {max: 120}}}" .moban.cd/changelog.yml format: isort -y $(find moban -name "*.py"|xargs echo) $(find tests -name "*.py"|xargs echo) diff --git a/tests/requirements.txt b/tests/requirements.txt index c27cb7fb..a6b17478 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -2,6 +2,7 @@ nose codecov coverage mock +yamllint flake8 black;python_version>="3.6" isort;python_version>="3.6" From 1f07af49eadef9114f0b9e71bf01e812e05159f3 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 19:02:33 +0700 Subject: [PATCH 2/7] :fast_forward: sync min_requirements.txt --- min_requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/min_requirements.txt b/min_requirements.txt index faee8d8f..b5c854ba 100644 --- a/min_requirements.txt +++ b/min_requirements.txt @@ -1,4 +1,4 @@ -ruamel.yaml==0.15.5,<=0.15.94;python_version == '3.4' +ruamel.yaml==0.15.5;python_version == '3.4' ruamel.yaml==0.15.42;python_version == '3.7' ruamel.yaml==0.15.5;python_version != '3.4' and python_version < '3.7' ruamel.yaml==0.15.98;python_version == '3.8' From cdd76b06d8e26688676a54c014a7da9c465a5930 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 19:09:43 +0700 Subject: [PATCH 3/7] :art: lint yaml in tests --- tests/fixtures/.moban-2.yml | 2 +- tests/fixtures/.moban.yml | 2 +- tests/fixtures/child.yaml | 2 +- tests/fixtures/globals/basic.yml | 2 +- tests/fixtures/globals/variables.yml | 2 +- tests/fixtures/jinja_tests/file_tests.yml | 2 +- .../mobanengine/sample_template_type.yml | 16 ++++++++-------- tests/fixtures/orphan.yaml | 2 +- tests/fixtures/simple.yaml | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tests/fixtures/.moban-2.yml b/tests/fixtures/.moban-2.yml index 5a3af05d..59ed39fc 100644 --- a/tests/fixtures/.moban-2.yml +++ b/tests/fixtures/.moban-2.yml @@ -1,5 +1,5 @@ requires: - - pypi-mobans-pkg + - pypi-mobans-pkg configuration: configuration_dir: "setupmobans:config" template_dir: diff --git a/tests/fixtures/.moban.yml b/tests/fixtures/.moban.yml index 61880192..182a0293 100644 --- a/tests/fixtures/.moban.yml +++ b/tests/fixtures/.moban.yml @@ -1,5 +1,5 @@ requires: - - pypi-mobans-pkg + - pypi-mobans-pkg configuration: template_dir: - "setupmobans:templates" diff --git a/tests/fixtures/child.yaml b/tests/fixtures/child.yaml index 969a4747..4b082225 100644 --- a/tests/fixtures/child.yaml +++ b/tests/fixtures/child.yaml @@ -1,2 +1,2 @@ overrides: base.yaml -key: hello world \ No newline at end of file +key: hello world diff --git a/tests/fixtures/globals/basic.yml b/tests/fixtures/globals/basic.yml index 4f804496..6268fdfc 100644 --- a/tests/fixtures/globals/basic.yml +++ b/tests/fixtures/globals/basic.yml @@ -1 +1 @@ -globals: test \ No newline at end of file +globals: test diff --git a/tests/fixtures/globals/variables.yml b/tests/fixtures/globals/variables.yml index a0067b10..08f1fe69 100644 --- a/tests/fixtures/globals/variables.yml +++ b/tests/fixtures/globals/variables.yml @@ -1 +1 @@ -test: here \ No newline at end of file +test: here diff --git a/tests/fixtures/jinja_tests/file_tests.yml b/tests/fixtures/jinja_tests/file_tests.yml index a0067b10..08f1fe69 100644 --- a/tests/fixtures/jinja_tests/file_tests.yml +++ b/tests/fixtures/jinja_tests/file_tests.yml @@ -1 +1 @@ -test: here \ No newline at end of file +test: here diff --git a/tests/fixtures/mobanengine/sample_template_type.yml b/tests/fixtures/mobanengine/sample_template_type.yml index 60eeb617..75e6d268 100644 --- a/tests/fixtures/mobanengine/sample_template_type.yml +++ b/tests/fixtures/mobanengine/sample_template_type.yml @@ -1,10 +1,10 @@ template_types: custom_jinja: - base_type: jinja2 # use base_type, instead of overrides - file_extensions: - - moban - - new - - demo_file_suffix - options: - extensions: - - jinja2.ext.do + base_type: jinja2 # use base_type, instead of overrides + file_extensions: + - moban + - new + - demo_file_suffix + options: + extensions: + - jinja2.ext.do diff --git a/tests/fixtures/orphan.yaml b/tests/fixtures/orphan.yaml index 9ac4627c..e831e1fc 100644 --- a/tests/fixtures/orphan.yaml +++ b/tests/fixtures/orphan.yaml @@ -1 +1 @@ -overrides: darkmatter.yaml \ No newline at end of file +overrides: darkmatter.yaml diff --git a/tests/fixtures/simple.yaml b/tests/fixtures/simple.yaml index 06e472d1..cfeb9d58 100644 --- a/tests/fixtures/simple.yaml +++ b/tests/fixtures/simple.yaml @@ -1 +1 @@ -simple: yaml \ No newline at end of file +simple: yaml From 628468a7f32429b5c6599813ba2b85b1ab062adb Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 19:49:58 +0700 Subject: [PATCH 4/7] :art: lint yaml in docs --- docs/level-1-jinja2-cli/data.yml | 2 +- docs/level-10-moban-dependency-as-git-repo/.moban.yml | 2 +- docs/level-10-moban-dependency-as-git-repo/config.yml | 2 +- .../local/mytravis.yml | 3 ++- docs/level-11-use-handlebars/.moban.cd/data.base.yaml | 2 +- docs/level-11-use-handlebars/data.yml | 2 +- .../.moban.cd/parent.yaml | 2 +- docs/level-14-custom-data-loader/override_custom.yaml | 2 +- .../.moban.yml | 9 +++++---- .../.moban.yml | 3 ++- docs/level-19-moban-a-sub-group-in-targets/.moban.yml | 9 +++++---- docs/level-2-template-inheritance/data.yml | 2 +- docs/level-3-data-override/.moban.cd/data.base.yaml | 2 +- docs/level-3-data-override/data.yml | 2 +- .../custom-config/data.base.yaml | 2 +- docs/level-5-custom-configuration/data.yml | 2 +- .../custom-config/data.base.yaml | 2 +- docs/level-6-complex-configuration/data.yml | 2 +- docs/level-6-complex-configuration/data2.yml | 2 +- .../config/level8.yml | 2 +- docs/level-9-moban-dependency-as-pypi-package/.moban.yml | 2 +- docs/misc-1-copying-templates/.moban.yml | 3 ++- 22 files changed, 33 insertions(+), 28 deletions(-) diff --git a/docs/level-1-jinja2-cli/data.yml b/docs/level-1-jinja2-cli/data.yml index 0d8e794f..bb56b055 100644 --- a/docs/level-1-jinja2-cli/data.yml +++ b/docs/level-1-jinja2-cli/data.yml @@ -1 +1 @@ -hello: world \ No newline at end of file +hello: world diff --git a/docs/level-10-moban-dependency-as-git-repo/.moban.yml b/docs/level-10-moban-dependency-as-git-repo/.moban.yml index e589b3d2..9286746c 100644 --- a/docs/level-10-moban-dependency-as-git-repo/.moban.yml +++ b/docs/level-10-moban-dependency-as-git-repo/.moban.yml @@ -1,5 +1,5 @@ requires: - - https://github.com/moremoban/pypi-mobans + - https://github.com/moremoban/pypi-mobans configuration: template_dir: - "pypi-mobans:templates" diff --git a/docs/level-10-moban-dependency-as-git-repo/config.yml b/docs/level-10-moban-dependency-as-git-repo/config.yml index da73400d..a4d9f0c9 100644 --- a/docs/level-10-moban-dependency-as-git-repo/config.yml +++ b/docs/level-10-moban-dependency-as-git-repo/config.yml @@ -1,2 +1,2 @@ overrides: data.yml -level10: "moban dependency as git repo" \ No newline at end of file +level10: "moban dependency as git repo" diff --git a/docs/level-10-moban-dependency-as-git-repo/local/mytravis.yml b/docs/level-10-moban-dependency-as-git-repo/local/mytravis.yml index 8295c536..dc7bd8c8 100644 --- a/docs/level-10-moban-dependency-as-git-repo/local/mytravis.yml +++ b/docs/level-10-moban-dependency-as-git-repo/local/mytravis.yml @@ -14,7 +14,8 @@ before_install: - if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then mv min_requirements.txt requirements.txt ; fi - - test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt + - test ! -f rnd_requirements.txt || + pip install --no-deps -r rnd_requirements.txt - test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ; - pip install -r tests/requirements.txt script: diff --git a/docs/level-11-use-handlebars/.moban.cd/data.base.yaml b/docs/level-11-use-handlebars/.moban.cd/data.base.yaml index 2c16d47a..3a35fadb 100644 --- a/docs/level-11-use-handlebars/.moban.cd/data.base.yaml +++ b/docs/level-11-use-handlebars/.moban.cd/data.base.yaml @@ -1,2 +1,2 @@ nihao: shijie -hello: shijie \ No newline at end of file +hello: shijie diff --git a/docs/level-11-use-handlebars/data.yml b/docs/level-11-use-handlebars/data.yml index dc8c957d..dd77481e 100644 --- a/docs/level-11-use-handlebars/data.yml +++ b/docs/level-11-use-handlebars/data.yml @@ -1,3 +1,3 @@ overrides: data.base.yaml hello: world -no-inheritance: handlebars does not support inheritance \ No newline at end of file +no-inheritance: handlebars does not support inheritance diff --git a/docs/level-13-any-data-override-any-data/.moban.cd/parent.yaml b/docs/level-13-any-data-override-any-data/.moban.cd/parent.yaml index ff67cd90..69c9ef15 100644 --- a/docs/level-13-any-data-override-any-data/.moban.cd/parent.yaml +++ b/docs/level-13-any-data-override-any-data/.moban.cd/parent.yaml @@ -1,2 +1,2 @@ nihao: shijie from parent.yaml -hello: shijie \ No newline at end of file +hello: shijie diff --git a/docs/level-14-custom-data-loader/override_custom.yaml b/docs/level-14-custom-data-loader/override_custom.yaml index d24ae6b5..80f3b077 100644 --- a/docs/level-14-custom-data-loader/override_custom.yaml +++ b/docs/level-14-custom-data-loader/override_custom.yaml @@ -1,2 +1,2 @@ overrides: parent.custom -hello: world from override_custom.yaml \ No newline at end of file +hello: world from override_custom.yaml diff --git a/docs/level-16-group-targets-using-template-type/.moban.yml b/docs/level-16-group-targets-using-template-type/.moban.yml index 4d661b91..b5ca4d91 100644 --- a/docs/level-16-group-targets-using-template-type/.moban.yml +++ b/docs/level-16-group-targets-using-template-type/.moban.yml @@ -3,7 +3,8 @@ configuration: - template-sources targets: - copy: - - simple.file.copy: file-in-template-sources-folder.txt - - "misc-1-copying/can-create-folder/if-not-exists.txt": file-in-template-sources-folder.txt - - "test-dir": dir-for-copying - - "test-recursive-dir": dir-for-recusive-copying/** + - simple.file.copy: file-in-template-sources-folder.txt + - "misc-1-copying/can-create-folder/if-not-exists.txt": + file-in-template-sources-folder.txt + - "test-dir": dir-for-copying + - "test-recursive-dir": dir-for-recusive-copying/** diff --git a/docs/level-17-force-template-type-from-moban-file/.moban.yml b/docs/level-17-force-template-type-from-moban-file/.moban.yml index aefaa37f..68b3ea00 100644 --- a/docs/level-17-force-template-type-from-moban-file/.moban.yml +++ b/docs/level-17-force-template-type-from-moban-file/.moban.yml @@ -4,6 +4,7 @@ configuration: force_template_type: copy targets: - simple.file.copy: file-in-template-sources-folder.txt - - "misc-1-copying/can-create-folder/if-not-exists.txt": file-in-template-sources-folder.txt + - "misc-1-copying/can-create-folder/if-not-exists.txt": + file-in-template-sources-folder.txt - "test-dir": dir-for-copying - "test-recursive-dir": dir-for-recusive-copying/** diff --git a/docs/level-19-moban-a-sub-group-in-targets/.moban.yml b/docs/level-19-moban-a-sub-group-in-targets/.moban.yml index 788cf965..af8e6098 100644 --- a/docs/level-19-moban-a-sub-group-in-targets/.moban.yml +++ b/docs/level-19-moban-a-sub-group-in-targets/.moban.yml @@ -5,7 +5,8 @@ configuration: targets: - a.output: a.template.jj2 - copy: - - simple.file.copy: file-in-template-sources-folder.txt - - "misc-1-copying/can-create-folder/if-not-exists.txt": file-in-template-sources-folder.txt - - "test-dir": dir-for-copying - - "test-recursive-dir": dir-for-recusive-copying/** + - simple.file.copy: file-in-template-sources-folder.txt + - "misc-1-copying/can-create-folder/if-not-exists.txt": + file-in-template-sources-folder.txt + - "test-dir": dir-for-copying + - "test-recursive-dir": dir-for-recusive-copying/** diff --git a/docs/level-2-template-inheritance/data.yml b/docs/level-2-template-inheritance/data.yml index 0d8e794f..bb56b055 100644 --- a/docs/level-2-template-inheritance/data.yml +++ b/docs/level-2-template-inheritance/data.yml @@ -1 +1 @@ -hello: world \ No newline at end of file +hello: world diff --git a/docs/level-3-data-override/.moban.cd/data.base.yaml b/docs/level-3-data-override/.moban.cd/data.base.yaml index 2c16d47a..3a35fadb 100644 --- a/docs/level-3-data-override/.moban.cd/data.base.yaml +++ b/docs/level-3-data-override/.moban.cd/data.base.yaml @@ -1,2 +1,2 @@ nihao: shijie -hello: shijie \ No newline at end of file +hello: shijie diff --git a/docs/level-3-data-override/data.yml b/docs/level-3-data-override/data.yml index 7813e820..168bfb12 100644 --- a/docs/level-3-data-override/data.yml +++ b/docs/level-3-data-override/data.yml @@ -1,2 +1,2 @@ overrides: data.base.yaml -hello: world \ No newline at end of file +hello: world diff --git a/docs/level-5-custom-configuration/custom-config/data.base.yaml b/docs/level-5-custom-configuration/custom-config/data.base.yaml index 2c16d47a..3a35fadb 100644 --- a/docs/level-5-custom-configuration/custom-config/data.base.yaml +++ b/docs/level-5-custom-configuration/custom-config/data.base.yaml @@ -1,2 +1,2 @@ nihao: shijie -hello: shijie \ No newline at end of file +hello: shijie diff --git a/docs/level-5-custom-configuration/data.yml b/docs/level-5-custom-configuration/data.yml index 7813e820..168bfb12 100644 --- a/docs/level-5-custom-configuration/data.yml +++ b/docs/level-5-custom-configuration/data.yml @@ -1,2 +1,2 @@ overrides: data.base.yaml -hello: world \ No newline at end of file +hello: world diff --git a/docs/level-6-complex-configuration/custom-config/data.base.yaml b/docs/level-6-complex-configuration/custom-config/data.base.yaml index 2c16d47a..3a35fadb 100644 --- a/docs/level-6-complex-configuration/custom-config/data.base.yaml +++ b/docs/level-6-complex-configuration/custom-config/data.base.yaml @@ -1,2 +1,2 @@ nihao: shijie -hello: shijie \ No newline at end of file +hello: shijie diff --git a/docs/level-6-complex-configuration/data.yml b/docs/level-6-complex-configuration/data.yml index 7813e820..168bfb12 100644 --- a/docs/level-6-complex-configuration/data.yml +++ b/docs/level-6-complex-configuration/data.yml @@ -1,2 +1,2 @@ overrides: data.base.yaml -hello: world \ No newline at end of file +hello: world diff --git a/docs/level-6-complex-configuration/data2.yml b/docs/level-6-complex-configuration/data2.yml index 3653190d..e75891e6 100644 --- a/docs/level-6-complex-configuration/data2.yml +++ b/docs/level-6-complex-configuration/data2.yml @@ -1,2 +1,2 @@ overrides: data.base.yaml -hello: world2 \ No newline at end of file +hello: world2 diff --git a/docs/level-8-pass-a-folder-full-of-templates/config/level8.yml b/docs/level-8-pass-a-folder-full-of-templates/config/level8.yml index f888746d..696cde50 100644 --- a/docs/level-8-pass-a-folder-full-of-templates/config/level8.yml +++ b/docs/level-8-pass-a-folder-full-of-templates/config/level8.yml @@ -1 +1 @@ -a: "test" \ No newline at end of file +a: "test" diff --git a/docs/level-9-moban-dependency-as-pypi-package/.moban.yml b/docs/level-9-moban-dependency-as-pypi-package/.moban.yml index 1e67684f..63fbe12f 100644 --- a/docs/level-9-moban-dependency-as-pypi-package/.moban.yml +++ b/docs/level-9-moban-dependency-as-pypi-package/.moban.yml @@ -1,5 +1,5 @@ requires: - - pypi-mobans-pkg + - pypi-mobans-pkg configuration: template_dir: - "pypi-mobans-pkg:templates" diff --git a/docs/misc-1-copying-templates/.moban.yml b/docs/misc-1-copying-templates/.moban.yml index 71d8a3f2..7a895f1b 100644 --- a/docs/misc-1-copying-templates/.moban.yml +++ b/docs/misc-1-copying-templates/.moban.yml @@ -3,6 +3,7 @@ configuration: - template-sources copy: - simple.file.copy: file-in-template-sources-folder.txt - - "misc-1-copying/can-create-folder/if-not-exists.txt": file-in-template-sources-folder.txt + - "misc-1-copying/can-create-folder/if-not-exists.txt": + file-in-template-sources-folder.txt - "test-dir": dir-for-copying - "test-recursive-dir": dir-for-recusive-copying/** From fe5d2740ae8439be3f8c16faca0a5556627cb161 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 19:54:51 +0700 Subject: [PATCH 5/7] :art: lint azure yaml files --- .azure-pipelines-steps-macos.yml | 22 +++++++++++----------- .azure-pipelines-steps.yml | 22 +++++++++++----------- azure-pipelines.yml | 21 ++++++++++----------- 3 files changed, 32 insertions(+), 33 deletions(-) diff --git a/.azure-pipelines-steps-macos.yml b/.azure-pipelines-steps-macos.yml index 81734822..8958395b 100644 --- a/.azure-pipelines-steps-macos.yml +++ b/.azure-pipelines-steps-macos.yml @@ -1,12 +1,12 @@ steps: -- task: UsePythonVersion@0 - displayName: 'Use Python 3.x' -- script: | - python -m pip install --upgrade pip setuptools wheel - test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt - pip install -r requirements.txt - pip install -r tests/requirements.txt - displayName: 'Setup dependencies' -- script: | - make - displayName: 'Run tests' + - task: UsePythonVersion@0 + displayName: 'Use Python 3.x' + - script: | + python -m pip install --upgrade pip setuptools wheel + test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt + pip install -r requirements.txt + pip install -r tests/requirements.txt + displayName: 'Setup dependencies' + - script: | + make + displayName: 'Run tests' diff --git a/.azure-pipelines-steps.yml b/.azure-pipelines-steps.yml index 4fc4925e..2ef569c6 100644 --- a/.azure-pipelines-steps.yml +++ b/.azure-pipelines-steps.yml @@ -1,12 +1,12 @@ steps: -- task: UsePythonVersion@0 - displayName: 'Use Python 3.x' -- script: | - python -m pip install --upgrade pip setuptools wheel - if exist rnd_requirements.txt pip install -r rnd_requirements.txt - pip install -r requirements.txt - pip install -r tests\requirements.txt - displayName: 'Setup dependencies' -- script: | - test.bat - displayName: 'Run tests' + - task: UsePythonVersion@0 + displayName: 'Use Python 3.x' + - script: | + python -m pip install --upgrade pip setuptools wheel + if exist rnd_requirements.txt pip install -r rnd_requirements.txt + pip install -r requirements.txt + pip install -r tests\requirements.txt + displayName: 'Setup dependencies' + - script: | + test.bat + displayName: 'Run tests' diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 8bcd2991..f4f80f5a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,15 +1,14 @@ # Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. # Add steps that build, run tests, deploy, and more: # https://aka.ms/yaml jobs: -- job: 'Windows' - pool: - vmImage: vs2017-win2016 - steps: - - template: '.azure-pipelines-steps.yml' -- job: 'MacOS' - pool: - vmImage: macOS-10.13 - steps: - - template: '.azure-pipelines-steps-macos.yml' + - job: 'Windows' + pool: + vmImage: vs2017-win2016 + steps: + - template: '.azure-pipelines-steps.yml' + - job: 'MacOS' + pool: + vmImage: macOS-10.13 + steps: + - template: '.azure-pipelines-steps-macos.yml' From 0813a2266ccb7104093a427f1354df589ca6b7a3 Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 23:28:26 +0700 Subject: [PATCH 6/7] :green_heart: update isort config --- .isort.cfg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.isort.cfg b/.isort.cfg index 091b7305..d76a1394 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -1,9 +1,12 @@ [settings] line_length=79 -known_first_party=lml, jinja2, ruamel.yaml, mock, nose +# Ignore generated files +skip=setup.py, moban/__init__.py +known_first_party=lml, crayons, jinja2, ruamel.yaml, mock, nose indent=' ' multi_line_output=3 length_sort=1 +include_trailing_comma=true default_section=FIRSTPARTY no_lines_before=LOCALFOLDER sections=FUTURE,STDLIB,FIRSTPARTY,THIRDPARTY,LOCALFOLDER From 4285385843eef503f562b90f9c3dc21334b3164c Mon Sep 17 00:00:00 2001 From: John Vandenberg Date: Sat, 13 Jul 2019 21:43:47 +0700 Subject: [PATCH 7/7] :green_heart: Use updated travis template Includes yamllint --- .moban.cd/moban.yml | 3 +- .moban.d/{travis.yml => moban_travis.yml.jj2} | 0 .travis.yml | 29 ++++++++++++++----- Makefile | 6 ++++ mobanfile | 6 ++-- 5 files changed, 33 insertions(+), 11 deletions(-) rename .moban.d/{travis.yml => moban_travis.yml.jj2} (100%) diff --git a/.moban.cd/moban.yml b/.moban.cd/moban.yml index 6d06c031..95806f31 100644 --- a/.moban.cd/moban.yml +++ b/.moban.cd/moban.yml @@ -30,6 +30,7 @@ dependencies: - git-url-parse>=1.2.2 description: Yet another jinja2 cli command for static text generation scm_host: github.com -lint_command: make lint install_test format install update +lint_command: make install_test format git-diff-check lint +moban_command: make update git-diff-check setup_use_markers: true setup_use_markers_fix: true diff --git a/.moban.d/travis.yml b/.moban.d/moban_travis.yml.jj2 similarity index 100% rename from .moban.d/travis.yml rename to .moban.d/moban_travis.yml.jj2 diff --git a/.travis.yml b/.travis.yml index 4e5a12ef..4f34a3e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,3 @@ - sudo: false dist: xenial language: python @@ -19,34 +18,50 @@ env: stages: - test - lint + - moban .disable_global: &disable_global + addons: false + cache: false + env: {} + python: false before_install: false - install: true + install: false before_script: false + script: false after_success: false after_failure: false + before_deploy: false + deploy: false .lint: &lint <<: *disable_global + git: + submodules: false python: 3.6 stage: lint - install: pip install flake8 - script: make lint install_test format install update + script: make install_test format git-diff-check lint + +.moban: &moban + <<: *disable_global + python: 3.6 + stage: moban + install: pip install moban>=0.0.4 + script: make update git-diff-check jobs: include: + - *moban - *lint stage: test -script: make test - before_install: - if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then mv min_requirements.txt requirements.txt ; fi - - test ! -f rnd_requirements.txt || pip install --no-deps -r rnd_requirements.txt + - test ! -f rnd_requirements.txt || + pip install --no-deps -r rnd_requirements.txt - test ! -f rnd_requirements.txt || pip install -r rnd_requirements.txt ; - pip install -r tests/requirements.txt script: diff --git a/Makefile b/Makefile index 7deeda0c..b7e5f2c3 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,8 @@ install_test: update: moban -m mobanfile + +git-diff-check: git diff --exit-code test: @@ -16,8 +18,12 @@ test: lint: bash lint.sh yamllint -d "{extends: default, rules: {line-length: {max: 120}}}" .moban.cd/changelog.yml + yamllint -d "{extends: default, ignore: .moban.cd/changelog.yml}" . format: isort -y $(find moban -name "*.py"|xargs echo) $(find tests -name "*.py"|xargs echo) + git diff black -l 79 moban + git diff black -l 79 tests + git diff diff --git a/mobanfile b/mobanfile index a20f25a1..f82987f7 100644 --- a/mobanfile +++ b/mobanfile @@ -1,8 +1,8 @@ requires: - type: git - url: https://github.com/moremoban/pypi-mobans + url: https://github.com/jayvdb/pypi-mobans submodule: true - branch: dev + branch: use-travis-template configuration: template_dir: - "pypi-mobans:templates" @@ -13,7 +13,7 @@ targets: - moban/__init__.py: __init__.py.jj2 - moban/_version.py: _version.py.jj2 - docs/conf.py: custom_conf.py.jj2 - - .travis.yml: travis.yml + - .travis.yml: moban_travis.yml.jj2 - requirements.txt: requirements.txt.jj2 - .gitignore: moban_gitignore.jj2 - output: CHANGELOG.rst