views:

49

answers:

1

Hey,

What ever happend to Rails.configuration.gems in Rails 3? I guess it has to do with Bundler. But how can I find all gems now?

Thanks

+2  A: 

Yes it has to do with Bundler. In Rails 3 your application's gem manifest is in a file called Gemfile. Some good explanations on the changes and how to use them here, here, here and here.

UPDATE:

The bundle show CLI lists the gems in use by your application. But, programmatically you can get to the same thing as follows:

require 'bundler'
mygems = Bundler.load.specs.map { |spec| spec.name }

The spec object also contains other attributes of interest.

bjg
I have used Bundler a bit for Rails 3 apps, that I know how to do. But how do I from ruby code check stuff, such as this, find all gems for my application? Thats my problem...
rejeep
rejeep
@rejeep Sorry I misunderstood you question the first time. I've added an update above which hopefully is what you're looking for.
bjg
Thats more like it! :) But, what I really want is the gems that was specified directly, excluding dependencies...
rejeep
@rejeep Then in that case I can't think of any better way than just opening and reading all the `gem` lines in your Gemfile
bjg
Ok, thanks a lot!
rejeep