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
44 changes: 43 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
Expand All @@ -43,6 +45,7 @@ pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
Expand Down Expand Up @@ -77,9 +80,20 @@ target/
# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don’t work, or not
# install all needed dependencies.
#Pipfile.lock

# celery beat schedule file
celerybeat-schedule

Expand Down Expand Up @@ -107,6 +121,11 @@ venv.bak/

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# VirtualEnv rules
# Virtualenv
Expand Down Expand Up @@ -238,6 +257,10 @@ flycheck_*.el
# directory configuration
.dir-locals.el

# network security
/network-security.data


# Vim rules
# Swap
[._]*.s[a-v][a-z]
Expand Down Expand Up @@ -268,6 +291,9 @@ tags
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
Expand All @@ -281,6 +307,14 @@ tags
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules

# CMake
cmake-build-*/

Expand Down Expand Up @@ -311,6 +345,9 @@ fabric.properties
# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

# SublimeText rules
# Cache files for Sublime Text
*.tmlanguage.cache
Expand Down Expand Up @@ -390,7 +427,6 @@ DerivedData/
!default.perspectivev3

# Eclipse rules

.metadata
bin/
tmp/
Expand Down Expand Up @@ -488,3 +524,9 @@ docs/level-16-group-targets-using-template-type/test-dir/
docs/level-16-group-targets-using-template-type/test-recursive-dir/
docs/level-17-force-template-type-from-moban-file/test-dir/
docs/level-17-force-template-type-from-moban-file/test-recursive-dir/
docs/level-11-use-handlebars/b.output
docs/level-14-custom-data-loader/b.output
docs/level-19-moban-a-sub-group-in-targets/test-dir/
docs/level-19-moban-a-sub-group-in-targets/test-recursive-dir/
docs/level-6-complex-configuration/a.output
docs/level-7-use-custom-jinja2-filter-test-n-global/filter.output
8 changes: 7 additions & 1 deletion .moban.cd/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
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: 27.05.2019
date: 26.05.2019
version: 0.4.4
- changes:
- action: Removed
Expand Down
7 changes: 4 additions & 3 deletions .moban.cd/moban.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ organisation: moremoban
author: C. W.
contact: wangc_2011@hotmail.com
license: MIT
version: 0.4.4
current_version: 0.4.4
release: 0.4.3
version: 0.4.5
current_version: 0.4.5
release: 0.4.5
branch: master
master: index
command_line_interface: "moban"
Expand All @@ -27,3 +27,4 @@ dependencies:
- giturlparse>=0.9.1
description: Yet another jinja2 cli command for static text generation
scm_host: github.com
lint: sh lint.sh
6 changes: 6 additions & 0 deletions .moban.d/moban_gitignore.jj2
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,10 @@ docs/level-16-group-targets-using-template-type/test-dir/
docs/level-16-group-targets-using-template-type/test-recursive-dir/
docs/level-17-force-template-type-from-moban-file/test-dir/
docs/level-17-force-template-type-from-moban-file/test-recursive-dir/
docs/level-11-use-handlebars/b.output
docs/level-14-custom-data-loader/b.output
docs/level-19-moban-a-sub-group-in-targets/test-dir/
docs/level-19-moban-a-sub-group-in-targets/test-recursive-dir/
docs/level-6-complex-configuration/a.output
docs/level-7-use-custom-jinja2-filter-test-n-global/filter.output
{% endblock %}
29 changes: 28 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

sudo: false
dist: xenial
language: python
Expand All @@ -14,8 +15,34 @@ matrix:
include:
- python: 2.7
env: MINREQ=1

stages:
- test
- lint

.disable_global: &disable_global
before_install: false
install: true
before_script: false
after_success: false
after_failure: false

.lint: &lint
<<: *disable_global
python: 3.6
stage: lint
install: pip install flake8
script: sh lint.sh

jobs:
include:
- *lint

stage: test

script: make test

before_install:
- if [[ $TRAVIS_PYTHON_VERSION == "2.6" ]]; then pip install flake8==2.6.2; fi
- if [[ -f min_requirements.txt && "$MINREQ" -eq 1 ]]; then
mv min_requirements.txt requirements.txt ;
fi
Expand Down
11 changes: 10 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
Change log
================================================================================

0.4.4 - 27.05.2019
0.4.5 - 07.07.2019
--------------------------------------------------------------------------------

Updated
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

#. `#271 <https://github.com/moremoban/moban/issues/271>`_: support git branch
change in later run.

0.4.4 - 26.05.2019
--------------------------------------------------------------------------------

Updated
Expand Down
8 changes: 4 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
# -- Project information -----------------------------------------------------

project = 'moban'
copyright = '2017-2019 Onni Software Ltd. and its contributors'
author = 'Onni Software Ltd.'
copyright = '2017-2019 Onni Software Ltd.'
author = 'C. W.'
# The short X.Y version
version = '0.4.4'
version = '0.4.5'
# The full version, including alpha/beta/rc tags
release = '0.4.3'
release = '0.4.5'

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

Expand Down
1 change: 1 addition & 0 deletions docs/level-10-moban-dependency-as-git-repo/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ The alternative syntax is::
url: https://github.com/your-git-url
submodule: true
branch: your_choice_or_default_branch_if_not_specified
reference: your_alternative_reference_but_not_used_together_with_branch
...

Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import csv

from lml.plugin import PluginInfo

from moban import constants
from lml.plugin import PluginInfo


@PluginInfo(constants.DATA_LOADER_EXTENSION, tags=["custom"])
Expand Down
1 change: 1 addition & 0 deletions lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
flake8 . --exclude=.moban.d,docs --ignore=E203,E121,E123,E126,E226,E24,E704,W503,W504
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.4.4"
__version__ = "0.4.5"
__author__ = "C. W."
1 change: 1 addition & 0 deletions moban/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
GIT_HAS_SUBMODULE = "submodule"
GIT_URL = "url"
GIT_BRANCH = "branch"
GIT_REFERENCE = "reference"
PYPI_REQUIRE = "PYPI"
PYPI_PACKAGE_NAME = "name"
REQUIRE_TYPE = "type"
Expand Down
5 changes: 1 addition & 4 deletions moban/copy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from moban import utils, constants
from lml.plugin import PluginInfo


from moban import utils
from moban import constants


@PluginInfo(
constants.TEMPLATE_ENGINE_EXTENSION, tags=[constants.TEMPLATE_COPY]
)
Expand Down
3 changes: 1 addition & 2 deletions moban/data_loaders/json_loader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import json

from lml.plugin import PluginInfo

from moban import constants
from lml.plugin import PluginInfo


@PluginInfo(constants.DATA_LOADER_EXTENSION, tags=["json"])
Expand Down
3 changes: 1 addition & 2 deletions moban/data_loaders/manager.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import os

from lml.plugin import PluginManager

from moban import utils, constants
from lml.plugin import PluginManager


class AnyDataLoader(PluginManager):
Expand Down
3 changes: 1 addition & 2 deletions moban/data_loaders/yaml.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from moban import constants
from lml.plugin import PluginInfo
from ruamel.yaml import YAML

from moban import constants


@PluginInfo(constants.DATA_LOADER_EXTENSION, tags=["yaml", "yml"])
def open_yaml(file_name):
Expand Down
8 changes: 7 additions & 1 deletion moban/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@


class GitRequire(object):
def __init__(self, git_url=None, branch=None, submodule=False):
def __init__(
self, git_url=None, branch=None, submodule=False, reference=None
):
self.git_url = git_url
self.submodule = submodule
self.branch = branch
self.reference = reference

def clone_params(self):
clone_params = {
Expand All @@ -16,13 +19,16 @@ def clone_params(self):
}
if self.branch is not None:
clone_params["branch"] = self.branch
elif self.reference is not None:
clone_params["reference"] = self.reference
return clone_params

def __eq__(self, other):
return (
self.git_url == other.git_url
and self.submodule == other.submodule
and self.branch == other.branch
and self.reference == other.reference
)

def __repr__(self):
Expand Down
3 changes: 1 addition & 2 deletions moban/jinja2/engine.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import re
from importlib import import_module

from moban import constants, exceptions
from jinja2 import Template, Environment, FileSystemLoader
from lml.loader import scan_plugins_regex
from lml.plugin import PluginInfo, PluginManager
from jinja2.exceptions import TemplateNotFound

from moban import constants, exceptions

JINJA2_LIBRARIES = "^moban_jinja2_.+$"
JINJA2_EXENSIONS = [
"moban.jinja2.filters.repr",
Expand Down
3 changes: 1 addition & 2 deletions moban/jinja2/extensions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from lml.plugin import PluginInfo

from moban import constants
from lml.plugin import PluginInfo


class JinjaFilter(PluginInfo):
Expand Down
8 changes: 3 additions & 5 deletions moban/mobanfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@
import sys
from collections import OrderedDict

from moban import plugins, reporter, constants
from lml.utils import do_import

from moban import reporter
from moban import constants
from moban import plugins
from moban.repo import git_clone
from moban.utils import merge, pip_install
from moban.mobanfile.targets import parse_targets, extract_group_targets
from moban.deprecated import deprecated
from moban.definitions import GitRequire
from moban.plugins.template import expand_template_directories
from moban.mobanfile.targets import parse_targets, extract_group_targets

try:
from urllib.parse import urlparse
Expand Down Expand Up @@ -193,6 +190,7 @@ def handle_requires(requires):
GitRequire(
git_url=require.get(constants.GIT_URL),
branch=require.get(constants.GIT_BRANCH),
reference=require.get(constants.GIT_REFERENCE),
submodule=require.get(
constants.GIT_HAS_SUBMODULE, False
),
Expand Down
Loading