My latest Rails project is more or less and experiment for me to break lots of things and learn in the process. I have the latest version of Ruby specified in my gemfile:
ruby '2.2.3'
And I also have a .ruby-version
dotfile in the project, with the following contents:
2.2.3
Other than the obvious duplication, what is wrong with this? What is the purpose of both conventions? If I should only have one convention for listing my Ruby version, why should I have one (Gemfile) over the other (dotfile)?
Is it perfectly fine to have both conventions in a project?
I am going to be the only maintainer of this experimental project, and dont feel it will be an issue having to maintain this one subtle duplication. I dont intend to upgrade Ruby for this project, and if I do, I wont have an issue remembering to do it in both places. Other than this detail, I certainly avoid any such duplication in my applications' codebases.
Bundler 2.4.20+ now supports natively reading from the .ruby-version file:
ruby file: ".ruby-version"