Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUBY_ENGINE_VERSION and JRUBY_VERSION return version with suffix SNAPSHOT instead of dev for a dev version #5144

Closed
bogdanvlviv opened this issue Apr 20, 2018 · 4 comments
Milestone

Comments

@bogdanvlviv
Copy link

bogdanvlviv commented Apr 20, 2018

Environment

JRuby: jruby-9.2.0.0-dev
rbenv.

Recently we patched Rails in order to create the .ruby-version compatible with MRI/JRuby by default. See issue rails/rails#32639.
We use RUBY_ENGINE_VERSION(on master branch, rails/rails@dc8a66a) and JRUBY_VERSION(on 5-2-stable branch since Rails 5.2 supports Ruby 2.2 and it doesn't support RUBY_ENGINE_VERSION, rails/rails@f2201f1) to get JRuby version in order to write it down to generated .ruby-version file.

Actual Behavior

$ echo "jruby-9.2.0.0-SNAPSHOT" > .ruby-version
$ rbenv version
rbenv: version `jruby-9.2.0.0-SNAPSHOT' is not installed (set by /path/to/repo/.ruby-version)
 (set by /path/to/repo/.ruby-version)
$ echo "jruby-9.2.0.0-dev" > .ruby-version
$ rbenv version
jruby-9.2.0.0-dev (set by /path/to/repo/.ruby-version)

The problem is RUBY_ENGINE_VERSION, JRUBY_VERSION return "9.2.0.0-SNAPSHOT" instead of "9.2.0.0-dev" under JRuby dev version.

@bogdanvlviv
Copy link
Author

Not sure, maybe it should be fixed in https://github.com/rbenv/ruby-build

@headius headius added this to the JRuby 9.2.0.0 milestone May 14, 2018
@headius
Copy link
Member

headius commented May 14, 2018

@bogdanvlviv Thanks for the report! I think this is something we should tidy up soon, but obviously it only affects head builds. We'll be putting out 9.2 within the next week (🤞) but we always want it to be easy for folks to pull and test master HEAD builds.

I pinged @mkristian about this, since I've lost track of how we do the dev vs snapshot thing...or whether we even should do the dev thing now.

@headius
Copy link
Member

headius commented May 14, 2018

@bogdanvlviv After discussing this with @mkristian it seems like this should be fixed in ruby-build. We have not used the -dev suffix for quite some time, and all our development builds will have the -SNAPSHOT prefix standard to maven builds. ruby-build is mapping the -dev suffix to a download of the -SNAPSHOT build, which will always report RUBY_ENGINE_VERSION with the -SNAPSHOT suffix.

@enebo enebo modified the milestones: JRuby 9.2.0.0, JRuby 9.2.1.0 May 24, 2018
bogdanvlviv added a commit to bogdanvlviv/rails that referenced this issue Jun 18, 2018
Since rails#30016 Rails generates `.ruby-version` file
in order to help Ruby version manager tools like `rbenv`, `rvm`
determine which Ruby version should be used for the current Rails
project.

Since rails#32649 Rails sets Ruby version to the file compatible with MRI/JRuby
by default.

Pull Request rails#31496 reports that `.ruby-version` doesn't match ruby version other
than stable version and recommends to use `ENV["RBENV_VERSION"]`, and
`ENV["rvm_ruby_string"]` in order to set correct Ruby version to the file
that `rbenv` or `rvm` can understand.
Also, there is another similar issue that reports the same case if use
JRuby jruby/jruby#5144.

Closes rails#31496, jruby/jruby#5144.
@bogdanvlviv
Copy link
Author

bogdanvlviv commented Jun 18, 2018

@headius After investigation of this issue, I've realized that it is Rails issue.
We used to RUBY_ENGINE_VERSION/JRUBY_VERSION in order to get the version of JRuby, but rbenv and rvm have a different convention of naming the latest version/rc-releases of Ruby/JRuby. In order to get consistent with these Ruby version manages names of versions we should use ENV["RBENV_VERSION"], and
ENV["rvm_ruby_string"].
It should be fixed by rails/rails#33152.

@kares kares modified the milestones: JRuby 9.2.1.0, Won't Fix Jun 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants