Allow to ignore "required_ruby_version" requirement#4109
Conversation
Unfortunately, some gems have a requirement like: ``` s.required_ruby_version = "~> 2.4" ``` In fact, this is somewhat non-sense because Ruby version is not the semantic versioning: so there are some incompatibilities even in minor release. Allowing Ruby 2.7 but denying 3.0 does not make sense. Worse, this makes it difficult to try Ruby 3.0 in the real-world applications. This changeset allows a user to ignore the "required_ruby_version" requirement by manually specifying an environment called `RUBYGEMS_IGNORE_RUBY_VERSION_REQUIREMENT`.
|
I'm 👎 on this. I don't want to maintain this code. After this, someone wants an environment variable to ignore dependency constraints for all gems, then for a single gem, then to only relax them but not ignore them, then to also ignore rubygems constraints... I don't want to open the door for this since in my opinion it's an unhealthy change. In my view, supporting this discourages people from doing the right thing: reaching out to the gem that's at fault, explaining the rationale for changing the gemspec and proposing the change upstream. If you're ignored or you are in a hurry, we already provide tools for temporarily forking gems and pointing to your own fork. To try a gem against 3.0 that does not currently support it, one should fork the gem, change the |
|
I respect your decision. But let me say my opinion. I think that I want all gems to be optimistic against future incompatibility. Only when a gem author knows that their gem is actually not compatibile with the new version of a dependency, they should use If bundler is truly pessimistic, "Minimal Version Selection" mode that golang uses looks a more reasonable approach to me. Anyway, I believe that it is a right thing to allow an end user to be optimistic. Especially, w.r.t. Ruby version, |
|
I do understand your concern @mame, anyway there's really nothing we can do about. AFAIK majority of gems are bootstrapped by ff7cc37#diff-bdf7b5b2a62792f72623e19ef3b663826eb0a4e214eee8103eb0ce24849e4e69R15 Any usage of According to your problem with testing real-world apps and by-passing this requirement. Wouldn't be enough to fake |
|
@mame I agree with you and personally prefer But IMO the best way to change this for existing gems is to properly explain the rationale to gem authors that are actually doing this, not to override bundler's and rubygems behaviour without the gem author noticing. After all, once you try this and verify it works, the gem author is going to need to change the gemspec to make support generally available anyways. Isn't that a great opportunity to motivate a change to their If you're not proposing this as a stop gap until gems add support, but as a permanent solution, then it seems like the wrong approach to me. The correct approach would be to completely forbid |
|
I understood @mame's opinion because I always frustrated the ruby version restriction of dependencies for my work in January. I also agree @deivid-rodriguez 's opinion. We should avoid the environmental variable approach. So, I have no idea to avoid this restriction smarty. |
|
I think that gems need to be updated. I can't see any other reasonable solution. |
What was the end-user or developer problem that led to this PR?
Unfortunately, some gems have a requirement like:
In fact, this is somewhat non-sense because Ruby version is not the
semantic versioning: so there are some incompatibilities even in minor
release. Allowing Ruby 2.7 but denying 3.0 does not make sense.
Worse, this makes it difficult to try Ruby 3.0 in the real-world
applications.
What is your fix for the problem, implemented in this PR?
This changeset allows a user to ignore the "required_ruby_version"
requirement by manually specifying an environment called
RUBYGEMS_IGNORE_RUBY_VERSION_REQUIREMENT.Make sure the following tasks are checked