From d47b6ec4a703ffadebc5ca2513351a6d3673c5f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lafortune?= Date: Mon, 13 Apr 2020 17:29:59 -0400 Subject: [PATCH 1/4] Create 0000_require_minimal_ruby_version.md Adapt from https://github.com/rubygems/rubygems/issues/3515 --- text/0000_require_minimal_ruby_version.md | 38 +++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 text/0000_require_minimal_ruby_version.md diff --git a/text/0000_require_minimal_ruby_version.md b/text/0000_require_minimal_ruby_version.md new file mode 100644 index 0000000..9b42834 --- /dev/null +++ b/text/0000_require_minimal_ruby_version.md @@ -0,0 +1,38 @@ +- Feature Name: (fill me in with a unique ident, my\_awesome\_feature) +- Start Date: (fill me in with today's date, YYYY-MM-DD) +- RFC PR: (leave this empty) +- Bundler Issue: (leave this empty) + +# 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. + +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. + +`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. + +Gems that don't want to specify one can simply call `spec.required_ruby_version = '> 0'` + +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. From 3566969223caae5093ac990fa2dfb75d0da7303f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lafortune?= Date: Mon, 13 Apr 2020 20:53:33 -0400 Subject: [PATCH 2/4] ... --- text/0000_require_minimal_ruby_version.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/text/0000_require_minimal_ruby_version.md b/text/0000_require_minimal_ruby_version.md index 9b42834..0a2f7a9 100644 --- a/text/0000_require_minimal_ruby_version.md +++ b/text/0000_require_minimal_ruby_version.md @@ -1,7 +1,7 @@ -- Feature Name: (fill me in with a unique ident, my\_awesome\_feature) -- Start Date: (fill me in with today's date, YYYY-MM-DD) -- RFC PR: (leave this empty) -- Bundler Issue: (leave this empty) +- Feature Name: mandatory_required_ruby_version +- Start Date: 2020-04-13 +- RFC PR: +- Bundler Issue: # Summary From d85507e67436bb7c170e7caf50384b74e91e8862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lafortune?= Date: Tue, 14 Apr 2020 02:35:21 -0400 Subject: [PATCH 3/4] Update 0000_require_minimal_ruby_version.md --- text/0000_require_minimal_ruby_version.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/text/0000_require_minimal_ruby_version.md b/text/0000_require_minimal_ruby_version.md index 0a2f7a9..41c50e6 100644 --- a/text/0000_require_minimal_ruby_version.md +++ b/text/0000_require_minimal_ruby_version.md @@ -15,7 +15,7 @@ This means that a Gemfile/gemspec must know what is the maximum version of a gem 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. -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. +Note that there is currently no good way to correct a forgotten `required_ruby_version`. Once the gem is published, 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. `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! @@ -33,6 +33,6 @@ Building a gem that does not specify it would fail, same as the other required f I can not think of a single valid reason not to specify a required ruby version. -Gems that don't want to specify one can simply call `spec.required_ruby_version = '> 0'` +Gem authors that refuse to decide on a particular version can always decide to circumvent the check by calling `spec.required_ruby_version = '> 0'` -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. +Potential impact is confusion/frustration of the author upgrading their rubygems and now their gem doesn't build. The error message would hopefully contain enough information for the fix to be quickly done. From 4b65b604817c2750dfa90d0c8dfdd83917f9fc5a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lafortune?= Date: Tue, 14 Apr 2020 03:25:26 -0400 Subject: [PATCH 4/4] Update 0000_require_minimal_ruby_version.md --- text/0000_require_minimal_ruby_version.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/text/0000_require_minimal_ruby_version.md b/text/0000_require_minimal_ruby_version.md index 41c50e6..6bf116a 100644 --- a/text/0000_require_minimal_ruby_version.md +++ b/text/0000_require_minimal_ruby_version.md @@ -13,7 +13,9 @@ My current problem is that many gems are not publishing their `required_ruby_ver 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. +Assuming the author has thought of what version of Ruby is the target, it takes about one minute to add the right line. If the author has not thought of that, this important concern will now be in focus. + +Currently an author may not specify it at all and everyone that uses the gem, directly or indirectly, may have to figure out the maximum version and specify it in their own gemfiles. Note that there is currently no good way to correct a forgotten `required_ruby_version`. Once the gem is published, 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.