Examples of evalScriptlet()


Examples of org.jruby.Ruby.evalScriptlet()

    public void testVersionsDefined() throws Exception {
        factory = new RubyRuntimeFactory();
        factory.create();
        Ruby ruby = factory.createInstance( getClass().getSimpleName() );

        IRubyObject torqueboxVersion = ruby.evalScriptlet( "TorqueBox.version" );
        assertNotNull( torqueboxVersion );
        assertEquals( System.getProperty( "test.version.torquebox" ), torqueboxVersion.toString() );

        IRubyObject jbossasVersion = ruby.evalScriptlet( "TorqueBox.versions[:jbossas]" );
        assertNotNull( jbossasVersion );
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

        IRubyObject torqueboxVersion = ruby.evalScriptlet( "TorqueBox.version" );
        assertNotNull( torqueboxVersion );
        assertEquals( System.getProperty( "test.version.torquebox" ), torqueboxVersion.toString() );

        IRubyObject jbossasVersion = ruby.evalScriptlet( "TorqueBox.versions[:jbossas]" );
        assertNotNull( jbossasVersion );
        assertEquals( System.getProperty( "test.version.jbossas" ), jbossasVersion.toString() );

        IRubyObject jrubyVersion = ruby.evalScriptlet( "TorqueBox.versions[:jruby]" );
        assertNotNull( jrubyVersion );
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

        IRubyObject jbossasVersion = ruby.evalScriptlet( "TorqueBox.versions[:jbossas]" );
        assertNotNull( jbossasVersion );
        assertEquals( System.getProperty( "test.version.jbossas" ), jbossasVersion.toString() );

        IRubyObject jrubyVersion = ruby.evalScriptlet( "TorqueBox.versions[:jruby]" );
        assertNotNull( jrubyVersion );
        assertEquals( System.getProperty( "test.version.jruby" ), jrubyVersion.toString() );

    }
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

    JRubyRackInput subject = new JRubyRackInput(ruby, rackInput);
    GlobalVariables globalVariables = ruby.getGlobalVariables();
    globalVariables.set("$rack_input", subject);

    IRubyObject result =
        ruby.evalScriptlet(
            "begin; $rack_input.read; rescue IOError => e; \"rescued #{e.message}\"; end");
    assertThat(result.asJavaString()).isEqualTo("rescued fake");
  }
}
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

    Node scriptRootNode = ruby.parseEval(scriptSource, "", null, 0);
        IRubyObject rubyObject = ruby.runNormally(scriptRootNode);

    if (rubyObject instanceof RubyNil) {
      String className = findClassName(scriptRootNode);
      rubyObject = ruby.evalScriptlet("\n" + className + ".new");
    }
    // still null?
    if (rubyObject instanceof RubyNil) {
      throw new IllegalStateException("Compilation of JRuby script returned RubyNil: " + rubyObject);
    }
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

    // keep using the deprecated runNormally variant for JRuby 1.1/1.2 compatibility...
    IRubyObject rubyObject = ruby.runNormally(scriptRootNode, false);

    if (rubyObject instanceof RubyNil) {
      String className = findClassName(scriptRootNode);
      rubyObject = ruby.evalScriptlet("\n" + className + ".new");
    }
    // still null?
    if (rubyObject instanceof RubyNil) {
      throw new IllegalStateException("Compilation of JRuby script returned RubyNil: " + rubyObject);
    }
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

    tar.hookIntoRuntime(runtime);

    t2 = new Thread() {
      public void run() {
        console.setVisible(true);
        runtime.evalScriptlet("require 'irb'; require 'irb/completion'; IRB.start");
      }
    };
    t2.start();

    return console;
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

    if(JConfig.queryConfiguration("platform.path") != null) {
      loadPath.add(JConfig.queryConfiguration("platform.path"));
    }
    runtime.getLoadService().init(loadPath);

    runtime.evalScriptlet("require 'builtin/javasupport.rb'; require 'lib/jbidwatcher/utilities';");

    sRuby = runtime;
  }

  public static Object ruby(String command) {
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

      if("source_dirs".equals(parts[0].replaceAll(" ", ""))) {
        String[] source_dirs = parts[1].split(";");
        for(String s : parts[1].split(";") ){
          String d = s.replaceAll(" ", "");
          runtime.evalScriptlet( "$: << '"+d+"/'" );
        }
      }
    }
    runtime.evalScriptlet("require '" + mainRubyFile + "'");
  }
View Full Code Here

Examples of org.jruby.Ruby.evalScriptlet()

          String d = s.replaceAll(" ", "");
          runtime.evalScriptlet( "$: << '"+d+"/'" );
        }
      }
    }
    runtime.evalScriptlet("require '" + mainRubyFile + "'");
  }

  public static URL getResource(String path) {
      return Main.class.getClassLoader().getResource(path);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.