import org.torquebox.core.runtime.RubyRuntimeFactory;
public class TestRubyFactory {
public static Ruby createRuby() throws Exception {
RubyRuntimeFactory factory = new RubyRuntimeFactory();
if (System.getProperty( "gem.path" ) != null) {
factory.setGemPath( System.getProperty( "gem.path" ) );
} else {
factory.setGemPath( "target/rubygems" );
}
factory.setUseJRubyHomeEnvVar( false );
Ruby ruby = factory.createInstance( "test" );
ruby.evalScriptlet( "require %q(rubygems)" );
return ruby;
}