I have a Ruby project (a Chef cookbook) that I would like to support multiple versions of Ruby on, including the aging Ruby 2.1. However, many of my dependent gems (used only for development & testing) now are placing Ruby version requirements on 2.2 or greater, making my builds fail with errors like:
$ bundle install
Resolving dependencies...
ERROR: your_gem-version requires ruby version >= 2.2.2, which is incompatible with the current version, ruby 2.1.5p273
I've already added a case statement to my Gemfile to require specific gem versions for older Ruby versions, but it's quickly growing out of control as more and more gems are specifying these Ruby version requirements.
Is there a way to get bundler to automatically rule out versions of gems that aren't supported and choose one that is?
Note: I know I can "solve" this with a Gemfile.lock file, but I'd prefer to have my Travis builds pull the latest dependencies so I can catch issues like this. And it's a Chef cookbook, so that lock file is ignored anyways; it's just for developers, and the gems I'm requiring in my Gemfile are just development tools, not runtime requirements.
ruby RUBY_VERSIONto my Gemfile (requires bundler >= 1.12). - jsmartt