Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b88c6c826ab9
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7b3c0cb43317
Choose a head ref
  • 2 commits
  • 3 files changed
  • 1 contributor

Commits on Feb 17, 2015

  1. Copy the full SHA
    f5d2e64 View commit details
  2. remove is1_8 conditionals

    mkristian committed Feb 17, 2015
    Copy the full SHA
    7b3c0cb View commit details
6 changes: 2 additions & 4 deletions core/src/main/java/org/jruby/RubyClassPathVariable.java
Original file line number Diff line number Diff line change
@@ -65,14 +65,12 @@ public IRubyObject append(ThreadContext context, IRubyObject obj) {
} else {
paths = context.runtime.newArray(obj).toJavaArray();
}

boolean is1_8 = context.getRuntime().is1_8();

for (IRubyObject path: paths) {
try {
URL url = getURL(path.convertToString().toString());
if (url.getProtocol().equals("file")) {
path = is1_8 ? RubyFile.expand_path(context, null, new IRubyObject[]{ path })
: RubyFile.expand_path19(context, null, new IRubyObject[]{ path });
path = RubyFile.expand_path19(context, null, new IRubyObject[]{ path });
url = getURL(path.convertToString().toString());
}
getRuntime().getJRubyClassLoader().addURL(url);
Original file line number Diff line number Diff line change
@@ -147,9 +147,9 @@ private FoundLibrary findResourceLibrary(String baseName, String suffix) {

// FIXME: to_path should not be called n times it should only be once and that means a cache which would
// also reduce all this casting and/or string creates.
// (mkristian) would it make sense to turn $LOAD_PATH into something like RubyClassPathVariable where we could cache
// the Strings ?
private String getPath(IRubyObject loadPathEntry) {
if (runtime.is1_8()) return loadPathEntry.convertToString().asJavaString();

return RubyFile.get_path(runtime.getCurrentContext(), loadPathEntry).asJavaString();
}

Original file line number Diff line number Diff line change
@@ -93,7 +93,7 @@ public void testJRubyCreate() throws Exception {

String gemPath = (String) jruby.runScriptlet( "Gem::Specification.dirs.inspect" );
gemPath = gemPath.replaceAll( "bundle[^:]*://[^/]*", "bundle:/" );
assertEquals( gemPath, "[\"uri:bundle://specifications\", \"uri:classloader:/META-INF/jruby.home/lib/ruby/gems/shared/specifications\"]" );
assertEquals( gemPath, "[\"uri:bundle://specifications\", \"uri:classloader:/META-INF/jruby.home/lib/ruby/gems/shared/specifications\", \"uri:classloader:/specifications\"]" );

// ensure we can load rake from the default gems
boolean loaded = (Boolean) jruby.runScriptlet( "require 'rake'" );