开发者

How do you specify a minimum Ruby version in a gemspec?

开发者 https://www.devze.com 2023-02-11 02:52 出处:网络
I\'m writing a gemspec for a new version of a gem that will now require Ruby 1.9. Previous versions of the gem were ok with Ruby 1.8, but now 1.9 will be required. Is there a way to cause the gem inst

I'm writing a gemspec for a new version of a gem that will now require Ruby 1.9. Previous versions of the gem were ok with Ruby 1.8, but now 1.9 will be required. Is there a way to cause the gem install for this version of the gem to fail with a warning for users who 开发者_如何学Ctry to install it on Ruby 1.8?


From the RubyGems documentation:

# This gem will work with 1.8.6 or greater...
spec.required_ruby_version = '>= 1.8.6'

# Only with ruby 2.0.x
spec.required_ruby_version = '~> 2.0'


gem.required_ruby_version = '1.9.2'

Should solve your problem :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消