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

required_ruby_version should be mandatory #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions text/0000_require_minimal_ruby_version.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
- Feature Name: mandatory_required_ruby_version
- Start Date: 2020-04-13
- RFC PR:
- Bundler Issue:

# Summary

Calling `spec.required_ruby_version` in a gemspec should be mandatory.

# Motivation

My current problem is that many gems are not publishing their `required_ruby_version`.

This means that a Gemfile/gemspec must know what is the maximum version of a gem for a given version of Ruby, instead of bundler figuring it out for us.

It takes about one minute for the gem author to add the line. When the author doesn't, everyone that uses the gem, directly or indirectly, may have to figure out the maximum version and specify it in their own gemfiles.
marcandre marked this conversation as resolved.
Show resolved Hide resolved

Note that there is currently no good way to correct this mistake. Once it is done, the only option [is to yank the gem](https://github.com/rubygems/rubygems/issues/1506#issuecomment-188472423) which is typically not what one wants to do.
marcandre marked this conversation as resolved.
Show resolved Hide resolved

`required_ruby_version` is currently in the "Optional" section of [the spec](https://guides.rubygems.org/specification-reference/). It's not even in the "Recommended" section!

It should be mandatory and enforced.

# Guide-level explanation

Building a gem that does not specify it would fail, same as the other required fields.

# Reference-level explanation

Building a gem that does not specify it would fail, same as the other required fields.

# Drawbacks

I can not think of a single valid reason not to specify a required ruby version.
marcandre marked this conversation as resolved.
Show resolved Hide resolved

Gems that don't want to specify one can simply call `spec.required_ruby_version = '> 0'`
marcandre marked this conversation as resolved.
Show resolved Hide resolved

Only impact is potential confusion of user upgrading their rubygems and now their gem doesn't build, but error message should be obvious enough to fix in a few seconds.
marcandre marked this conversation as resolved.
Show resolved Hide resolved