Javatpoint Logo
Javatpoint Logo

Ruby on Rails RVM

RVM stands for Ruby Version Manager. It is a command line tool which allows you to easily install, manage and work with different Ruby environments. With RVM, you can easily install different versions of Ruby and easily switch between them.

RVM is maintained by the github community through pull requests sent to the project repository.

Syntax:

The basic syntax of RVM is,

The RVM flags allows you to alter the behavior of RVM.

To get the list of RVM commands, type the following:


How to Use Gemsets

One way to distribute code in Ruby is to use a format called gems. Gems are installed to extend capabilities of core Ruby distribution. And gems are often installed to get certain programs to function correctly.

To provide certain Ruby environments, it is also possible to install gems that are only associated with a single Ruby installation. This functionality is called gemsets.

It means that you can have two different versions of same gem, or you can make gems unaware of other gems on a system.

To see the available gemsets for the current Ruby, type the following command,

If you have more than one Ruby version installed, you can see all of the gemsets by typing,

By default, two gemsets are configured:

  • default: This gemset is applied if no other gemset is specified.
  • global: This gemset is inherited by every other gemset that is used. It does not need to be selected because it will be included automatically.

Gem Dependency

With RVM, no gems other than those required are installed. Due to this, working with multiple complex applications which has a long list of dependencies is much more efficient. RVM allows you to easily test gem upgrades by switching to a new clean set of gems to test with, while leaving your original set intact. You can even maitain a set of gems per environment, per development branch or per individual developer's taste.


Gem Management

RVM provides you most flexible gem management system called Named Gem Sets. It lets you add a small text file to your application's repository, instead of checking in tons of gems. Only one downloaded version of each gem resides on disk rather than several copies because RVM's gemset management uses a common cache directory.

Update RVM

RVM installation can be updated easily to a new version from within the utility.

Run the following command:

RVM will fetch and install newest version and then reload it. If your configurations are placed in config/db instead of user/db, it would be wiped out.

To upgrade RVM to the latest version, type:


Summary

RVM is a versatile tool that can be used to manage projects and entire Ruby environments. RVM can be used to configure server installations, development conditions, etc.






Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA