Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How Can I Specify A Minimum Ruby Version in a Gemfile?

Tags:

ruby

bundler

I know that I can specify a Ruby version in a Gemfile like so:

ruby '2.0.0'

However, instead of setting the exact Ruby version, I'd like to be able to specify a minimum Ruby version so that my scripts remain compatible with new version of Ruby.

like image 500
HappyCoder86 Avatar asked Feb 10 '15 20:02

HappyCoder86


2 Answers

You could raise an exception instead:

raise 'Ruby should be >2.0' unless RUBY_VERSION.to_f > 2.0
like image 113
Igor Hatarist Avatar answered Oct 21 '22 09:10

Igor Hatarist


Already possible since Bundler 1.12, e.g.

ruby "~> 2.3.0"

see here:

https://github.com/bundler/bundler-features/issues/119

like image 31
Cezary Baginski Avatar answered Oct 21 '22 07:10

Cezary Baginski