Fix required_ruby_version with prereleases and improve error message#2344
Conversation
07b7d9f to
1c3f022
Compare
| Object.const_set :RUBY_REVISION, @RUBY_REVISION if | ||
| defined?(@RUBY_REVISION) | ||
| Object.const_set :RUBY_DESCRIPTION, @RUBY_DESCRIPTION if | ||
| defined?(@RUBY_DESCRIPTION) |
There was a problem hiding this comment.
Sorry for the big diff in this method, this is the gotcha of this aligment style: keeping it obscures the point of commits.
a50bbc3 to
2008df2
Compare
|
I haven't had the time to think about this, and I'm not sure of it's application. I'm also not sure about how many people use trunk builds or preview builds. If it's as few as I think, most are probably capable of building/installing a gem from a specific git repo branch, so requirements don't need to be tight like a published gem. I think that made sense... While gem releases are a discrete set, trunk is a little different. In some respects, I think a requirement for trunk/head should be done in terms of the svn/revision, not whether it's dev, preview, or whatever. Either way, the message and to some respects, even |
2008df2 to
88b3ec4
Compare
|
Yeah, I see your point. But when we read the issue, we seem to all acknowledged this as a bug and expected this to work with a prerelease ( With this patch, |
|
I know, just kick the trunk guys to the curb... You're right. One thing, I dl'd a preview tarball, and, as in trunk, in RUBY_DESCRIPTION, there isn't a period between RUBY_VERSION and RUBY_PATCHLEVEL_STR. IOW, in RUBY_DESCRIPTION, I believe it's Thanks, Greg |
|
Correct, that's how I'm parsing it from |
083d1bc to
a763b2d
Compare
|
Sorry, I just saw the change in Gem.ruby_version (added period): version << ".#{RUBY_DESCRIPTION.match(/\Aruby #{RUBY_VERSION}([^ ]+) /)[1]}"Will |
|
Nice catch! Too bad that we don't test against So I tried it and I added a spec to "prove" what the behavior would be for jruby and that the current implementation would work. |
|
Actually this could break if a non mri release had minimum compatibility with a prerelease of MRI (in that case I guess |
Neither do I. Nor do I know if non mri's have previews, betas, rc's, etc, which is what the regex is picking up now?
By break, return nil? Could always or it with ""... |
|
The |
I should have been clearer. What about if it's a preview/beta/rc? I don't know myself... Maybe change Not sure if the ending period will mess things up, but I don't think so... |
|
The thing is we're not trying to match the version of jruby but the version of the compatible MRI counterpart, namely, the string between the parentheses. At least that would seem like the most reasonable behavior to me. |
|
I just looked at JRuby versions of Puma & Eventmachine, and neither seemed to have 'ruby' version requirements.
With different ruby engines, (ruby vs jruby), I don't know... Hence, LGTM... |
|
I think requiring a minimum engine version would be a separate feature that was proposed in the past, but rejected because the ecosystem was not ready yet. See #1468. |
|
Thanks for working on this and I really appreciate everyones effort sorting this out. |
|
This seems reasonable, but I really dont have enough experience with the different ruby version constants set by different implementations to be confident this will work universally. I'd like those with more relevant experience to weigh in. |
|
Yeah, I also wonder if we should add a feature request to ruby so that they expose this info and we don't have to parse |
Considering this, and looking over At present, a change to either results in changes to both the save and restore portions of the code, where using arrays would require one change. IOW, use arrays for the names of all the |
We can't really make comparison work with them, they are not documented, and they mess up prerelease comparison (since previously `2.6.0.preview2 < 2.6.0.preview2.63539` when they are really the same thing).
This reverts commit 1650306. This made sense before ruby 2.1.0, when the same patch level specification (2.0.0) would have several different releases (2.0.0-p648, 2.0.0-p647, and so on). However, since ruby 2.1.0, every minor release of ruby has a different patch level, so these docs are now misleading.
a52304d to
8fe4320
Compare
|
@bundlerbot r+ |
2344: Fix required_ruby_version with prereleases and improve error message r=hsbt a=deivid-rodriguez # Description: Fixes #2343, by making the `required_ruby_version` gemspec setting work with prereleases and shows a better error message when the check does not pass. Not sure how stable the `RUBY_DESCRIPTION` string is across ruby releases, maybe I can check the format is what we expect? ______________ # Tasks: - [x] Describe the problem / feature - [x] Write tests - [x] Write code to solve the problem - [ ] Get code review from coworkers / friends I will abide by the [code of conduct](https://github.com/rubygems/rubygems/blob/master/CODE_OF_CONDUCT.md). Co-authored-by: David Rodríguez <deivid.rodriguez@riseup.net>
Build succeeded |
* Enable Style/MethodDefParentheses in Rubocop
ruby/rubygems#2478
* Enable Style/MultilineIfThen in Rubocop
ruby/rubygems#2479
* Fix required_ruby_version with prereleases and improve error message
ruby/rubygems#2344
* Fix bundler rubygems binstub not properly looking for bundler
ruby/rubygems#2426
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Enable Style/MethodDefParentheses in Rubocop
ruby/rubygems#2478
* Enable Style/MultilineIfThen in Rubocop
ruby/rubygems#2479
* Fix required_ruby_version with prereleases and improve error message
ruby/rubygems#2344
* Fix bundler rubygems binstub not properly looking for bundler
ruby/rubygems#2426
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Enable Style/MethodDefParentheses in Rubocop
ruby/rubygems#2478
* Enable Style/MultilineIfThen in Rubocop
ruby/rubygems#2479
* Fix required_ruby_version with prereleases and improve error message
ruby/rubygems#2344
* Fix bundler rubygems binstub not properly looking for bundler
ruby/rubygems#2426
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65904 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Description:
Fixes #2343, by making the
required_ruby_versiongemspec setting work with prereleases and shows a better error message when the check does not pass.Not sure how stable the
RUBY_DESCRIPTIONstring is across ruby releases, maybe I can check the format is what we expect?Tasks:
I will abide by the code of conduct.