Do you check in your rvmrc file?
Source Control Management is mainly about reproducibility: are you able to reproduce a version of a development effort based on what you have stored in your SCM?
If that .rvmrc
file is needed for any developer on your project to be able to work (with the right artifacts), then yes, you should versioned it.
As mentioned in RVM Best Practices:
No. 2 - Check your rvmrc into source control.
By checking the aforementioned rvmrc into source control along side your app, you're ensuring all users have a consistent environment when they're using rvm.
By also automating gemset installs and the like (e.g. check out the rvmrc in the rvm-site repository or the TEDxPerth repostory's rvmrc) you also make getting started as simple as changing directory.
On top of this, you can also automatically make your deployments setup your application specific environment.
Other developers can turn of use of gemsets on their RVM with:
echo rvm_ignore_gemsets_flag=1 >> ~/.rvmrc
This will make them use default gemset always.
Should I check in `.ruby-gemset` and/or `.ruby-version`?
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
.
Is it a Bad Practice to Have Both a .rvmrc and a .ruby-version in a Ruby Project?
It is a "bad practice" in that it maintains two conventions at once, which can lead to version management issues in some environments. It also makes it possible for one of the conventions to fall out of sync with the other in regards to the version of ruby used in the project. The .ruby-version
file is more conventional at this time, so it would be best to remove the .rvmrc
file and only maintain .ruby-version
.
How to get rid of RVM notice
According to the documentation:
To turn off the project specific rvmrc functionality in your $HOME/.rvmrc set:
rvm_project_rvmrc=0
I don't have a RVM instance to try it out, but I guess that's what you are looking for.
I'd also suggest to use rbenv instead of RVM, for the following reasons.
Use rvmrc or ruby-version file to set a project gemset with RVM?
If your .rvmrc
file contains custom shell code, continue using .rvmrc
as it allows you to include any shell code.
If your only aim is to switch Ruby versions, then use .ruby-version
which is supported by other Ruby version switchers such as rbenv or chruby. This file also does not require trusting as it is just the name of a Ruby version and will not be executed in any way.
If you use .ruby-version
you can include @gemset
in the file but this will not be compatible with other switchers. To maintain compatibility use the gemset name in a separate file .ruby-gemset
which is ignored by other tools (it works only together with .ruby-version
).
For example, if you have a simple .rvmrc
:
rvm use 1.9.3@my-app
It can be transformed to .ruby-version
:
1.9.3
And .ruby-gemset
:
my-app
Be sure to remove the .rvmrc
file as it takes precedence over any other project configuration files:
rm .rvmrc
How to make rvmrc file in project root folder?
It seems that there is a small mistake. Inside your .rvmrc
file add:
rvm use ruby-1.8.7-p352@gemset --create
Also you might want to change the name of your gemset to something that is a bit more intuitive to read :)
UPDATE
Using the rvmrc file has now been deemed deprecated. Instead a .ruby-version file with the ruby version e.g. '2.0.0' and a .ruby-gemset file with the gemset name e.g. 'monkeys_of_doom'
This way developers using other version managers such as rbenv can pick up the ruby version in an automated fashion.
How to make rvmrc file in project root folder?
It seems that there is a small mistake. Inside your .rvmrc
file add:
rvm use ruby-1.8.7-p352@gemset --create
Also you might want to change the name of your gemset to something that is a bit more intuitive to read :)
UPDATE
Using the rvmrc file has now been deemed deprecated. Instead a .ruby-version file with the ruby version e.g. '2.0.0' and a .ruby-gemset file with the gemset name e.g. 'monkeys_of_doom'
This way developers using other version managers such as rbenv can pick up the ruby version in an automated fashion.
Related Topics
How to Force One Field in Ruby's CSV Output to Be Wrapped with Double-Quotes
How to Authorize a Google Service Account Without the Default Credentials File
Using Soap and Other Standard Libraries in Ruby 1.9.2
Ruby $Stdin.Gets Without Showing Chars on Screen
Why Isn't My Cocoapods Post_Install Hook Updating My Preprocessor MACros
How to Make Users Automatically Follow Admin User on Sign Up
Rails 3.1 Actioncontroller::Routingerror (No Route Matches [Get] "/Assets/Rails.Png"):
Rails Console Default Environment
Ruby: Titleize: How to Ignore Smaller Words Like 'And', 'The', 'Or, etc
How to Convert a JSON String to an Object
How to Output Names of Ruby Unit Tests
How to Use Ajax Send Data to Controller in Ruby on Rails
Rails Console Not Working on Server
Bundler Puts My Gems in My Project Directory
How to Use Ruby Metaprogramming to Add Callbacks to a Rails Model
How to Format a String with Floats in Ruby Using #{Variable}