Should I commit .rvmrc files in a project? [duplicate]
Every project of mine has a specific .rvmrc. Since my gemsets are private, I tend to add .rvmrc to .git/info/exclude. Should I add .rvmrc to .gitignore? Should I commit it to the repo? Or am I doing it right?
I think the best usage for .rvmrc is to commit it.
Others says if you work with others they can easily install gems with bundle. But it's not necessarily the exact same Ruby version they use for example. If you're using .rvmrc and you commit it and the others also use it then it ensures that all configs will be the same.
Also someone wrote he's different environments in develoment and production. This is not a good habit. Development, test and production environments should be as close to each other as possible. .rvmrc simply ensures it, no doubt.
Further more: it helps you handling more projects paralelly. Everytime you enter a folder which has an -rvmrc file if changes your Gemset. Otherwise you might forgot to change versions and may have unnecessary struggles and confused Gemsets.
Use bundler to manage dependencies (believe me it is quite easy to transfer from gemsets to bundler) and use .rvmrc (and commit it) only if you're project depends on specific ruby version/patch level.
If you commit the .rvmrc then if someone else uses your project, then they will need to have the same version of ruby and gemset setup. Otherwise, they'll get an error when the 'cd' into that directory. For that reason, I don't commit my .rvmrc.
If someone grabs your code and wants to keep the gems needed for that project separate, its pretty easy for them to create a .rvmrc and the related gemset.
I just started using .rvmrc and decided to not commit it since my server always only has one environment whereas my local dev environment always has several different configurations.
精彩评论