Ruby pre release support
chelnak opened this issue · comments
Hello!
When a Ruby gem version is a pre-release it generally uses a .
as the separator between major, minor, patch and the pre release info.
For example:
v1.0.0.rc.1
For more info on the expected patterns you can see https://guides.rubygems.org/patterns/#prerelease-gems.
From what I can see, NewVersion
does not accept this as valid.
Given that the function stars it will take a semver-ish string and coerce it in to a valid SemVer I would have expect the above example to work.
Would you be interested in supporting this in your library?
I’d be happy to work on a PR. I’ve not properly looked but it could be as simple as updating the versionRegex.
The following matches either . Or - in group 4.
v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?((-|\.)([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?
Edit:
This regex works
v?([0-9]+)(\.[0-9]+)?(\.[0-9]+)?((?:-|\.)([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?(\+([0-9A-Za-z\-]+(\.[0-9A-Za-z\-]+)*))?
Thank you for taking the time to maintain such a useful library!