How to verify the correct installation of RVM to control Gem in Ruby?

Is there a command to test the ability to install RVM? I just went through the RVM setup process and would like to test it.

Also, since I have (or end up with) an RVM, will I no longer use apt-get to load libraries / gems and always do it through RVM?

+4
source share
3 answers

rvm -v is a good start, and then in accordance with the installation instructions ( link ), typing $ type rvm | head -1 $ type rvm | head -1 , return 'rvm is a function'. as for the second part, yes, you should just stick to installing gems with rvm using gem install (gemname here) and this will save you a ton of problems.

+8
source

First make sure your RVM is installed correctly:

https://rvm.beginrescueend.com/rvm/install/

rvm info is a good way to find out if everything is fine.

As for gems, I would say that they manage them through RVM-installed Rubies, they have some advantages, such as gemsets:

https://rvm.beginrescueend.com/gemsets/

Now I have always had some kind of disagreement between people who prefer their own packages over gems (and there are good reasons for this, but this discussion is at a different time), but I think that RVM gained a little weight, as well as problems with packages Ruby on Debian:

http://www.lucas-nussbaum.net/blog/?p=617

+2
source

There are several cases:

  • RVM not installed
  • RVM is installed but not used (i.e. its bindir is added to PATH, but it is not received)
  • RVM is installed and used, but not loaded (i.e. it is created, but you check it with a script)
  • RVM installed and used

The only way to check all 4 cases is to check environment variables starting with rvm_ :

env | egrep -v '^PATH' | egrep '^rvm_path'

We can check variables like MY_RUBY_HOME or GEM_HOME , but they can be manually reloaded by the user, so we cannot guarantee that we use RVM.

If you intend to use the above command in a script, you can change it as follows and check the exit code:

env | egrep -v '^PATH' | egrep -q '^rvm_path'

Of course, if you just need to find out if there is an RVM on disk and is available, you can go with simpler ones, for example, others offered here.

+1
source

All Articles