From 102d8ca5795b26917cb89135245826cd0b631412 Mon Sep 17 00:00:00 2001 From: Insality Date: Sat, 12 Mar 2022 10:50:25 +0200 Subject: [PATCH] Update druid editor scripts to run from dependency --- ...heme.editor_script => druid.editor_script} | 25 ++++++++++++++++-- ...mponent.sh => run_python_script_on_gui.sh} | 2 +- druid/editor_scripts/setup_layers.sh | 15 ----------- manifest.private.der | Bin 0 -> 635 bytes manifest.public.der | Bin 0 -> 162 bytes 5 files changed, 24 insertions(+), 18 deletions(-) rename druid/editor_scripts/{gui_scheme.editor_script => druid.editor_script} (62%) rename druid/editor_scripts/{create_druid_component.sh => run_python_script_on_gui.sh} (90%) delete mode 100755 druid/editor_scripts/setup_layers.sh create mode 100644 manifest.private.der create mode 100644 manifest.public.der diff --git a/druid/editor_scripts/gui_scheme.editor_script b/druid/editor_scripts/druid.editor_script similarity index 62% rename from druid/editor_scripts/gui_scheme.editor_script rename to druid/editor_scripts/druid.editor_script index 3619d60..35e6944 100644 --- a/druid/editor_scripts/gui_scheme.editor_script +++ b/druid/editor_scripts/druid.editor_script @@ -9,6 +9,20 @@ local function ends_with(str, ending) end +local function save_file_from_dependency(dependency_file_path, output_file_path) + local content = editor.get(dependency_file_path, "text") + local file, err = io.open(output_file_path, "w") + if err then + print("Error:", err) + return false + end + file:write(content) + file:close() + print("Write file at", output_file_path) + return true +end + + function M.get_commands() return { { @@ -57,12 +71,15 @@ function M.get_commands() run = function(opts) local file = opts.selection print("Run script for", editor.get(file, "path")) + save_file_from_dependency('/druid/editor_scripts/run_python_script_on_gui.sh', "./build/run_python_script_on_gui.sh") + save_file_from_dependency('/druid/editor_scripts/setup_layers.py', "./build/setup_layers.py") return { { action = "shell", command = { "bash", - "./editor_scripts/setup_layers.sh", + "./build/run_python_script_on_gui.sh", + "./build/setup_layers.py", "." .. editor.get(file, "path") } } @@ -87,12 +104,16 @@ function M.get_commands() run = function(opts) local file = opts.selection print("Run script for", editor.get(file, "path")) + save_file_from_dependency('/druid/editor_scripts/run_python_script_on_gui.sh', "./build/run_python_script_on_gui.sh") + save_file_from_dependency('/druid/editor_scripts/create_druid_component.py', "./build/create_druid_component.py") + save_file_from_dependency('/druid/editor_scripts/component.lua_template', "./build/component.lua_template") return { { action = "shell", command = { "bash", - "./editor_scripts/create_druid_component.sh", + "./build/run_python_script_on_gui.sh", + "./build/create_druid_component.py", "." .. editor.get(file, "path") } } diff --git a/druid/editor_scripts/create_druid_component.sh b/druid/editor_scripts/run_python_script_on_gui.sh similarity index 90% rename from druid/editor_scripts/create_druid_component.sh rename to druid/editor_scripts/run_python_script_on_gui.sh index 56e44f1..f76c34d 100644 --- a/druid/editor_scripts/create_druid_component.sh +++ b/druid/editor_scripts/run_python_script_on_gui.sh @@ -12,4 +12,4 @@ if [ -z "$is_defree_installed" ]; then exit 0 fi -python3 $DIR/create_druid_component.py $@ +python3 $1 $2 diff --git a/druid/editor_scripts/setup_layers.sh b/druid/editor_scripts/setup_layers.sh deleted file mode 100755 index 96a4617..0000000 --- a/druid/editor_scripts/setup_layers.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash -# @license MIT, Insality 2021 -# @source https://github.com/Insality/druid - -echo "Run bash for $1" -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" - -is_defree_installed=$(pip3 list --disable-pip-version-check | grep -E "deftree") -if [ -z "$is_defree_installed" ]; then - echo "The python deftree is not installed. Please install it via" - echo "pip3 install deftree" - exit 0 -fi - -python3 $DIR/setup_layers.py $@ diff --git a/manifest.private.der b/manifest.private.der new file mode 100644 index 0000000000000000000000000000000000000000..73a06b0a7dd6de7cc3d8ce38e5038891583e389d GIT binary patch literal 635 zcmV->0)+iAf&zB}0RS)!1_>&LNQUpVK9OMT>=3B0)c@5lUYJN$Z$dZ zg7Wu!)4p!LDZu;;y`uU8OMl8LB{V(9 zN^NPpNAK0@i!mqiwi&|z0s{d60Rn-52z4~8THu9YFAb5H9@aOk9AI*y0YOgB=`E~T z7UO~mTUg7y4Y}Dkw1E4c;{g3TwI|ifY=HuD|iR?K)0y;aMK&Rsa2)1!0=?FF=Jb^ngc*Y#3;c0*%6=U?qd$|^fy-QUJbnG{;32-K zmwhy9wWHMO?xNx_@5B2vIn<(*cVeFN807*%0J9PT2ioInr#)&Q2Sby)UdZ#@{WsI1 zOnR4|TMZB}t4BG^(a{huTwWQ`#0rn>q={l<9MAE)(@xiR_Js8}@d7}44|)5?>P+8m zj9y7Pa_e?l0>5QC@2G_4sD4(OfJDXhDN4k1QiQ2owoV8L^oZNnVH#a2iT~`ofQoOE_K>B!>X VglYE(d8PIW3N`|S5GCVYpq=sSFT4N% literal 0 HcmV?d00001 diff --git a/manifest.public.der b/manifest.public.der new file mode 100644 index 0000000000000000000000000000000000000000..ebf423a0224af84847d0cf5804c72b19186f1d88 GIT binary patch literal 162 zcmV;T0A2qufuAr91_>&LNQU8OMl8LB{V(9N^NPpNAK0@ Qi!mqiwi&|z0s{d60hWSF0ssI2 literal 0 HcmV?d00001