factory.addEnv("GEM_HOME", this.gemHome);
}
if (gemPath != null && !gemUseSystem){
factory.addEnv("GEM_PATH", this.gemPath);
}
Script s;
if (this.script != null && this.script.length() > 0) {
s = this.factory.newScript(this.script);
} else if (this.file != null) {
s = this.factory.newScript(this.file);
} else if (this.filename != null) {
s = this.factory.newScriptFromSearchPath( this.filename );
} else {
s = this.factory.newArguments();
}
s.addArgs(this.args);
s.addArgs(this.jrubyArgs);
if (s.isValid()) {
if(outputFile != null){
s.executeIn(launchDirectory(), outputFile);
}
else {
s.executeIn(launchDirectory());
}
} else {
getLog()
.warn(
"no arguments given. use -Dargs=... or -Djruby.script=... or -Djruby.file=...");