from db import load_yaml from graph import Graph import os #DATA="../data/styrman-blocks.yml" #DATA="../data/test.yml" DATA_DIR="/data" def main(): # Get all YAML files in the data directory yaml_files = [f for f in os.listdir(DATA_DIR) if f.endswith(('.yaml', '.yml'))] for yaml_file in yaml_files: print(f"Processing {yaml_file}...") data = load_yaml(os.path.join(DATA_DIR, yaml_file)) graph = Graph() graph.process_blocks(data) graph.build_dot() # Use the base name of the YAML file (without extension) as the output name base_name = os.path.splitext(yaml_file)[0] dot_file = os.path.join(DATA_DIR, f"{base_name}.gv") svg_file = os.path.join(DATA_DIR, f"{base_name}.svg") graph.make_dot("svg", dot_file, svg_file) if __name__ == "__main__": main()