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

Commits on Dec 3, 2016

  1. Copy the full SHA
    7a1b18a View commit details
  2. Copy the full SHA
    6eb6dcc View commit details
11 changes: 10 additions & 1 deletion truffle/src/main/java/org/jruby/truffle/core/CoreLibrary.java
Original file line number Diff line number Diff line change
@@ -838,7 +838,16 @@ private void initializeGlobalVariables() {

globals.put("$,", nilObject);
globals.put("$*", argv);
globals.put("$0", StringOperations.createString(context, StringOperations.encodeRope(context.getOptions().DISPLAYED_FILE_NAME, UTF8Encoding.INSTANCE)));

final Object dollarZeroValue;

if (context.getOptions().DISPLAYED_FILE_NAME == null) {
dollarZeroValue = nilObject;
} else {
dollarZeroValue = StringOperations.createString(context, StringOperations.encodeRope(context.getOptions().DISPLAYED_FILE_NAME, UTF8Encoding.INSTANCE));
}

globals.put("$0", dollarZeroValue);

globals.put("$DEBUG", context.getOptions().DEBUG);

Original file line number Diff line number Diff line change
@@ -46,7 +46,11 @@ public abstract static class JRubyHomeDirectoryNode extends CoreMethodNode {
@TruffleBoundary
@Specialization
public DynamicObject jrubyHomeDirectory() {
return createString(StringOperations.encodeRope(getContext().getJRubyHome(), UTF8Encoding.INSTANCE));
if (getContext().getJRubyHome() == null) {
return nil();
} else {
return createString(StringOperations.encodeRope(getContext().getJRubyHome(), UTF8Encoding.INSTANCE));
}
}

}
@@ -59,6 +63,10 @@ public abstract static class JRubyHomeDirectoryProtocolNode extends CoreMethodNo
public DynamicObject jrubyHomeDirectoryProtocol() {
String home = getContext().getJRubyHome();

if (home == null) {
return nil();
}

if (home.startsWith("uri:classloader:")) {
home = home.substring("uri:classloader:".length());

35 changes: 19 additions & 16 deletions truffle/src/main/ruby/core/post.rb
Original file line number Diff line number Diff line change
@@ -50,23 +50,26 @@ def self.const_exists?(mod, name, inherit = true)
$LOAD_PATH.push *Truffle::Boot.original_load_path

home = Truffle::Boot.jruby_home_directory_protocol
# Does not exist but it's used by rubygems to determine index where to insert gem lib directories, as a result
# paths supplied by -I will stay before gem lib directories.
$LOAD_PATH.push home + '/lib/ruby/2.3/site_ruby'

$LOAD_PATH.push home + '/lib/ruby/truffle/mri'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-strscan/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-stringio/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-complex/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-date/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-pathname/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-tempfile/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-socket/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-securerandom/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-timeout/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-webrick/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/openssl'
$LOAD_PATH.push home + '/lib/ruby/truffle/truffle'
if home
# Does not exist but it's used by rubygems to determine index where to insert gem lib directories, as a result
# paths supplied by -I will stay before gem lib directories.
$LOAD_PATH.push home + '/lib/ruby/2.3/site_ruby'

$LOAD_PATH.push home + '/lib/ruby/truffle/mri'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-strscan/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-stringio/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-complex/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-date/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-pathname/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-tempfile/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-socket/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-securerandom/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-timeout/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/rubysl/rubysl-webrick/lib'
$LOAD_PATH.push home + '/lib/ruby/truffle/openssl'
$LOAD_PATH.push home + '/lib/ruby/truffle/truffle'
end

# We defined Psych at the top level because several things depend on its name.
# Here we fix that up and put it back into Truffle.
10 changes: 6 additions & 4 deletions truffle/src/main/ruby/core/rbconfig.rb
Original file line number Diff line number Diff line change
@@ -35,10 +35,12 @@
module RbConfig
jruby_home = Truffle::Boot.jruby_home_directory

bindir = if jruby_home.end_with?('/mxbuild/ruby-zip-extracted')
File.expand_path('../../bin', jruby_home)
else
"#{jruby_home}/bin"
if jruby_home
bindir = if jruby_home.end_with?('/mxbuild/ruby-zip-extracted')
File.expand_path('../../bin', jruby_home)
else
"#{jruby_home}/bin"
end
end

CONFIG = {