Skip to content

Commit

Permalink
Fixes #2751. Make RUBY_ENGINE_VERSION as companion to RUBY_ENGINE
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed Mar 24, 2015
1 parent e66cbd5 commit a7bfa0d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyGlobal.java
Expand Up @@ -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);
Expand All @@ -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));
Expand Down
9 changes: 9 additions & 0 deletions spec/jruby/compat_spec.rb
@@ -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.