Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why should I use application-specific RVM gemsets in addition to Bundler?

I'm using RVM to manage my local Ruby installations, and Bundler for application dependency management.

Some people recommend using a separate RVM gemset for each application, while some seem to think that's not necessary.

So what are the advantages of using a separate RVM gemset for each application, when I'm using Bundler anyway? What are the risks of not doing so?

like image 704
otto.poellath Avatar asked Jun 18 '12 16:06

otto.poellath


3 Answers

i use gemsets in addition to bundler because of the following:

  • easy to just drop everything once a while (i like messing around with my installed gems)
  • no need to call bundle exec (this is obsolete with binstubs)
  • faster loading, because less gem-specs need to be parsed
  • easy to distribute (copy it to your mates)

there are probably more reasons to use them, but i generally like the idea of sandboxes!

like image 110
phoet Avatar answered Nov 11 '22 05:11

phoet


I've found that it's useful to have rvm if you're using rails 2. RVM is great if you need to work on an app that has old code. Rails 2 doesn't use a Gemfile, so bundle exec doesn't work. RVM makes it easy to keep the gem versions correct for that project, and they you can switch back to newer versions of rails and use the Gemfile to specify versions. If you have multiple apps that use different gem versions, but the same version of ruby, it's convenient to share most of the gems, and specify them in the Gemfile where they differ.

I think it's kind of case dependent. If you find that there are tons of version issues between two apps, and constantly modifying Gemfiles to keep them straight is annoying, then use separate gemsets. If there is enough in common, it might make sense to just use the same gemset

like image 35
Peter Klipfel Avatar answered Nov 11 '22 06:11

Peter Klipfel


RVM gemsets allow you to separate gems without loading bundler - which is faster, it will be simpler to load the gems.

You should be using gemsets to just separate projects from your helper gems (like gist).

But if you decide that gemsets are of no help for you you can tell RVM to ignore gemsets totally:

echo "export rvm_ignore_gemsets_flag=1" >> ~/.rvmrc
like image 1
mpapis Avatar answered Nov 11 '22 06:11

mpapis