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 pre release support #205

Open
chelnak opened this issue Apr 24, 2023 · 0 comments
Open

Ruby pre release support #205

chelnak opened this issue Apr 24, 2023 · 0 comments

Comments

@chelnak
Copy link

chelnak commented Apr 24, 2023

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!

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

1 participant