Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Should I check in `.ruby-gemset` and/or `.ruby-version`?

Tags:

ruby

rvm

I've just updated RVM, and in place of the old .rvmrc, it auto-created .ruby-gemset and .ruby-version.

I've always had .rvmrc files with contents like rvm use --create default@project_name. However, .ruby-version contains the specific Ruby version I'm running rather than default. I'm hesitant to check this in.

Also, I heard someone say on a podcast that one shouldn't check in .ruby-gemset because others may have their own preferences about how to name gemsets.

When should or shouldn't I check in .ruby-gemset and/or .ruby-version?

Specifically:

  • What are some of the tradeoffs?
  • How does the type of project affect the decision (for example, applications vs gems)?
  • If they should be checked in, how does the type of project affect what should go in these files?

Citations from from the creators of tools like rvm, rbenv, etc would be appreciated in an answer.

like image 580
Nathan Long Avatar asked Apr 18 '13 15:04

Nathan Long


People also ask

What is Ruby Gemset?

Ruby on Rails Gems Gemsets A gemset is just a container you can use to keep gems separate from each other. Creating a gemset per project allows you to change gems (and gem versions) for one project without breaking all your other projects.

What does Ruby version do?

Ruby version managers (such as chruby) ensure an application uses a specific version of Ruby by looking for a . ruby-version file in the root directory of each app. The file specifies the required version of Ruby for the application and the manager automatically switches the environment to use the specified version.

What does RVM stand for Ruby?

RVM is a command-line tool which allows you to easily install, manage, and work with multiple ruby environments from interpreters to sets of gems.


1 Answers

For standard projects

Check in .ruby-version if your project depends on a ruby like ruby-2.0.0. Check in .ruby-gemset only if your team agreed on it. Add .rvmrc to .gitignore so anyone can override .ruby-* files settings with .rvmrc.

For gems

Check in .ruby-version with ruby-1.8.7 only if your project still targets ruby 1.8.7, otherwise check it in only if your gem requires it. Do not check in .ruby-gemset.

like image 196
mpapis Avatar answered Oct 05 '22 01:10

mpapis