Package org.jruby

Examples of org.jruby.RubyInstanceConfig$Argument


        return fullContext;
    }

    public synchronized void destroyInstance(Ruby instance) {
        RubyInstanceConfig config = instance.getInstanceConfig();
        String contextInfo = (String) instance.getENV().get( "TORQUEBOX_CONTEXT" );
        RuntimeContext.deregisterRuntime( instance );
        if (undisposed.remove( instance )) {
            try {
                RuntimeHelper.evalScriptlet( instance, "ActiveRecord::Base.clear_all_connections! if defined?(ActiveRecord::Base)" );
View Full Code Here


            name = "/" + name;

        // c.j script args
        String[] newArgs = new String[args.length - 1];
        System.arraycopy(args, 1, newArgs, 0, args.length - 1);
        RubyInstanceConfig config = new RubyInstanceConfig();
        config.setJRubyHome(JRUBY_HOME); // mwalker
        config.processArguments(newArgs);

        System.out.println("Arguments: ");
        for (String arg : config.getArgv())
            System.out.println(arg);

        Ruby runtime = Ruby.newInstance(config);

        System.out.println("Requiring '" + name + "'");
View Full Code Here

    private Ruby createRuntime(String root, JsonObject options) {
        Ruby runtime;
//        if (Ruby.isGlobalRuntimeReady()) {
//            runtime = Ruby.getGlobalRuntime();
//        } else {
        RubyInstanceConfig instanceConfig = new RubyInstanceConfig();
        String jrubyHome = options.getString("jruby-home", "");
        if (!jrubyHome.isEmpty()) {
            instanceConfig.setJRubyHome(jrubyHome);
        }
        Object[] argv = options.getArray("argv", new JsonArray(new String[]{})).toArray();
        instanceConfig.setArgv(Arrays.copyOf(argv, argv.length, String[].class));
//        }
        RubyArray globalLoadPaths = (RubyArray) Ruby.getGlobalRuntime().getLoadService().getLoadPath();
        List<String> loadPaths = new ArrayList<>();
        for (int i = 0; i < globalLoadPaths.size(); i++) {
            IRubyObject entry = globalLoadPaths.eltInternal(i);
            loadPaths.add(entry.asJavaString());
        }
        instanceConfig.setLoadPaths(loadPaths);

        instanceConfig.setLoader(getClassLoader());
        runtime = Ruby.newInstance(instanceConfig);
        return runtime;
    }
View Full Code Here

       
        final Collection<Ruby> runtimes = new ArrayList<Ruby>();
       
        @Override
        protected Ruby getRuntime() {
            RubyInstanceConfig config = new RubyInstanceConfig();
            config.setUpdateNativeENVEnabled(false);
            String path = new File("src/test/resources/ruby_stubs").getAbsolutePath();
            config.setLoadPaths( Collections.singletonList(path) );
           
            final Ruby runtime = Ruby.newInstance(config);
            runtimes.add(runtime);
            return runtime;
        }
View Full Code Here

      try
      {
        List<String> loadPaths = new ArrayList<String>();
        final String rubyLibDir = new File(Context.instance().limelightHome + "/ruby/lib").getCanonicalPath();
        loadPaths.add(rubyLibDir);
        RubyInstanceConfig config = new RubyInstanceConfig();
        config.setCompatVersion(CompatVersion.RUBY1_9);
        config.setObjectSpaceEnabled(true);
        ruby = JavaEmbedUtils.initialize(loadPaths, config);
        InputStream input = new ByteArrayInputStream(src.getBytes());
        ruby.runFromMain(input, Context.instance().limelightHome + "/ruby/" + getName());
      }
      catch(Exception e)
View Full Code Here

    console.validate();

    final TextAreaReadline tar = new TextAreaReadline(text, " Welcome to the JBidwatcher IRB Scripting Console \n\n");

    final Ruby runtime = Scripting.getRuntime();
    RubyInstanceConfig config = runtime.getInstanceConfig();
    config.setObjectSpaceEnabled(true);
    Scripting.setOutput(tar.getOutputStream());
    Scripting.setInput(tar.getInputStream());
    tar.hookIntoRuntime(runtime);

    t2 = new Thread() {
View Full Code Here

    //  Test for JRuby's presence
    Class.forName("org.jruby.RubyInstanceConfig", true, Thread.currentThread().getContextClassLoader());

    sOutput = new FauxOutputStream();
    sInput = new FauxInputStream();
    final RubyInstanceConfig config = new RubyInstanceConfig() {
      {
        String[] args = new String[3];
        args[0] = "--readline";
        args[1] = "--prompt-mode";
        args[2] = "default";
View Full Code Here

  /**
   * Configure a Ruby Runtime, it is needed for the warnings processor even if we are not
   * going to be running any of the scripts.
   */
  public void setUp() {
    RubyInstanceConfig config = new RubyInstanceConfig();
    config.setCompatVersion(rubyVersion);
    rubyRuntime = Ruby.newInstance(config);
    parserConfiguration = new ParserConfiguration(rubyRuntime,startLine,extraPositionInfo,inlineSource,rubyVersion);
  }
View Full Code Here

import org.jruby.javasupport.JavaEmbedUtils;

public class Main {

  public static void main(String[] args) throws Exception {  
    RubyInstanceConfig config = new RubyInstanceConfig();
    config.setArgv(args);
    Ruby runtime = JavaEmbedUtils.initialize(new ArrayList(0), config);
    String mainRubyFile  = "main";
    String runConfigFile = "run_configuration";

    ArrayList<String> config_data = new ArrayList<String>();
View Full Code Here

        IRubyObject create(Ruby runtime) ;
    }

    public RubyInstanceConfig createRuntimeConfig() {
        setupJRubyManagement();
        return initRuntimeConfig(new RubyInstanceConfig());
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyInstanceConfig$Argument

Copyright © 2018 www.massapicom. 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.