40

I just don't get it. I thought, Bundler was developed to resolve version conflicts between gems. So that I just have to require "bundler/setup" and everything is fine, knowing that Bundler will load the correct versions of all my gems and their dependencies. Now, RVM is great for managing multiple Rubies, I know, but why should I care about the Gemset feature? Do I miss something here? Can it make my development even easier? Maybe, some of you can give me some hints on the perfect RVM + Bundler workflow for both, development and production.

I also don't know when RVM starts switching to another Ruby. I know that I can have an .rvmrc file in my project, but do I have to cd to this directory so that the switch happens?

Furthermore, I usually use Passenger for development since, thanks to the Passenger.prefpane, integration in Mac OS is great. Can I still do that with RVM or is there a better way to do it? Does Passenger recognize .rvmrc files and switch to the correct Gemset?

t6d
  • 2,595
  • 3
  • 26
  • 42
  • 2
    Yes, rvm redefines cd as a shell function which checks for .rvmrc files when changing directories. – Sam Jan 28 '11 at 11:21

3 Answers3

24

Why should I care about RVM's Gemset feature when I use Bundler?

You shouldn't.

Well, if you want to, you can care about, of course, so I should better say "You don't need to."

I just listened to a podcast interview with one of the Bundler core team members who basically said that since he started using Bundler he stopped using Gemsets, because they are redundant.

Here's a blog post that discusses the same issue, with some examples.

aarti
  • 2,815
  • 1
  • 23
  • 31
Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • 2
    However, at the moment RVM and bundler are not working well together. See http://beginrescueend.com/integration/bundler/ for the latest details. For now I'm using gemsets to avoid segmentation faults when switching ruby versions on different projects that share gems. – foz Aug 01 '11 at 11:24
6

When I am dealing with legacy code or forking other non-rails ruby projects that haven't for whatever reasons gone the bundle route, gemsets are such an awesome thing to have. I also find gemsets invaluable while developing gems. Nice to have multiple test environments to switch between and test the freshly built gem.

Passenger doesn't read the .rvmrc to the best of my knowledge. You can't run different projects in passenger under different rubies to the best of my knowledge. My default rails setup has just bundler and rake in the global gemset. I let bundler take over from there and manage rest of the gems project wise just like you describe. Works pretty well.

anshul
  • 5,945
  • 5
  • 24
  • 29
  • Does this mean you have an independent gemset for each of your projects? I mean your are talking about your "default rails setup". At some point this setup probably evolves to a state where it is project specific. Do you have a custom gemset by then? How do you run your applications on your development machine? – t6d Jan 14 '11 at 09:52
  • Yes, I do have independent gemsets for all my non-rails projects and one gemset for rails (that contains just bundler). All the gem requirements for a rails project, I let bundler handle - for instance `bundle exec rails server` or `bundle exec rake`. So, my Gemfiles evolve as the rails projects evolve but the `rails` gemset doesn't. – anshul Jan 17 '11 at 11:43
1

You should definitely use gemsets if you anticipate ever having to change your bundler version. And you can use gemsets to manage gems that don't matter specifically to your Rails app (wirble etc.).

brs
  • 19
  • 1