@Override public void load(Ruby runtime, boolean wrap) { InputStream is = null; try { is = new BufferedInputStream(resource.inputStream(), 32768); IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, is, null, scriptName, false); // Depending on the side-effect of the load, which loads the class but does not turn it into a script. // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. if (script == null) return; script.setFileName(scriptName); runtime.loadScope(script, wrap); } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (is != null) is.close(); } catch (IOException ioE) { /* At least we tried.... */ } } } }
public static IRScope loadScriptFromFile(Ruby runtime, InputStream inStream, File resourcePath, String resourceName, boolean isAbsolute) { String name = getFilenameFromPathAndName(resourcePath, resourceName, isAbsolute); try { Class clazz = loadCompiledScriptFromClass(runtime, inStream); try { Method method = clazz.getMethod("loadIR", Ruby.class, String.class); return (IRScope)method.invoke(null, runtime, name); } catch (Exception e) { if (runtime.getDebug().isTrue()) { e.printStackTrace(); } throw runtime.newLoadError(name + " is not compiled Ruby; use java_import to load normal classes"); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (LinkageError le) { if (runtime.getDebug().isTrue()) { le.printStackTrace(); } throw runtime.newLoadError("Linkage error loading compiled script; you may need to recompile '" + name + "': " + le); } finally { try { inStream.close(); } catch (IOException ioe) { throw runtime.newIOErrorFromException(ioe); } } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = resource.getName(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { name = CompiledScriptLoader.getFilenameFromPathAndName(resource.getPath(), name, resource.isAbsolute()); runtime.loadFile(name, new LoadServiceResourceInputStream(in), wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = resource.getName(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { name = CompiledScriptLoader.getFilenameFromPathAndName(resource.getPath(), name, resource.isAbsolute()); runtime.loadFile(name, new LoadServiceResourceInputStream(in), wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }
@Override public void load(Ruby runtime, boolean wrap) { InputStream is = null; try { is = new BufferedInputStream(resource.inputStream(), 32768); IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, is, null, scriptName, false); // Depending on the side-effect of the load, which loads the class but does not turn it into a script. // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. if (script == null) return; script.setFileName(scriptName); runtime.loadScope(script, wrap); } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (is != null) is.close(); } catch (IOException ioE) { /* At least we tried.... */ } } } }
public static IRScope loadScriptFromFile(Ruby runtime, InputStream inStream, File resourcePath, String resourceName, boolean isAbsolute) { String name = getFilenameFromPathAndName(resourcePath, resourceName, isAbsolute); try { Class clazz = loadCompiledScriptFromClass(runtime, inStream); try { Method method = clazz.getMethod("loadIR", Ruby.class, String.class); return (IRScope)method.invoke(null, runtime, name); } catch (Exception e) { if (runtime.getDebug().isTrue()) { e.printStackTrace(); } throw runtime.newLoadError(name + " is not compiled Ruby; use java_import to load normal classes"); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } catch (LinkageError le) { if (runtime.getDebug().isTrue()) { le.printStackTrace(); } throw runtime.newLoadError("Linkage error loading compiled script; you may need to recompile '" + name + "': " + le); } finally { try { inStream.close(); } catch (IOException ioe) { throw runtime.newIOErrorFromException(ioe); } } }
public void load(Ruby runtime, boolean wrap) { try { Script script = CompiledScriptLoader.loadScriptFromFile(runtime, resource.getInputStream(), resource.getName()); if (script == null) { // we're depending on the side effect of the load, which loads the class but does not turn it into a script // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. return; } script.setFilename(resource.getName()); runtime.loadScript(script, wrap); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } }
public void load(Ruby runtime, boolean wrap) { try { Script script = CompiledScriptLoader.loadScriptFromFile(runtime, resource.getInputStream(), resource.getName()); if (script == null) { // we're depending on the side effect of the load, which loads the class but does not turn it into a script // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. return; } script.setFilename(resource.getName()); runtime.loadScript(script, wrap); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } }
public void load(Ruby runtime, boolean wrap) { try { IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, resource.getInputStream(), resource.getPath(), resource.getName(), resource.isAbsolute()); if (script == null) { // we're depending on the side effect of the load, which loads the class but does not turn it into a script // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. return; } script.setFileName(resource.getName()); runtime.loadScope(script, wrap); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } }
public void load(Ruby runtime, boolean wrap) { try { IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, resource.getInputStream(), resource.getPath(), resource.getName(), resource.isAbsolute()); if (script == null) { // we're depending on the side effect of the load, which loads the class but does not turn it into a script // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. return; } script.setFileName(resource.getName()); runtime.loadScope(script, wrap); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } }
Script script = CompiledScriptLoader.loadScriptFromFile(this, inputStream, filename); if (script == null) { throw new MainExitException(1, "error: .class file specified is not a compiled JRuby script");
Script script = CompiledScriptLoader.loadScriptFromFile(this, inputStream, filename); if (script == null) { throw new MainExitException(1, "error: .class file specified is not a compiled JRuby script");
IRScope script = CompiledScriptLoader.loadScriptFromFile(this, inputStream, null, filename, false); if (script == null) { throw new MainExitException(1, "error: .class file specified is not a compiled JRuby script");
IRScope script = CompiledScriptLoader.loadScriptFromFile(this, inputStream, null, filename, false); if (script == null) { throw new MainExitException(1, "error: .class file specified is not a compiled JRuby script");