RVM checklist for Ruby on Rails

First of all, what is RVM for?

It is for managing well ruby versions and all of their corresponding gems. Further more, it also provides gemset functionality which help you work with separate gem lists for each individual project (no more frustrating about gem versions conflicts, unreadable long list of a specific gem versions).

To know how to set it up, we have another article for you here.

 

Common RVM commands:

rvm list

rvm list

rvm use 2.2

rvm use

rvm current

rvm current

To set default ruby version, run rvm use version –default

rvm use --default

rvm gemset list

rvm gemset list

By default, after installing a new ruby version, rvm will install all related gems in default gemset. It also has a global gemset alongside. To create new gemset (1 gemset should be specific for 1 or some fairly similar projects), run rvm gemset create project_name

rvm create gemset

The use syntax is similar to choosing ruby version: rvm gemset use project_name

rvm gemset use

 

After creating a Rails app, what should I do to take advantage of rvm?

Create .ruby-version file to let RVM know which Ruby version we should use

ruby-version sample file

Create .ruby-gemset file to let RVM know the name of gemset you would like to user and automatically create/navigate it when we make some changes to the gems. Why? Because if we separate each project’s gems to different gemsets, we won’t have to concern, worry about the potential conflicts between other versions of any gem, which is quite frustrating sometimes.

ruby-gemset sample file

 

Pretty simple, right? Good luck on exploring RVM.

 

Happy coding.