Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM: List all gems in current gemset ignoring global & default

Looking for something like gem list within an RVM gemset but to have it ignore gems in the global and default gemsets so I can see, easily, exactly what gems are in the active gemset (and only the active gemset).

like image 704
Meltemi Avatar asked Sep 06 '12 19:09

Meltemi


People also ask

How do I find my Gemset list?

However, to see the contents of a gemset, excluding the @global gemset, first do rvm use 2.0.0@some-gemset --ignore-gemsets (or similar for other Rubies) then gem list . Similarly to see the contents of the @global gemset, first do rvm use 2.0.0@global then gem list .

How do I remove Gemset from rvm?

You need to "rvm gemset empty [gemset_name]". I suppose if you have many gems, it could take a while to uninstall them all. Incidentally right now I am able to run rvm gemset empty and it clears the current gemset.

What is Gemset in rvm?

If you are using RVM(Ruby Version Manager) then using a gemset for each project is a good idea. 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.


2 Answers

for global:

rvm @global do gem list 

for other gemsets:

GEM_PATH=$GEM_HOME gem list 

@global is a gemset that all other gemsets inherit for given ruby, it does not inherit for m itself so it's safe to select it and run gem list in it's context.

For all other gemsets you can use the fact that gem list displays gems from all paths available in GEM_HOME and GEM_PATH, resetting GEM_PATH to be equal GEM_HOME will make only one path available - the one from GEM_HOME so gem list will only show gems in the selected gemset, ignoring all other gemsets (at this time the @global, but RVM 2.0 will support multiple gemsets inheritance).

like image 85
mpapis Avatar answered Sep 17 '22 13:09

mpapis


Simplest way to do it is to use bash command which show list of directories in your current gemset directory

$ ls `rvm gemdir`/gems 
like image 29
Nick Kugaevsky Avatar answered Sep 17 '22 13:09

Nick Kugaevsky