Révision 2920
tmp/org.txm.ruby.core/.project (revision 2920) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>org.txm.ruby.core</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>org.eclipse.pde.ManifestBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
<buildCommand> |
|
19 |
<name>org.eclipse.pde.SchemaBuilder</name> |
|
20 |
<arguments> |
|
21 |
</arguments> |
|
22 |
</buildCommand> |
|
23 |
</buildSpec> |
|
24 |
<natures> |
|
25 |
<nature>org.eclipse.pde.PluginNature</nature> |
|
26 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
27 |
</natures> |
|
28 |
</projectDescription> |
|
0 | 29 |
tmp/org.txm.ruby.core/src/org/txm/ruby/core/RubyScriptEngine.java (revision 2920) | ||
---|---|---|
1 |
package org.txm.ruby.core; |
|
2 |
|
|
3 |
|
|
4 |
import java.io.File; |
|
5 |
import java.util.HashMap; |
|
6 |
|
|
7 |
import javax.script.ScriptEngineManager; |
|
8 |
import javax.script.ScriptException; |
|
9 |
import javax.script.SimpleBindings; |
|
10 |
|
|
11 |
import org.eclipse.core.runtime.IProgressMonitor; |
|
12 |
import org.eclipse.core.runtime.IStatus; |
|
13 |
import org.eclipse.core.runtime.Status; |
|
14 |
import org.txm.core.engines.ScriptEngine; |
|
15 |
import org.txm.utils.io.IOUtils; |
|
16 |
import org.txm.utils.logger.Log; |
|
17 |
|
|
18 |
/** |
|
19 |
* |
|
20 |
* <pre> |
|
21 |
* require 'java' |
|
22 |
|
|
23 |
puts 'Hello World!' + org.txm.Toolbox.workspace.getProjects().toString() |
|
24 |
* </pre> |
|
25 |
* |
|
26 |
* |
|
27 |
* @author mdecorde |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class RubyScriptEngine extends ScriptEngine { |
|
31 |
|
|
32 |
public RubyScriptEngine() { |
|
33 |
super("rb"); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public boolean isRunning() { |
|
38 |
return true; |
|
39 |
} |
|
40 |
|
|
41 |
@Override |
|
42 |
public boolean initialize() throws Exception { |
|
43 |
return true; |
|
44 |
} |
|
45 |
|
|
46 |
@Override |
|
47 |
public boolean start(IProgressMonitor monitor) throws Exception { |
|
48 |
return true; |
|
49 |
} |
|
50 |
|
|
51 |
@Override |
|
52 |
public boolean stop() throws Exception { |
|
53 |
return true; |
|
54 |
} |
|
55 |
|
|
56 |
@Override |
|
57 |
public IStatus executeScript(File script, HashMap<String, Object> env) { |
|
58 |
try { |
|
59 |
ScriptEngineManager manager = new ScriptEngineManager(); |
|
60 |
javax.script.ScriptEngine engine = manager.getEngineByName("jruby"); |
|
61 |
// engine.eval("puts 'Hello World!'"); |
|
62 |
SimpleBindings bindings = new SimpleBindings(); |
|
63 |
bindings.putAll(env); |
|
64 |
engine.eval(IOUtils.getText(script), bindings); |
|
65 |
} |
|
66 |
catch (Exception e) { |
|
67 |
Log.printStackTrace(e); |
|
68 |
return Status.CANCEL_STATUS; |
|
69 |
} |
|
70 |
return Status.OK_STATUS; |
|
71 |
} |
|
72 |
|
|
73 |
@Override |
|
74 |
public IStatus executeText(String str, HashMap<String, Object> env) { |
|
75 |
try { |
|
76 |
ScriptEngineManager manager = new ScriptEngineManager(); |
|
77 |
javax.script.ScriptEngine engine = manager.getEngineByName("jruby"); |
|
78 |
engine.eval(str, new SimpleBindings(env)); |
|
79 |
} |
|
80 |
catch (ScriptException e) { |
|
81 |
Log.printStackTrace(e); |
|
82 |
return Status.CANCEL_STATUS; |
|
83 |
} |
|
84 |
return Status.OK_STATUS; |
|
85 |
} |
|
86 |
|
|
87 |
public static void main(String args[]) {} |
|
88 |
} |
|
0 | 89 |
tmp/org.txm.ruby.core/src/org/txm/ruby/core/RubyPreferences.java (revision 2920) | ||
---|---|---|
1 |
package org.txm.ruby.core; |
|
2 |
|
|
3 |
import org.osgi.service.prefs.Preferences; |
|
4 |
import org.txm.core.preferences.TXMPreferences; |
|
5 |
|
|
6 |
public class RubyPreferences extends TXMPreferences { |
|
7 |
|
|
8 |
public static final String python_home = "ruby_home"; |
|
9 |
|
|
10 |
|
|
11 |
@Override |
|
12 |
public void initializeDefaultPreferences() { |
|
13 |
super.initializeDefaultPreferences(); |
|
14 |
|
|
15 |
Preferences preferences = getDefaultPreferencesNode(); |
|
16 |
|
|
17 |
} |
|
18 |
|
|
19 |
public static TXMPreferences getInstance() { |
|
20 |
return new RubyPreferences(); |
|
21 |
} |
|
22 |
} |
|
0 | 23 |
tmp/org.txm.ruby.core/build.properties (revision 2920) | ||
---|---|---|
1 |
source.. = src/ |
|
2 |
output.. = bin/ |
|
3 |
bin.includes = META-INF/,\ |
|
4 |
.,\ |
|
5 |
plugin.xml,\ |
|
6 |
lib/jruby-complete-9.2.11.1.jar |
|
0 | 7 |
tmp/org.txm.ruby.core/plugin.xml (revision 2920) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<?eclipse version="3.4"?> |
|
3 |
<plugin> |
|
4 |
<extension |
|
5 |
point="org.txm.core.engines.ScriptEngine"> |
|
6 |
<ScriptEngine |
|
7 |
class="org.txm.ruby.core.RubyScriptEngine" |
|
8 |
name="Ruby"> |
|
9 |
</ScriptEngine> |
|
10 |
<ScriptEngine |
|
11 |
class="org.txm.python.core.RubyScriptEngine" |
|
12 |
name="Ruby"> |
|
13 |
</ScriptEngine> |
|
14 |
</extension> |
|
15 |
|
|
16 |
</plugin> |
|
0 | 17 |
tmp/org.txm.ruby.core/.settings/org.eclipse.jdt.core.prefs (revision 2920) | ||
---|---|---|
1 |
eclipse.preferences.version=1 |
|
2 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled |
|
3 |
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 |
|
4 |
org.eclipse.jdt.core.compiler.compliance=1.8 |
|
5 |
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error |
|
6 |
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error |
|
7 |
org.eclipse.jdt.core.compiler.source=1.8 |
|
0 | 8 |
tmp/org.txm.ruby.core/.classpath (revision 2920) | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry exported="true" kind="lib" path="lib/jruby-complete-9.2.11.1.jar"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> |
|
5 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"> |
|
6 |
<accessrules> |
|
7 |
<accessrule kind="accessible" pattern="**"/> |
|
8 |
</accessrules> |
|
9 |
</classpathentry> |
|
10 |
<classpathentry kind="src" path="src"/> |
|
11 |
<classpathentry kind="output" path="bin"/> |
|
12 |
</classpath> |
|
0 | 13 |
tmp/org.txm.ruby.core/META-INF/MANIFEST.MF (revision 2920) | ||
---|---|---|
1 |
Manifest-Version: 1.0 |
|
2 |
Bundle-ManifestVersion: 2 |
|
3 |
Bundle-Name: org.txm.ruby.core |
|
4 |
Bundle-SymbolicName: org.txm.ruby.core;singleton:=true |
|
5 |
Bundle-Version: 1.0.0.qualifier |
|
6 |
Bundle-Vendor: textometrie.org |
|
7 |
Automatic-Module-Name: org.txm.ruby.core |
|
8 |
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 |
|
9 |
Require-Bundle: org.txm.core;bundle-version="0.8.1";visibility:=reexport |
|
10 |
Bundle-ClassPath: lib/jruby-complete-9.2.11.1.jar, |
|
11 |
. |
|
12 |
Export-Package: com.headius.backport9.buffer, |
|
13 |
com.headius.backport9.modules, |
|
14 |
com.headius.backport9.modules.impl, |
|
15 |
com.headius.backport9.platform, |
|
16 |
com.headius.backport9.stack, |
|
17 |
com.headius.backport9.stack.impl, |
|
18 |
com.headius.invokebinder, |
|
19 |
com.headius.invokebinder.transform, |
|
20 |
com.headius.options, |
|
21 |
com.headius.options.example, |
|
22 |
com.jcraft.jzlib, |
|
23 |
com.kenai.constantine, |
|
24 |
com.kenai.constantine.platform, |
|
25 |
com.kenai.jffi, |
|
26 |
com.kenai.jffi.internal, |
|
27 |
com.martiansoftware.nailgun, |
|
28 |
com.martiansoftware.nailgun.builtins, |
|
29 |
javax.annotation, |
|
30 |
javax.annotation.security, |
|
31 |
javax.annotation.sql, |
|
32 |
jnr.constants, |
|
33 |
jnr.constants.platform, |
|
34 |
jnr.constants.platform.aix, |
|
35 |
jnr.constants.platform.darwin, |
|
36 |
jnr.constants.platform.dragonflybsd, |
|
37 |
jnr.constants.platform.fake, |
|
38 |
jnr.constants.platform.freebsd, |
|
39 |
jnr.constants.platform.linux, |
|
40 |
jnr.constants.platform.openbsd, |
|
41 |
jnr.constants.platform.solaris, |
|
42 |
jnr.constants.platform.windows, |
|
43 |
jnr.enxio.channels, |
|
44 |
jnr.ffi, |
|
45 |
jnr.ffi.annotations, |
|
46 |
jnr.ffi.byref, |
|
47 |
jnr.ffi.mapper, |
|
48 |
jnr.ffi.provider, |
|
49 |
jnr.ffi.provider.converters, |
|
50 |
jnr.ffi.provider.jffi, |
|
51 |
jnr.ffi.provider.jffi.platform.aarch64.linux, |
|
52 |
jnr.ffi.provider.jffi.platform.arm.linux, |
|
53 |
jnr.ffi.provider.jffi.platform.i386.darwin, |
|
54 |
jnr.ffi.provider.jffi.platform.i386.freebsd, |
|
55 |
jnr.ffi.provider.jffi.platform.i386.linux, |
|
56 |
jnr.ffi.provider.jffi.platform.i386.openbsd, |
|
57 |
jnr.ffi.provider.jffi.platform.i386.solaris, |
|
58 |
jnr.ffi.provider.jffi.platform.i386.windows, |
|
59 |
jnr.ffi.provider.jffi.platform.mips.linux, |
|
60 |
jnr.ffi.provider.jffi.platform.mipsel.linux, |
|
61 |
jnr.ffi.provider.jffi.platform.ppc.aix, |
|
62 |
jnr.ffi.provider.jffi.platform.ppc.darwin, |
|
63 |
jnr.ffi.provider.jffi.platform.ppc.linux, |
|
64 |
jnr.ffi.provider.jffi.platform.ppc64.linux, |
|
65 |
jnr.ffi.provider.jffi.platform.ppc64le.linux, |
|
66 |
jnr.ffi.provider.jffi.platform.s390.linux, |
|
67 |
jnr.ffi.provider.jffi.platform.s390x.linux, |
|
68 |
jnr.ffi.provider.jffi.platform.sparc.solaris, |
|
69 |
jnr.ffi.provider.jffi.platform.sparcv9.linux, |
|
70 |
jnr.ffi.provider.jffi.platform.sparcv9.solaris, |
|
71 |
jnr.ffi.provider.jffi.platform.x86_64.darwin, |
|
72 |
jnr.ffi.provider.jffi.platform.x86_64.dragonfly, |
|
73 |
jnr.ffi.provider.jffi.platform.x86_64.freebsd, |
|
74 |
jnr.ffi.provider.jffi.platform.x86_64.linux, |
|
75 |
jnr.ffi.provider.jffi.platform.x86_64.openbsd, |
|
76 |
jnr.ffi.provider.jffi.platform.x86_64.solaris, |
|
77 |
jnr.ffi.provider.jffi.platform.x86_64.windows, |
|
78 |
jnr.ffi.types, |
|
79 |
jnr.ffi.util, |
|
80 |
jnr.ffi.util.ref, |
|
81 |
jnr.ffi.util.ref.internal, |
|
82 |
jnr.netdb, |
|
83 |
jnr.posix, |
|
84 |
jnr.posix.util, |
|
85 |
jnr.posix.windows, |
|
86 |
jnr.unixsocket, |
|
87 |
jnr.unixsocket.impl, |
|
88 |
org.jcodings, |
|
89 |
org.jcodings.ascii, |
|
90 |
org.jcodings.constants, |
|
91 |
org.jcodings.exception, |
|
92 |
org.jcodings.specific, |
|
93 |
org.jcodings.spi, |
|
94 |
org.jcodings.transcode, |
|
95 |
org.jcodings.transcode.specific, |
|
96 |
org.jcodings.unicode, |
|
97 |
org.jcodings.util, |
|
98 |
org.joda.time, |
|
99 |
org.joda.time.base, |
|
100 |
org.joda.time.chrono, |
|
101 |
org.joda.time.convert, |
|
102 |
org.joda.time.field, |
|
103 |
org.joda.time.format, |
|
104 |
org.joda.time.tz, |
|
105 |
org.joni, |
|
106 |
org.joni.ast, |
|
107 |
org.joni.bench, |
|
108 |
org.joni.constants, |
|
109 |
org.joni.constants.internal, |
|
110 |
org.joni.exception, |
|
111 |
org.jruby, |
|
112 |
org.jruby.anno, |
|
113 |
org.jruby.ant, |
|
114 |
org.jruby.api, |
|
115 |
org.jruby.ast, |
|
116 |
org.jruby.ast.executable, |
|
117 |
org.jruby.ast.java_signature, |
|
118 |
org.jruby.ast.types, |
|
119 |
org.jruby.ast.util, |
|
120 |
org.jruby.ast.visitor, |
|
121 |
org.jruby.common, |
|
122 |
org.jruby.compiler, |
|
123 |
org.jruby.compiler.impl, |
|
124 |
org.jruby.compiler.util, |
|
125 |
org.jruby.dirgra, |
|
126 |
org.jruby.embed, |
|
127 |
org.jruby.embed.bsf, |
|
128 |
org.jruby.embed.internal, |
|
129 |
org.jruby.embed.io, |
|
130 |
org.jruby.embed.jsr223, |
|
131 |
org.jruby.embed.osgi, |
|
132 |
org.jruby.embed.osgi.internal, |
|
133 |
org.jruby.embed.osgi.utils, |
|
134 |
org.jruby.embed.util, |
|
135 |
org.jruby.embed.variable, |
|
136 |
org.jruby.exceptions, |
|
137 |
org.jruby.ext, |
|
138 |
org.jruby.ext.api, |
|
139 |
org.jruby.ext.bigdecimal, |
|
140 |
org.jruby.ext.cgi.escape, |
|
141 |
org.jruby.ext.coverage, |
|
142 |
org.jruby.ext.date, |
|
143 |
org.jruby.ext.digest, |
|
144 |
org.jruby.ext.etc, |
|
145 |
org.jruby.ext.fcntl, |
|
146 |
org.jruby.ext.ffi, |
|
147 |
org.jruby.ext.ffi.io, |
|
148 |
org.jruby.ext.ffi.jffi, |
|
149 |
org.jruby.ext.fiber, |
|
150 |
org.jruby.ext.io.wait, |
|
151 |
org.jruby.ext.jruby, |
|
152 |
org.jruby.ext.mathn, |
|
153 |
org.jruby.ext.nkf, |
|
154 |
org.jruby.ext.pathname, |
|
155 |
org.jruby.ext.rbconfig, |
|
156 |
org.jruby.ext.ripper, |
|
157 |
org.jruby.ext.securerandom, |
|
158 |
org.jruby.ext.set, |
|
159 |
org.jruby.ext.socket, |
|
160 |
org.jruby.ext.stringio, |
|
161 |
org.jruby.ext.strscan, |
|
162 |
org.jruby.ext.tempfile, |
|
163 |
org.jruby.ext.thread, |
|
164 |
org.jruby.ext.timeout, |
|
165 |
org.jruby.ext.tracepoint, |
|
166 |
org.jruby.ext.zlib, |
|
167 |
org.jruby.gen, |
|
168 |
org.jruby.internal.runtime, |
|
169 |
org.jruby.internal.runtime.methods, |
|
170 |
org.jruby.ir, |
|
171 |
org.jruby.ir.dataflow, |
|
172 |
org.jruby.ir.dataflow.analyses, |
|
173 |
org.jruby.ir.instructions, |
|
174 |
org.jruby.ir.instructions.boxing, |
|
175 |
org.jruby.ir.instructions.defined, |
|
176 |
org.jruby.ir.instructions.specialized, |
|
177 |
org.jruby.ir.interpreter, |
|
178 |
org.jruby.ir.listeners, |
|
179 |
org.jruby.ir.operands, |
|
180 |
org.jruby.ir.passes, |
|
181 |
org.jruby.ir.persistence, |
|
182 |
org.jruby.ir.persistence.util, |
|
183 |
org.jruby.ir.representations, |
|
184 |
org.jruby.ir.runtime, |
|
185 |
org.jruby.ir.targets, |
|
186 |
org.jruby.ir.transformations.inlining, |
|
187 |
org.jruby.ir.util, |
|
188 |
org.jruby.java.addons, |
|
189 |
org.jruby.java.codegen, |
|
190 |
org.jruby.java.dispatch, |
|
191 |
org.jruby.java.invokers, |
|
192 |
org.jruby.java.proxies, |
|
193 |
org.jruby.java.util, |
|
194 |
org.jruby.javasupport, |
|
195 |
org.jruby.javasupport.binding, |
|
196 |
org.jruby.javasupport.bsf, |
|
197 |
org.jruby.javasupport.ext, |
|
198 |
org.jruby.javasupport.proxy, |
|
199 |
org.jruby.javasupport.util, |
|
200 |
org.jruby.lexer, |
|
201 |
org.jruby.lexer.yacc, |
|
202 |
org.jruby.main, |
|
203 |
org.jruby.management, |
|
204 |
org.jruby.me.qmx.jitescript, |
|
205 |
org.jruby.me.qmx.jitescript.util, |
|
206 |
org.jruby.org.objectweb.asm, |
|
207 |
org.jruby.org.objectweb.asm.commons, |
|
208 |
org.jruby.org.objectweb.asm.signature, |
|
209 |
org.jruby.org.objectweb.asm.tree, |
|
210 |
org.jruby.org.objectweb.asm.tree.analysis, |
|
211 |
org.jruby.org.objectweb.asm.util, |
|
212 |
org.jruby.parser, |
|
213 |
org.jruby.platform, |
|
214 |
org.jruby.runtime, |
|
215 |
org.jruby.runtime.backtrace, |
|
216 |
org.jruby.runtime.builtin, |
|
217 |
org.jruby.runtime.callback, |
|
218 |
org.jruby.runtime.callsite, |
|
219 |
org.jruby.runtime.component, |
|
220 |
org.jruby.runtime.encoding, |
|
221 |
org.jruby.runtime.invokedynamic, |
|
222 |
org.jruby.runtime.ivars, |
|
223 |
org.jruby.runtime.load, |
|
224 |
org.jruby.runtime.marshal, |
|
225 |
org.jruby.runtime.opto, |
|
226 |
org.jruby.runtime.profile, |
|
227 |
org.jruby.runtime.profile.builtin, |
|
228 |
org.jruby.runtime.scope, |
|
229 |
org.jruby.runtime.scopes, |
|
230 |
org.jruby.specialized, |
|
231 |
org.jruby.threading, |
|
232 |
org.jruby.util, |
|
233 |
org.jruby.util.cli, |
|
234 |
org.jruby.util.collections, |
|
235 |
org.jruby.util.func, |
|
236 |
org.jruby.util.io, |
|
237 |
org.jruby.util.log, |
|
238 |
org.jruby.util.unsafe, |
|
239 |
org.txm.ruby.core |
|
0 | 240 |
Formats disponibles : Unified diff