}
}
protected ScriptFactory newScriptFactory(Artifact artifact) throws MojoExecutionException {
try {
final ScriptFactory factory =
artifact == null ?
new ScriptFactory(this.logger,
this.classRealm,
null,
this.project.getTestClasspathElements(),
this.jrubyFork):
(JRUBY_CORE.equals(artifact.getArtifactId()) ?
new ScriptFactory(this.logger,
this.classRealm,
artifact.getFile(),
resolveJRubyStdlibArtifact(artifact).getFile(),
this.project.getTestClasspathElements(),
this.jrubyFork) :
new ScriptFactory(this.logger,
this.classRealm,
artifact.getFile(),
this.project.getTestClasspathElements(),
this.jrubyFork) );
if(libDirectory != null && libDirectory.exists()){
if(jrubyVerbose){
getLog().info("add to ruby loadpath: " + libDirectory.getAbsolutePath());
}
// add it to the load path for all scripts using that factory
factory.addSwitch("-I", libDirectory.getAbsolutePath());
}
if(rubySourceDirectory != null && rubySourceDirectory.exists()){
if(jrubyVerbose){
getLog().info("add to ruby loadpath: " + rubySourceDirectory.getAbsolutePath());
}
// add it to the load path for all scripts using that factory
factory.addSwitch("-I", rubySourceDirectory.getAbsolutePath());
}
return factory;
} catch (final DependencyResolutionRequiredException e) {
throw new MojoExecutionException("could not resolve jruby", e);
} catch (final ScriptException e) {