Skip to content
This repository has been archived by the owner on Apr 14, 2021. It is now read-only.

Allow dev versions when creating a new gem #3415

Merged
merged 2 commits into from
Feb 18, 2015
Merged

Allow dev versions when creating a new gem #3415

merged 2 commits into from
Feb 18, 2015

Conversation

TimMoore
Copy link
Contributor

The changed behaviour is to see if the last segment in the Bundler version contains any letters, and if so, tack it on.

So with Bundler 1.9.0.dev, you get:

  spec.add_development_dependency "bundler", "~> 1.9.dev"

and with Bundler 1.8.2, you get the same as before:

  spec.add_development_dependency "bundler", "~> 1.8"

@TimMoore
Copy link
Contributor Author

This should fix the build on master.

major, minor, *etc = Bundler::VERSION.split(".")
version = [major, minor]
version << etc.last if etc.last =~ /[a-z]/i
version.join(".")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just use Gem::Version to do the work for us:

v = Gem::Version.new(Bundler::VERSION)
req = v.approximate_recommendation
req << "." << v.segments.last if v.prerelease?
req

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even better. I'll update.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... approximate_recommendation is only available with RG 2.0+. Previously, it had a different name: rubygems/rubygems@f5035c6

I could monkey patch in a method alias if it's not already defined, but it probably isn't worth it just for this. I'll use a hybrid of my original code and your change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, probably not. Sounds good!

@simi
Copy link
Member

simi commented Feb 17, 2015

probably related to #2849

@TimMoore
Copy link
Contributor Author

Yep, thanks for the pointer @simi. Not sure why that one was closed.

indirect added a commit that referenced this pull request Feb 18, 2015
Allow dev versions when creating a new gem
@indirect indirect merged commit 47fe559 into rubygems:master Feb 18, 2015
@TimMoore TimMoore deleted the new-gem-dev-version branch February 18, 2015 01:34
@coilysiren coilysiren modified the milestone: Release Archive Oct 9, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants