Update druid editor scripts to run from dependency

This commit is contained in:
Insality 2022-03-12 10:50:25 +02:00
parent e1ce982043
commit 102d8ca579
5 changed files with 24 additions and 18 deletions

View File

@ -9,6 +9,20 @@ local function ends_with(str, ending)
end 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() function M.get_commands()
return { return {
{ {
@ -57,12 +71,15 @@ function M.get_commands()
run = function(opts) run = function(opts)
local file = opts.selection local file = opts.selection
print("Run script for", editor.get(file, "path")) 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 { return {
{ {
action = "shell", action = "shell",
command = { command = {
"bash", "bash",
"./editor_scripts/setup_layers.sh", "./build/run_python_script_on_gui.sh",
"./build/setup_layers.py",
"." .. editor.get(file, "path") "." .. editor.get(file, "path")
} }
} }
@ -87,12 +104,16 @@ function M.get_commands()
run = function(opts) run = function(opts)
local file = opts.selection local file = opts.selection
print("Run script for", editor.get(file, "path")) 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 { return {
{ {
action = "shell", action = "shell",
command = { command = {
"bash", "bash",
"./editor_scripts/create_druid_component.sh", "./build/run_python_script_on_gui.sh",
"./build/create_druid_component.py",
"." .. editor.get(file, "path") "." .. editor.get(file, "path")
} }
} }

View File

@ -12,4 +12,4 @@ if [ -z "$is_defree_installed" ]; then
exit 0 exit 0
fi fi
python3 $DIR/create_druid_component.py $@ python3 $1 $2

View File

@ -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 $@

BIN
manifest.private.der Normal file

Binary file not shown.

BIN
manifest.public.der Normal file

Binary file not shown.