try {
if (SCRIPT_PATTERN.matcher(command).matches()) {
GroovyClassLoader gcl = new GroovyClassLoader();
Class clazz = gcl.parseClass(command);
Object aScript = clazz.newInstance();
Script script = (Script) aScript;
script.setParent(_parent);
$.wire(script);
script.task = $this;
script.configure();
script.global = global;
return script.run();
} else {
GroovyShell shell = getShell(runner);
shell.evaluate(command);
}
} catch (Throwable e) {