Gems cleverness?

You're all going to be making my head very big.... I'm not all that
clever to warrant an entire thread on my intelligence, but thanks all
the same... ( ;

Gem

···

-----Original Message-----
From: Eric Hodel [mailto:drbrain@segment7.net]
Sent: 14 December 2006 23:09
To: ruby-talk ML
Subject: Re: gems cleverness?

               *** WARNING ***

This mail has originated outside your organization, either from an
external partner or the Global Internet.
     Keep this in mind if you answer this message.

On Dec 14, 2006, at 11:20, Eric Hodel wrote:

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.

Ok, This will be going in once rubygems is up. Same interface.

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

I LIT YOUR GEM ON FIRE!

********************************************************************
This email and any attachments are confidential to the intended
recipient and may also be privileged. If you are not the intended
recipient please delete it from your system and notify the sender.
You should not copy it or use it for any purpose nor disclose or
distribute its contents to any other person.
********************************************************************