def make_build(args):
    """
    пройтись рекурсивно по всем каталогам
    распарсить ямл
    найти ссылки на файлы
    скпоировать файлы
    подправить ссылки
    добавить в большой ямл
    """

    output = [b"# zoo feed version 1.0\n"]

    # recursive walk in source folder
    for root, dirs, files in os.walk(args[0]):
        for f in files:
            # skip non-yaml files
            if not f.lower().endswith(".yaml"):
                continue

            # skip. files
            if f.lower().startswith("."):
                continue

            full_path = os.path.join(root, f)
            # load yaml
            data = parse_yaml(full_path)
            # process loaded yaml
            process_yaml(full_path, data, args[0], args[1])
            # save processed yaml to string
            dumped_yaml = YamlHelper.dump_to_string(data)
            output.append(dumped_yaml)

    # save to result file
    result_path = os.path.join(args[1], "feed.yaml")
    write_all(result_path, b''.join(output))
예제 #2
0
파일: zoo_compile.py 프로젝트: perldev/zoo
def make_build(args):
    """
    пройтись рекурсивно по всем каталогам
    распарсить ямл
    найти ссылки на файлы
    скпоировать файлы
    подправить ссылки
    добавить в большой ямл
    """

    output = []

    # recursive walk in source folder
    for root, dirs, files in os.walk(args.src):
        for f in files:
            # skip non-yaml files
            if not f.lower().endswith(".yaml"):
                continue

            # skip. files
            if f.lower().startswith("."):
                continue


            full_path = os.path.join(root, f)
            # load yaml
            data = parse_yaml(full_path)
            # process loaded yaml
            process_yaml(full_path, data, args.src, args.dest)
            # save processed yaml to string
            output.append(YamlHelper.dump_to_string(data))

    # save to result file
    result_path = os.path.join(args.dest, "feed.yaml")
    write_all(result_path, ''.join(output))
예제 #3
0
파일: settings.py 프로젝트: helicontech/zoo
 def format(self):
     """
     Форматирует настройки для вывода строкой как yaml.
     """
     return YamlHelper.dump_to_string(self.get_state()).decode()
예제 #4
0
 def format(self):
     """
     Форматирует настройки для вывода строкой как yaml.
     """
     return YamlHelper.dump_to_string(self.get_state()).decode()