There are two Ruby projects I am currently working on which have both a .rvmrc
and a .ruby-version
file in their root dir. I use rvm to manage my Ruby versions in my local development environment, and have my own local .rvmrc
files in my home directory's copy of various Ruby versions, so naturally I get the rvm warning when I change directory into these projects:
You are using '.rvmrc', it requires trusting, it is slower and it is not compatible with other ruby managers, you can switch to '.ruby-version' using 'rvm rvmrc to ruby-version' or ignore this warning with 'rvm rvmrc warning ignore /home/ME/craft/ruby/rails/CLIENT/APPLICATION/.rvmrc', '.rvmrc' will continue to be the default project file in RVM 1 and RVM 2, to ignore the warning for all files run 'rvm rvmrc warning ignore all.rvmrcs'.
I felt it was odd to have both configuration dotfiles in the same project at first, and figured that it might be a historical quirk to the Ruby culture that I was unaware of (Im a less-opinionated language generalist, really). Personally I never use .rvmrc
in a project, and I work on 10-15 Ruby projects in a year, and rarely see this file in anything I work with.
The problem really arises on the 2nd of these two projects, where the .rvmrc
file has an older patch of the Ruby version than the .ruby-version
. This resulted in some complications for my local environment that I resolved, though I feel its a bit awkward. To make it worse, I fixed my environment for the (git) 'master' branch of the project, and when I switched to the latest feature branch, the .ruby-version
file was updated to yet another different patch number. So I repeated things like reinstalling bundler, reinstalling all the gems, and I choose to manually switch to this patch version. I am unsure of the 'correct' way to do the above, and this way seems to work for my environment (at the cost of duplicating gems and taking up a bit of space on my hard disk).
I am concerned as to why a project would have both these files defined, and especially concerned for a project that has differing versions/patch numbers in each file.
Is this normal? Should this be rectified by removing the .rvmrc
file from the project? Should the .rvmrc
file, at the very least, be updated to the same version and patch number as the .ruby-version
file? I instinctively feel this isnt right, but want to be aware of any sort of history regarding rvm and other methods for maintaining Ruby versions which might actually make this decision sensible. Can anyone relay the history of how such a situation might sensibly evolve, or is it just a symptom of too many cooks in the kitchen over time?
(possibly related question concerning .ruby-version
and Gemfile)
.ruby-version
(and theGemfile
if you run your app in Heroku) is the de facto standard, I see no benefit in maintaining older, incompatible file types. – Escaut.ruby-version-DD-MM-YY-SOMEOTHERMETADATA
(I forget the exact pattern), and in addition to that, it sets the wrong patch number in the new.ruby-version...
file. I could edit this manually and leave it, but then Im circumventing the auto-magic behavior of the rvm command, and that feels hacky. Plus Im making changes to files not requested by my client, and Im not sure what effect it will have on the other contractors envs. – Conveyancervm rvmrc to ruby-version
command, which produces what I described above. I also am in agreement with you, and this is what I plan to do, Im really just making sure this isnt due to some kind of established convention Im unaware of, as Ive only been developing in Ruby 2 to 3 years. – Conveyance