On Dec 13, 2006, at 18:32, Giles Bowkett wrote:
> On 12/13/06, Eric Hodel <drbrain / segment7.net> wrote:
>> On Dec 11, 2006, at 19:31, Giles Bowkett wrote:
>>
>> > Is there an easy way to find out all the gems you're running in a
>> > particular codebase? (It's a Rails app but I'd imagine the  
>> technique
>> > has general usefulness?)
>>
>> Gem::SourceIndex.from_installed_gems.search(//).map { |spec|
>> spec.full_name } # *
>>
>> You get back an Array of Gem::Specification objects.
>>
>> (I should fix that search in there.)
>>
>> * I'm running from SVN, but this should still work.
>
> I think I should submit this question to Ruby Quiz. your approach is
> very complete, but overkill -- it gives me everything on my system,
> rather than everything my app is actually using.

Oh, sorry.

require 'rubygems'
require 'inline'

class << Gem; attr_reader :loaded_specs; end

p Gem.loaded_specs.keys

I'll make this cleaner.

> Devin's solution gave me everything my app was using at the moment  
> I ran the command, but missed things which were used in the app but  
> not yet loaded.

I don't see how you could possibly expect to know what files would be  
loaded by your program in the future.

-- 
Eric Hodel - drbrain / segment7.net - http://blog.segment7.net

A: Yes
Q: Is top-posting bad?
  ? Derek Milhous Zumsteg