diff --git a/.moban.cd/moban.yml b/.moban.cd/moban.yml index 9b047c36..069534eb 100644 --- a/.moban.cd/moban.yml +++ b/.moban.cd/moban.yml @@ -6,7 +6,7 @@ contact: wangc_2011@hotmail.com license: MIT version: 0.6.6 current_version: 0.6.6 -release: 0.6.5 +release: 0.6.6 branch: master master: index command_line_interface: "moban" diff --git a/.moban.d/custom_conf.py.jj2 b/.moban.d/custom_conf.py.jj2 index 1edecbb7..e69de29b 100644 --- a/.moban.d/custom_conf.py.jj2 +++ b/.moban.d/custom_conf.py.jj2 @@ -1,3 +0,0 @@ -{% include "conf.py.jj2" %} - -master_doc = "index" diff --git a/docs/conf.py b/docs/conf.py index f6e58618..d7efe9e0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -27,7 +27,7 @@ # The short X.Y version version = '0.6.6' # The full version, including alpha/beta/rc tags -release = '0.6.5' +release = '0.6.6' # -- General configuration --------------------------------------------------- @@ -82,5 +82,4 @@ ] intersphinx_mapping.update({ }) - master_doc = "index" diff --git a/moban/core/data_loader.py b/moban/core/data_loader.py index ea45443c..e2a4e591 100644 --- a/moban/core/data_loader.py +++ b/moban/core/data_loader.py @@ -28,6 +28,7 @@ def get_data(self, file_name): def load_data(base_dir, file_name): + abs_file_path = search_file(base_dir, file_name) data = LOADER.get_data(abs_file_path) if data is not None: @@ -38,7 +39,10 @@ def load_data(base_dir, file_name): overrides = [overrides] for parent_file in overrides: file_name, key = parent_file, None - if ":" in parent_file: + results = match_fs_url(parent_file) + if results: + file_name, key = results + elif ":" in parent_file and "://" not in parent_file: file_name, key = parent_file.split(":") child_data = load_data(base_dir, file_name) if data: @@ -93,3 +97,11 @@ def search_file(base_dir, file_name): else: raise IOError(constants.ERROR_DATA_FILE_ABSENT % the_file) return the_file + + +def match_fs_url(file_name): + import re + + results = re.match("(.*://.*):(.*)", file_name) + if results: + return (results.group(1), results.group(2)) diff --git a/moban/main.py b/moban/main.py index de2b742c..ff498414 100644 --- a/moban/main.py +++ b/moban/main.py @@ -14,12 +14,19 @@ import logging.config from collections import defaultdict +from ruamel.yaml import YAML + from moban import constants, exceptions from moban.core import ENGINES, plugins, hashstore, mobanfile, data_loader from moban._version import __version__ from moban.externals import reporter, file_system from moban.program_options import OPTIONS +try: + from cStringIO import StringIO +except ImportError: + from io import StringIO + LOG = logging.getLogger() LOG_LEVEL = [logging.WARNING, logging.INFO, logging.DEBUG] @@ -173,6 +180,10 @@ def handle_moban_file(moban_file, options): act upon default moban file """ moban_file_configurations = data_loader.load_data(None, moban_file) + yaml = YAML(typ="rt") + dumped_yaml = StringIO() + yaml.dump(moban_file_configurations, dumped_yaml) + LOG.info(dumped_yaml.getvalue()) if moban_file_configurations is None: raise exceptions.MobanfileGrammarException( constants.ERROR_INVALID_MOBAN_FILE % moban_file diff --git a/mobanfile b/mobanfile index e284e011..e92673d9 100644 --- a/mobanfile +++ b/mobanfile @@ -7,7 +7,7 @@ targets: - 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 + - docs/conf.py: conf.py.jj2 - .travis.yml: moban_travis.yml.jj2 - requirements.txt: requirements.txt.jj2 - .gitignore: moban_gitignore.jj2 diff --git a/setup.py b/setup.py index d0b72f63..9fc2d682 100644 --- a/setup.py +++ b/setup.py @@ -50,7 +50,7 @@ "Yet another jinja2 cli command for static text generation" ) URL = "https://github.com/moremoban/moban" -DOWNLOAD_URL = "%s/archive/0.6.5.tar.gz" % URL +DOWNLOAD_URL = "%s/archive/0.6.6.tar.gz" % URL FILES = ["README.rst", "CONTRIBUTORS.rst", "CHANGELOG.rst"] KEYWORDS = [ "python", @@ -97,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.6.5 " + - "Find 0.6.5 in changelog for more details") +GS_COMMAND = ("gs moban v0.6.6 " + + "Find 0.6.6 in changelog for more details") NO_GS_MESSAGE = ("Automatic github release is disabled. " + "Please install gease to enable it.") UPLOAD_FAILED_MSG = ( diff --git a/tests/data_loaders/__init__.py b/tests/data_loaders/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/tests/data_loaders/test_json_loader.py b/tests/data_loaders/test_json_loader.py index c575fcc7..b8a51c0e 100644 --- a/tests/data_loaders/test_json_loader.py +++ b/tests/data_loaders/test_json_loader.py @@ -1,7 +1,7 @@ import fs.path from nose.tools import eq_ -from moban.data_loaders.json_loader import open_json +from moban.plugins.json_loader import open_json def test_open_json(): diff --git a/tests/data_loaders/test_overrides.py b/tests/data_loaders/test_overrides.py index 7bc29bef..305087c7 100644 --- a/tests/data_loaders/test_overrides.py +++ b/tests/data_loaders/test_overrides.py @@ -2,7 +2,8 @@ from nose.tools import eq_ -from moban.data_loaders.manager import load_data +from moban.main import load_engine_factory_and_engines +from moban.core.data_loader import load_data def test_overrides_a_list_of_config_files(): @@ -79,3 +80,10 @@ def test_overrides_nested_keys(): } eq_(dict(actual), expected) + + +def test_overrides_fs_url(): + load_engine_factory_and_engines() + base_dir = os.path.join("tests", "fixtures") + actual = load_data(None, os.path.join(base_dir, "override_fs_url.yaml")) + assert "requires" in actual diff --git a/tests/data_loaders/test_yaml_loader.py b/tests/data_loaders/test_yaml_loader.py index 034926f1..a56b7806 100644 --- a/tests/data_loaders/test_yaml_loader.py +++ b/tests/data_loaders/test_yaml_loader.py @@ -1,8 +1,8 @@ import fs.path from nose.tools import eq_, raises -from moban.data_loaders.yaml import open_yaml -from moban.data_loaders.manager import load_data +from moban.core.data_loader import load_data +from moban.plugins.yaml_loader import open_yaml def test_simple_yaml(): diff --git a/tests/fixtures/override_fs_url.yaml b/tests/fixtures/override_fs_url.yaml new file mode 100644 index 00000000..1c6e7745 --- /dev/null +++ b/tests/fixtures/override_fs_url.yaml @@ -0,0 +1,3 @@ +overrides: "git://github.com/moremoban/moban!/tests/fixtures/.moban.yml" +targets: + - my: test