Skip to content

Commit

Permalink
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyGlobal.java
Original file line number Diff line number Diff line change
@@ -128,7 +128,6 @@ public static void createGlobals(ThreadContext context, Ruby runtime) {
runtime.defineGlobalConstant("RUBY_PATCHLEVEL", patchlevel);
runtime.defineGlobalConstant("RUBY_RELEASE_DATE", release);
runtime.defineGlobalConstant("RUBY_PLATFORM", platform);
runtime.defineGlobalConstant("RUBY_ENGINE", engine);

IRubyObject description = runtime.newString(OutputStrings.getVersionString(runtime.getInstanceConfig().getCompatVersion())).freeze(context);
runtime.defineGlobalConstant("RUBY_DESCRIPTION", description);
@@ -144,6 +143,9 @@ public static void createGlobals(ThreadContext context, Ruby runtime) {
runtime.defineGlobalConstant("JRUBY_VERSION", jrubyVersion);
runtime.defineGlobalConstant("JRUBY_REVISION", jrubyRevision);

runtime.defineGlobalConstant("RUBY_ENGINE", engine);
runtime.defineGlobalConstant("RUBY_ENGINE_VERSION", jrubyVersion);

if (runtime.is2_0()) {
// needs to be a fixnum, but our revision is a sha1 hash from git
runtime.defineGlobalConstant("RUBY_REVISION", runtime.newFixnum(Constants.RUBY2_0_REVISION));
9 changes: 9 additions & 0 deletions spec/jruby/compat_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe "Cross-platform compatibility" do
it "defines RUBY_ENGINE" do
expect(defined?(RUBY_ENGINE)).to_not eq nil
end

it "defines RUBY_ENGINE_VERSION" do
expect(defined?(RUBY_ENGINE_VERSION)).to_not eq nil
end
end

0 comments on commit a7bfa0d

Please sign in to comment.