Exemple #1
0
def do_work_son(args):
    loader = FileSystemLoader(args.source)
    env = Environment(loader=loader, keep_trailing_newline=True)
    config = Config(get_provider(args.config))

    for file in iter_files_filter(args.source, "*{0}".format(args.ext)):
        src = file.replace(args.source, "")
        target = resolve_templated_file_path(src, config)

        render_template_to_target(
            env,
            src,
            config.to_dict(),
            os.path.join(args.destination, target),
            args.ext)
 def test_resolve_templated_file_path_with_match_returns_templated(self):
     path = "/foo/bar/is/templated/{{foo}}"
     config = Config(DictionaryProviderBackend({'foo': 'bartime'}))
     ok_(path != resolve_templated_file_path(path, config))
     ok_("/foo/bar/is/templated/bartime" ==
         resolve_templated_file_path(path, config))
 def test_resolve_templated_file_path_with_no_match_returns_self(self):
     path = "/foo/bar/is/not/templated"
     ok_(path, resolve_templated_file_path(path, None))