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: 4250b906b24b
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 59c9f74f8170
Choose a head ref
  • 2 commits
  • 2 files changed
  • 1 contributor

Commits on Dec 5, 2014

  1. Copy the full SHA
    b555717 View commit details
  2. Copy the full SHA
    59c9f74 View commit details
Showing with 6 additions and 10 deletions.
  1. +2 −7 core/src/main/java/org/jruby/RubyClassPathVariable.java
  2. +4 −3 spec/java_integration/globals/classpath_spec.rb
9 changes: 2 additions & 7 deletions core/src/main/java/org/jruby/RubyClassPathVariable.java
Original file line number Diff line number Diff line change
@@ -66,15 +66,10 @@ public IRubyObject append(ThreadContext context, IRubyObject obj) {
paths = context.runtime.newArray(obj).toJavaArray();
}

boolean is1_8 = context.getRuntime().is1_8();
for (IRubyObject path: paths) {
String ss = path.convertToString().toString();
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 });
url = getURL(path.convertToString().toString());
}
URL url = getURL(ss);
getRuntime().getJRubyClassLoader().addURL(url);
} catch (MalformedURLException mue) {
throw getRuntime().newArgumentError(mue.getLocalizedMessage());
7 changes: 4 additions & 3 deletions spec/java_integration/globals/classpath_spec.rb
Original file line number Diff line number Diff line change
@@ -4,14 +4,15 @@
describe "<<" do
it "accepts an object" do
$CLASSPATH << "file"
$CLASSPATH.to_a.include?("file:#{File.expand_path('file')}").should == true
$CLASSPATH.to_a.include?("file:file").should == true
end

it "accepts an array" do
Dir.chdir(File.join(File.dirname(__FILE__), '..', '..', '..', 'lib')) do
$CLASSPATH << Dir.glob("*.jar")
($CLASSPATH.to_a.include?("file:#{File.expand_path('jruby.jar')}")).should == true
($CLASSPATH.to_a.include?("file:jruby.jar") ||
$CLASSPATH.to_a.include?("file:jruby-complete.jar") ).should == true
end
end
end
end
end