From 47a3e33c03bdfe554e35e8c72e3d6b874064ca0f Mon Sep 17 00:00:00 2001 From: hasslesstech Date: Tue, 30 Apr 2024 19:40:26 +0300 Subject: [PATCH] =?UTF-8?q?table-generator:=20=D0=BF=D0=B5=D1=80=D0=B5?= =?UTF-8?q?=D1=80=D0=BE=D0=B1=D0=B8=D0=B2=20=D0=BA=D0=BB=D1=8E=D1=87=D0=BE?= =?UTF-8?q?=D0=B2=D1=96=20=D1=96=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=D0=B8=20=D0=B0=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82?= =?UTF-8?q?=D0=B8=D1=87=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=BF=D0=BE=D1=94=D0=B4?= =?UTF-8?q?=D0=BD=D0=B0=D0=BD=D0=BD=D1=8F=20=D1=84=D0=B0=D0=B9=D0=BB=D1=96?= =?UTF-8?q?=D0=B2=20=D0=BC=D0=BE=D0=B2=D0=BE=D1=8E=20python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/table-generator/update-activities.py | 35 +++++++++++++++++++++ utils/table-generator/update-tables.py | 36 ++++++++++++++++++++++ utils/table-generator/updater.py | 26 ++++++++++++++++ 3 files changed, 97 insertions(+) create mode 100755 utils/table-generator/update-activities.py create mode 100644 utils/table-generator/update-tables.py create mode 100644 utils/table-generator/updater.py diff --git a/utils/table-generator/update-activities.py b/utils/table-generator/update-activities.py new file mode 100755 index 0000000..0c40917 --- /dev/null +++ b/utils/table-generator/update-activities.py @@ -0,0 +1,35 @@ +#!/usr/bin/python3 + +''' +import shutil +import sys +import os +''' +import updater + +target_folder = "activities" +converter_args = "-a -nv" + +updater.process(target_folder, converter_args) + +''' +PYTHON_INTERPRETER = sys.executable + +if os.path.exists(target_folder): + shutil.rmtree(target_folder) + +os.mkdir(target_folder) +os.system(f"{PYTHON_INTERPRETER} convert.py use-cases/* {converter_args} -d {target_folder}/") + +result_file = open(f"{target_folder}.md", "w") + +try: + for i in os.listdir(target_folder): + with open(os.path.abspath(f"{target_folder}/{i}")) as f: + result_file.write(f.read()) + result_file.write("\n") +except Exception as e: + print(f"File {target_folder}/{i} has raised exception {e}") + +result_file.close() +''' diff --git a/utils/table-generator/update-tables.py b/utils/table-generator/update-tables.py new file mode 100644 index 0000000..1ed2f2c --- /dev/null +++ b/utils/table-generator/update-tables.py @@ -0,0 +1,36 @@ +#!/usr/bin/python3 + +''' +import shutil +import sys +import os +''' + +import updater + +target_folder = "tables" +converter_args = "-nv" + +updater.process(target_folder, converter_args) + +''' +PYTHON_INTERPRETER = sys.executable + +if os.path.exists(target_folder): + shutil.rmtree(target_folder) + +os.mkdir(target_folder) +os.system(f"{PYTHON_INTERPRETER} convert.py use-cases/* {converter_args} -d {target_folder}/") + +result_file = open(f"{target_folder}.md", "w") + +try: + for i in os.listdir(target_folder): + with open(os.path.abspath(f"{target_folder}/{i}")) as f: + result_file.write(f.read()) + result_file.write("\n") +except Exception as e: + print(f"File {target_folder}/{i} has raised exception {e}") + +result_file.close() +''' diff --git a/utils/table-generator/updater.py b/utils/table-generator/updater.py new file mode 100644 index 0000000..ebce34d --- /dev/null +++ b/utils/table-generator/updater.py @@ -0,0 +1,26 @@ +#!/usr/bin/python3 + +import shutil +import sys +import os + +PYTHON_INTERPRETER = sys.executable + +def process(target_folder, converter_args): + if os.path.exists(target_folder): + shutil.rmtree(target_folder) + + os.mkdir(target_folder) + os.system(f"{PYTHON_INTERPRETER} convert.py use-cases/* {converter_args} -d {target_folder}/") + + result_file = open(f"{target_folder}.md", "w") + + try: + for i in os.listdir(target_folder): + with open(os.path.abspath(f"{target_folder}/{i}")) as f: + result_file.write(f.read()) + result_file.write("\n") + except Exception as e: + print(f"File {target_folder}/{i} has raised exception {e}") + + result_file.close()