Kvass
Kvass

Reputation: 8444

RVM see gems in gemset

How do I view a list of all the gems in a given gemset? And is it possible to use multiple gemsets at a time or only one?

Upvotes: 10

Views: 5290

Answers (3)

Keith Bennett
Keith Bennett

Reputation: 4970

Perhaps the simplest way is to query the filesystem. As an example, I had a gemset named yard using Ruby 3.0.3. All the gems installed in that gemset could be found with:

> ls ~/.rvm/gems/ruby-3.0.3@yard/gems
yard-0.9.26

(There was just that one gem.)

So the gemset directory name is:

~/.rvm/gems/#{ruby_version}@#{gemset_name}/gems

...where ruby_version is the version rvm uses (i.e. the string output by rvm list).

Upvotes: 0

MarkDBlackwell
MarkDBlackwell

Reputation: 2122

Usually the current Ruby's @global gemset is included in other gemsets.

To see the contents of a gemset, excluding the @global gemset, first do rvm use 2.0.0@some-gemset --ignore-gemsets (or similar) then gem list.

For the default gemset, do rvm use 2.0.0 --ignore-gemsets then gem list.

Upvotes: 2

jnevelson
jnevelson

Reputation: 2092

You can call gem list and it will display all the gems in your current gemset. You can only use one gemset at a time, but there is a hierarchy of gemsets. You can create a global gemset with (for example) rake and pry in it, and then any gemset you create (using the same version of ruby, of course) will inherit those gems into it.

Upvotes: 10

Related Questions