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

Make Gem::Specification#required_ruby_version more flexible #1263

Closed
djberg96 opened this issue May 27, 2015 · 5 comments
Closed

Make Gem::Specification#required_ruby_version more flexible #1263

djberg96 opened this issue May 27, 2015 · 5 comments

Comments

@djberg96
Copy link
Contributor

Currently the Gem::Specification#required_ruby_version allows a single string that corresponds to the ruby version, plus possible patchlevel information.

However, due to the existence of multiple Ruby implementations (JRuby, Rubinius, etc), and the various quirks of those implementations, it may be necessary to specify different minimum versions for different implementations. To wit, some of my own win32utils gems will need a later version of JRuby due to a bug in JRuby x64. So, while Ruby 1.9.3 is good enough for MRI, for JRuby some of my gems will need 9k. I'm also thinking it should be possible to mark certain implementations as unsupported.

I'm not sure how this should be implemented. My initial idea is to optionally allow required_ruby_version to accept a hash, using RUBY_ENGINE as the key, and the version as the value like so:

spec.required_ruby_version = {
  :ruby     => '>= 1.9.3',
  :jruby    => '>= 2.2.2',
  :rubinius => 'unsupported' # or perhaps just false here
}

If a string is provided instead of a hash, then simply default to the current behavior to maintain backwards compatibility.

What do you think?

@djberg96
Copy link
Contributor Author

Just a quick followup, havenwood on IRC suggested making a distinction between the ruby version and the engine version since implementations like JRuby have multiple modes on the same engine. To that end he suggested adding a separate specification called "required_ruby_engine_version". That might be the way to go.

@tenderlove
Copy link
Contributor

@djberg96 I was going to suggest that. Seems fine to me if we go with required_engine_version rather than Ruby version.

@kbrock
Copy link

kbrock commented May 28, 2015

would something like this get Nokogiri's gemspec out of hoe/Rake?

@djberg96
Copy link
Contributor Author

Ok, let's go with having the separate spec item required_ruby_engine_version (or just required_engine_version as tenderlove suggested, I guess we know it's Ruby).

@kbrock It looks like it would clean it up a bit, but not remove it entirely, since only a portion appears to deal with java. I never noticed that before, yeesh.

@djberg96
Copy link
Contributor Author

Closing since the relevant PR was rejected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants