RVM Gemsets: Awesomeness

rvm gemset require rubygems


If you have recently been keeping up to date with Ruby, and have tried using multiple versions at the same time, you're most probably using RVM to manage these different versions.

RVM is pretty awesome. But like any tool, you have to grok it a little so you know what it does behind the scenes when you use it.

Gemsets allow you to isolate gems per project

Ever since RVM released the gemset feature, I've never stopped using it on all projects. One very interesting, and probably underused feature of it is the ability to automatically switch to a gemset after cding to a directory, i.e.

If you want to know more see RVM's section on workflows.

How to remain DRY

Every time you start a project, you're probably wondering "oh now what I'm gonna have to install all the gems I need again?

Of course you don't have to do this, if you make use of the %global gemset.

It's no Silver bullet

Over time, I've discovered a few stuff that, like with any tool, are "good-to-knows".

  1. If you have like 100 gems in a gemset, then that would probably equate to 100++ entries in your $LOAD_PATH. I try to keep my gemsets as small as possible.

  2. Huge $LOAD_PATHs impact your application's load time. Like I said in #1, I guess it's good practice to keep 'em gemsets nice and manageable, this way you don't impact your application's load time.

  3. RVM and Bundler doesn't play nice with each other. Our M.O. so far regarding this issue is to situate your Rails 3 app that uses bundler in an environment unaware of RVM, this way isolating each from the other. Bundler loads wwwwwwwwwwwayy tooooo slow with RVM.

blog comments powered by Disqus