List Gems From a Gemset or the Global Gemset

You can list the available gems with the gems list command but what about the gems that exists only on a specific gemset, or the gems that are available on the global gemset?

One of my favorite tools when i work with Ruby is RVM. RVM is a tool to manage multiple version of rubies. Among the many features that RVM provides is the option to have a separate gemset for each project you work on. You can also have a global gemset that will contain all the gems that you want to have for every project.

As usual you can list the available gems each time with gem list command but this will show you all the gems both from the current gemset and the global gemset. If you want to list the gems that exists on current gemset just run the command GEM_PATH=$GEM_HOME gem list and to list only the gems from the global gemset use the rvm @global do gem list command. Of course you can create aliases for these commands like I did.

1
alias gems='GEM_PATH=$GEM_HOME gem list'
1
alias ggems='rvm @global do gem list'

You can see all my dot files on GitHub if you like.