OSX : split Groovy script into multiple files -
on osx, can create executable groovy script follows:
file: somescript.groovy
#!/usr/bin/env groovy println "hello!!!!";
chmod +x ./somescript.groovy
how use same approach, split cmd-line app multiple files? (as many ruby cmd-line gems do).
i need quick light-weight, easy modify scripting, @ same time being able split files 10 or 20 classes.
if create separated logics in groovy classes (ex. utils.groovy) statics methods.
class utils{ static helloworld(){ println “hello world!" } }
then in script can write
…mylogic… helloworld() …mylogic…
groovy load automatically utils.groovy class if it’s in same dir of script
Comments
Post a Comment