-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Consider enabling - (dash/hypen) in prerelease strings #3086
Comments
I had a similar thing with bundler. My Gemspec: spec.version = '0.4.9-alpha' According to Semantic Version v2, this is correct. I then created a release and tag on GitHub as Then I was surprised when I did this command:
as it then creates the release and tag:
I decided to just remove I think it'd be good to change this for You can see my example releases here. |
Just ran into this, and now I'm not sure what the correct way to version my gem is. I'm trying to follow SemVer, but RubyGems doesn't allow it. I'd also like for my version string to match the tagged and released version, as well as the version people put in their gemfiles. |
I think the fundamental challenge here is that rubygems get composed into dash separated strings from the gem name, version, and platform. This means that I'm not commenting on whether or not it will get solved, but I don't think it will be easy without changing how gems are stored on the file system and on the CDN. |
As you all have noticed, you can in fact denote prerelease versions by putting a dash in the version number. RubyGems is not able to put that dash into the filename (as described by Martin above), so the dash is always converted to source "https://rubygems.org"
gem "conjur-debify", "3.0.3-1933" That said, if you want your version string, tag, .gem filename, etc, to all be identical, you need to use In conclusion, RubyGems does allow a dash in prerelease version strings, but we cannot put that dash into the final .gem filename without any modification. |
What parameter value should I pass to |
Whoa! I used the github mobile app to quote reply and it edited your comment! Very sorry. Let me see if I can revert it. How strange! (Edit: I can’t seem to completely remove my edit but I restored the original text.) My reply: The file cannot currently have the dash, nor will Gem::Version preserve it. The goal is that dash conversions are consistent across bundler and rubygems. If you specify a gem with version 1.2.3-alpha, and then you install that gem via gem or Bundler as 1.2.3-alpha, you will get that same gem version. |
How can this version be defined? Also, how would you do When I run that in irb, I get this, which is the same as what I originally posted above and remains unresolved:
|
If you name your gem and add it to bundler in the same way, it should work regardless of how the file and version are transformed internally. I agree it's not pretty but SemVer didn't exist when rubygems adopted this pattern. |
When pre-release versions are involved
|
I don't get the same result: irb(main):008> [Gem::Version.new("1.0.4-alpha1"), Gem::Version.new("1.0.4-alpha12"), Gem::Version.new("1.0.4")].sort
=> [Gem::Version.new("1.0.4.pre.alpha1"), Gem::Version.new("1.0.4.pre.alpha12"), Gem::Version.new("1.0.4")] I think you're including irb(main):009> [Gem::Version.new("1.0.4-alpha1.gem"), Gem::Version.new("1.0.4-alpha2.gem"), Gem::Version.new("1.0.4.gem")].sort
=> [Gem::Version.new("1.0.4.gem"), Gem::Version.new("1.0.4.pre.alpha1.gem"), Gem::Version.new("1.0.4.pre.alpha2.gem")] |
That was exactly it. Thanks! I assumed erroneously that it would handle .gem in some special way (because it worked until I used it with pre-release versions). |
I'm having a problem and would like to a feature.
My current problem is:
I would like to publish prerelease versions with dashes, eg something like
1.2.0.pre-update-logo
. This appears to not be possible as of rubygems version 3.0.4:The
-
's are all replaced by.pre.
which is fairly unhelpful (except possibly the first replacement). That happens here:rubygems/lib/rubygems/version.rb
Line 221 in d8fa21e
Dashes in prerelease versions are allowed by the SemVer spec:
Note that I'm not asking about "FULL SEMVER", but only about dashes in prerelease labels
This issue is related to:
gem
Other issues:
Here are my current environment details:
I will abide by the code of conduct.
The text was updated successfully, but these errors were encountered: