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
8 changes: 8 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ Developer Guide

.. include:: ../CHANGELOG.rst

Migration Notes
================================================================================

.. toctree::

migration-note


Indices and tables
==================

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import base64

from moban.jinja2.extensions import JinjaFilter
from moban.plugins.jinja2.extensions import JinjaFilter


@JinjaFilter()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from moban.jinja2.extensions import jinja_global
from moban.plugins.jinja2.extensions import jinja_global

jinja_global('global', dict(hello='world'))
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from moban.jinja2.extensions import JinjaTest
from moban.plugins.jinja2.extensions import JinjaTest


@JinjaTest()
Expand Down
10 changes: 10 additions & 0 deletions docs/migration-notes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Migrate to 0.6.x
================================================================================

It has been noticed that, this version will fail to template but do a copy, in
the following situation::

targets:
index.rst: index.rst

Please note that 0.6.x changed its behavior to do a copy instead of templating.
2 changes: 1 addition & 1 deletion moban/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from moban import file_system
from moban.externals import file_system

# Template type
TEMPLATE_JINJA2 = "jinja2"
Expand Down
6 changes: 4 additions & 2 deletions moban/core/context.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import os
import copy

from moban import utils, reporter, constants, exceptions
from moban import constants, exceptions
from moban.core import utils
from moban.externals import reporter
from moban.program_options import OPTIONS
from moban.data_loaders.manager import merge, load_data
from moban.core.data_loader import merge, load_data


class Context(object):
Expand Down
5 changes: 2 additions & 3 deletions moban/data_loaders/manager.py → moban/core/data_loader.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
from collections import OrderedDict

import moban.data_loaders.yaml # noqa: F401
import moban.data_loaders.json_loader # noqa: F401
from moban import constants, file_system
from moban import constants
from lml.plugin import PluginManager
from moban.externals import file_system


class AnyDataLoader(PluginManager):
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion moban/hashstore.py → moban/core/hashstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import json
import hashlib

from moban import constants, file_system
from moban import constants
from moban.externals import file_system

PY2 = sys.version_info[0] == 2

Expand Down
8 changes: 5 additions & 3 deletions moban/core/moban_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
import logging
from collections import defaultdict

from moban import utils, reporter, constants, exceptions, file_system
from moban import constants, exceptions
from fs.errors import ResourceNotFound
from lml.plugin import PluginManager
from moban.hashstore import HASH_STORE
from moban.core import utils
from moban.externals import reporter, file_system
from moban.deprecated import deprecated_moban_path_notation
from moban.core.context import Context
from moban.core.strategy import Strategy
from moban.buffered_writer import BufferedWriter
from moban.core.hashstore import HASH_STORE
from moban.externals.buffered_writer import BufferedWriter

log = logging.getLogger(__name__)
PY3_ABOVE = sys.version_info[0] > 2
Expand Down
8 changes: 4 additions & 4 deletions moban/plugins.py → moban/core/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from lml.loader import scan_plugins_regex

BUILTIN_EXENSIONS = [
"moban.jinja2.engine",
"moban.data_loaders.yaml",
"moban.data_loaders.json_loader",
"moban.copy",
"moban.plugins.jinja2.engine",
"moban.plugins.yaml_loader",
"moban.plugins.json_loader",
"moban.plugins.copy",
]


Expand Down
3 changes: 2 additions & 1 deletion moban/utils.py → moban/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
import errno
import logging

from moban import constants, exceptions, file_system
from moban import constants, exceptions
from moban.externals import file_system

LOG = logging.getLogger(__name__)

Expand Down
4 changes: 3 additions & 1 deletion moban/deprecated/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import sys
from functools import wraps

from moban import plugins, reporter, constants, file_system
from moban import constants
from moban.core import plugins
from moban.externals import reporter, file_system
from moban.deprecated import repo
from moban.deprecated.repo import git_clone
from moban.deprecated.library import LIBRARIES
Expand Down
5 changes: 3 additions & 2 deletions moban/deprecated/repo.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import sys
import subprocess

from moban import reporter, constants, exceptions, file_system
from moban.utils import mkdir_p
from moban import constants, exceptions
from moban.externals import reporter, file_system
from moban.core.utils import mkdir_p


def git_clone(requires):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@

import fs
import fs.path
from moban import utils, file_system
from moban.core import utils
from moban.externals import file_system

PY2 = sys.version_info[0] == 2

Expand Down
File renamed without changes.
File renamed without changes.
17 changes: 5 additions & 12 deletions moban/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,12 @@
import logging.config
from collections import defaultdict

from moban import (
core,
plugins,
reporter,
constants,
mobanfile,
exceptions,
file_system,
)
from moban import core, constants, mobanfile, exceptions
from moban._version import __version__
from moban.hashstore import HASH_STORE
from moban.externals import reporter, file_system
from moban.core.hashstore import HASH_STORE
from moban.program_options import OPTIONS
from moban.data_loaders.manager import merge, load_data
from moban.core.data_loader import merge, load_data

LOG = logging.getLogger()
LOG_LEVEL = [logging.WARNING, logging.INFO, logging.DEBUG]
Expand Down Expand Up @@ -274,7 +267,7 @@ def find_default_moban_file():


def load_engine_factory_and_engines():
plugins.make_sure_all_pkg_are_loaded()
core.plugins.make_sure_all_pkg_are_loaded()


def handle_custom_variables(list_of_definitions):
Expand Down
7 changes: 4 additions & 3 deletions moban/mobanfile/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
import logging
from collections import OrderedDict

from moban import core, reporter, constants
from moban import core, constants
from lml.utils import do_import
from moban.utils import verify_the_existence_of_directories
from moban.externals import reporter
from moban.core.utils import verify_the_existence_of_directories
from moban.deprecated import handle_copy, handle_requires
from moban.core.data_loader import merge
from moban.mobanfile.targets import (
parse_targets,
extract_target,
extract_group_targets,
)
from moban.core.moban_factory import expand_template_directories
from moban.data_loaders.manager import merge

LOG = logging.getLogger(__name__)

Expand Down
5 changes: 3 additions & 2 deletions moban/mobanfile/targets.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import uuid
import logging

from moban import core, reporter, constants, exceptions
from moban.definitions import TemplateTarget
from moban import core, constants, exceptions
from moban.externals import reporter
from moban.core.definitions import TemplateTarget
from moban.mobanfile.templates import handle_template

LOG = logging.getLogger(__name__)
Expand Down
3 changes: 2 additions & 1 deletion moban/mobanfile/templates.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import logging

from moban import reporter, constants, file_system
from moban import constants
from moban.externals import reporter, file_system

LOG = logging.getLogger(__name__)

Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion moban/copy.py → moban/plugins/copy.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from moban import constants, file_system
from moban import constants
from lml.plugin import PluginInfo
from moban.externals import file_system


@PluginInfo(
Expand Down
File renamed without changes.
11 changes: 6 additions & 5 deletions moban/jinja2/engine.py → moban/plugins/jinja2/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@
from importlib import import_module

import fs.errors
from moban import constants, file_system
from moban import constants
from jinja2 import Template, Environment
from lml.loader import scan_plugins_regex
from lml.plugin import PluginInfo, PluginManager
from moban.externals import file_system
from jinja2.exceptions import TemplateNotFound

from jinja2_fsloader import FSLoader

JINJA2_LIBRARIES = "^moban_jinja2_.+$"
JINJA2_EXTENSIONS = [
"moban.jinja2.filters.repr",
"moban.jinja2.filters.github",
"moban.jinja2.filters.text",
"moban.jinja2.tests.files",
"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
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re

from moban.jinja2.extensions import JinjaFilter
from moban.plugins.jinja2.extensions import JinjaFilter

GITHUB_REF_PATTERN = "`([^`]*?#[0-9]+)`"
ISSUE = "^.*?" + GITHUB_REF_PATTERN + ".*?$"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from moban.jinja2.extensions import JinjaFilter
from moban.plugins.jinja2.extensions import JinjaFilter


@JinjaFilter()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import re

from moban.jinja2.extensions import JinjaFilter
from moban.plugins.jinja2.extensions import JinjaFilter


@JinjaFilter()
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
from os.path import isabs, isdir, exists, isfile, islink, ismount, lexists

from moban.jinja2.extensions import jinja_tests
from moban.plugins.jinja2.extensions import jinja_tests

if sys.platform == "win32":
from moban.jinja2.tests.win32 import samefile
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from moban import constants
from lml.plugin import PluginInfo
from moban.file_system import open_file
from moban.externals.file_system import open_file


@PluginInfo(constants.DATA_LOADER_EXTENSION, tags=["json"])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from moban import constants
from lml.plugin import PluginInfo
from ruamel.yaml import YAML
from moban.file_system import open_file
from moban.externals.file_system import open_file


@PluginInfo(constants.DATA_LOADER_EXTENSION, tags=["yaml", "yml"])
Expand Down
3 changes: 0 additions & 3 deletions rnd_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
https://github.com/moremoban/moban-handlebars/archive/dev.zip



Loading