If you decide to create another tool, don't hesitate to publish it here.
To lower the bar for creating scripts, not application, there are some limitation to be made ; there's a whole litterature about that. 90% is easier, 10% is a lot harder. Among goals, being able to understand, even without being a real programmer, source code of others. Librairies are not a simple thing (that's why there's quite a few way of doing it, think c/c++ vs Java vs Python, 3 ways for 3 similar languages).
Anyway, if you understand it (and security consequences of it), you can use the Groovy Classloader :
- create a sub folder for your library in "scripts/"
- inside, create groovy classes like below
- class it with code below
- publish them with your scripts
A Groovy class (scripts/myscript/Class1.groovy) :
Code:
class Class1 {
def static getText() {
"Red "
}
def static getText2 = { "panties !" }
def static showSomething = {main, str -> main.show(str) }
}
The code for calling it (scripts/myscript.groovy) :
Code:
def cl = new groovy.lang.GroovyClassLoader();
cl.addClasspath("scripts/myscript/")
def class1 = cl.loadClass("Class1")
//...
def str = class1.getText()+" "+class1.getText2()
class1.showSomething(this, str)