Skip to content

Commit

Permalink
JRuby 1.7.x and 9.0.0.0 demand different jruby.home URI protocols.
Browse files Browse the repository at this point in the history
Closes #733
  • Loading branch information
donv committed Jun 8, 2015
1 parent 4510c8d commit 1a51842
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions assets/src/org/ruboto/JRubyAdapter.java
Expand Up @@ -211,19 +211,20 @@ public static synchronized boolean setUpJRuby(Context appContext, PrintStream ou
}

try {
String jrubyVersion = (String)
Class.forName("org.jruby.runtime.Constants", true,
scriptingContainerClass.getClassLoader())
.getDeclaredField("VERSION").get(String.class);
System.out.println("JRuby version: " + jrubyVersion);

//////////////////////////////////
//
// Set jruby.home
//

String jrubyHome = "jar:" + apkName + "!/jruby.home";

// FIXME(uwe): Remove when we stop supporting RubotoCore 0.4.7
Log.i("RUBOTO_CORE_VERSION_NAME: " + RUBOTO_CORE_VERSION_NAME);
if (RUBOTO_CORE_VERSION_NAME != null &&
(RUBOTO_CORE_VERSION_NAME.equals("0.4.7") || RUBOTO_CORE_VERSION_NAME.equals("0.4.8"))) {
jrubyHome = "file:" + apkName + "!";
}
// FIXME(uwe): Simplify when we stop support for JRuby 1.7.x
final String jrubyHome = (jrubyVersion.startsWith("9.0.0.0") ?
"jar:" : "file:") + apkName + "!/jruby.home";
// EMXIF

Log.i("Setting JRUBY_HOME: " + jrubyHome);
Expand Down Expand Up @@ -302,9 +303,6 @@ public static synchronized boolean setUpJRuby(Context appContext, PrintStream ou

runScriptlet("::RUBOTO_JAVA_PROXIES = {}");

System.out.println("JRuby version: " + Class.forName("org.jruby.runtime.Constants", true, scriptingContainerClass.getClassLoader())
.getDeclaredField("VERSION").get(String.class));

// TODO(uwe): Add a way to display startup progress.
put("$application_context", appContext.getApplicationContext());
runScriptlet("begin\n require 'environment'\nrescue LoadError => e\n puts e\nend");
Expand Down

0 comments on commit 1a51842

Please sign in to comment.