Java Code Examples for org.jruby.RubyInstanceConfig

The following examples show how to use org.jruby.RubyInstanceConfig. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: marathonv5   Source File:    License: Apache License 2.0 6 votes vote down vote up
protected Callable<Ruby> getInitRuby(final Writer out, final Writer err) {
    return new Callable<Ruby>() {
        public Ruby call() throws Exception {
            RubyInstanceConfig config = new RubyInstanceConfig();
            List<String> loadPaths = new ArrayList<String>();
            String appRubyPath = System.getProperty(PROP_APPLICATION_RUBYPATH);
            if (appRubyPath != null) {
                StringTokenizer tok = new StringTokenizer(appRubyPath, ";");
                while (tok.hasMoreTokens()) {
                    loadPaths.add(tok.nextToken().replace('/', File.separatorChar));
            config.setOutput(new PrintStream(new WriterOutputStream(out)));
            config.setError(new PrintStream(new WriterOutputStream(err)));
            Ruby interpreter = JavaEmbedUtils.initialize(loadPaths, config);
            interpreter.evalScriptlet("require 'selenium/webdriver'");
            interpreter.evalScriptlet("require 'marathon/results'");
            interpreter.evalScriptlet("require 'marathon/playback-" + framework + "'");
            return interpreter;
Example 2
Source Project: ramus   Source File:    License: GNU General Public License v3.0 5 votes vote down vote up
public JComponent createComponent() {
    JPanel panel = new JPanel();
    JPanel console = new JPanel();
    panel.setLayout(new BorderLayout());

    final JEditorPane text = new JTextPane();

    text.setMargin(new Insets(8, 8, 8, 8));
    text.setCaretColor(new Color(0xa4, 0x00, 0x00));
    text.setBackground(new Color(0xf2, 0xf2, 0xf2));
    text.setForeground(new Color(0xa4, 0x00, 0x00));
    Font font = findFont("Monospaced", Font.PLAIN, 14, new String[]{
            "Monaco", "Andale Mono"});

    JScrollPane pane = new JScrollPane();
    panel.add(pane, BorderLayout.CENTER);

    final TextAreaReadline tar = new TextAreaReadline(text,
            getString("Wellcom") + " \n\n");

    RubyInstanceConfig config = new RubyInstanceConfig() {
            //setOutput(new PrintStream(tar.getOutputStream()));
            //setError(new PrintStream(tar.getOutputStream()));
    Ruby runtime = Ruby.newInstance(config);

    return panel;
Example 3
Source Project: sc-generator   Source File:    License: Apache License 2.0 5 votes vote down vote up
public Asciidoctor asciidoctor() {
    RubyInstanceConfig rubyInstanceConfig = new RubyInstanceConfig();
    JavaEmbedUtils.initialize(Arrays.asList("META-INF/jruby.home/lib/ruby/2.0", "classpath:/gems/asciidoctor-1.5.4/lib"), rubyInstanceConfig);
    return create(this.getClass().getClassLoader());
Example 4
Source Project: asciidoctorj   Source File:    License: Apache License 2.0 4 votes vote down vote up
EnvironmentInjector(RubyInstanceConfig config) {
    this.config = config;