Required scripts

Hi everybody,

I have a question:

Is there a way to find out which ruby script files are “required”
(==loaded) by the current application?

example:

require "foo/bar"
require "this/is/a/test"
require “cgi”

get_requrired => [foo/bar, this/is/a/test, cgi]

any help will be appreciated, thanks in advance!

George Moschovitis

···


Navel, http://www.navel.gr

get_requrired => [foo/bar, this/is/a/test, cgi]

pigeon% ruby -rsocket -e 'p $"'
["socket.so"]
pigeon%

pigeon% ruby -rsocket -rcgi -e 'p $"'
["socket.so", "cgi.rb", "English.rb", "delegate.rb"]
pigeon%

Guy Decoux

“George Moschovitis” gmosx@softlab.ntua.gr wrote in message

Is there a way to find out which ruby script files are “required”
(==loaded) by the current application?

Take a look at the “rdep” utility on RAA:
This utility analyzes large Ruby programs and attempts to
determine all their dependencies and whether they can be
resolved. It recognizes simple forms of load, require, and
autoload.

In article BTzJ9.72143$Fi7.835524@twister.kc.rr.com,

···

Shashank Date sdate@kc.rr.com wrote:

“George Moschovitis” gmosx@softlab.ntua.gr wrote in message

Is there a way to find out which ruby script files are “required”
(==loaded) by the current application?

Take a look at the “rdep” utility on RAA:
This utility analyzes large Ruby programs and attempts to
determine all their dependencies and whether they can be
resolved. It recognizes simple forms of load, require, and
autoload.

so rdep actually parses some Ruby code to determine these things?

How about checking the Array in $" ?

From page 217 of the Pickaxe: “An array containing the filenames of
modules loaded by require.”

Phil

“Or perhaps the truth is less interesting than the facts?”
Amy Weiss (accusing theregister.co.uk of engaging in ‘tabloid journalism’)
Senior VP, Communications
Recording Industry Association of America

In article BTzJ9.72143$Fi7.835524@twister.kc.rr.com,

“George Moschovitis” gmosx@softlab.ntua.gr wrote in message

Is there a way to find out which ruby script files are “required”
(==loaded) by the current application?

Take a look at the “rdep” utility on RAA:
This utility analyzes large Ruby programs and attempts to
determine all their dependencies and whether they can be
resolved. It recognizes simple forms of load, require, and
autoload.

so rdep actually parses some Ruby code to determine these things?

How about checking the Array in $" ?

From page 217 of the Pickaxe: “An array containing the filenames of
modules loaded by require.”

That’s useful at runtime, isn’t it? But what if
you can’t run because of missing files?

BTW, “parsing” is an overly kind description of
what rdep does. It’s hardly more sophisticated
than grep.

Hal

···

----- Original Message -----
From: “Phil Tomson” ptkwt@shell1.aracnet.com
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” ruby-talk@ruby-lang.org
Sent: Wednesday, December 11, 2002 12:17 AM
Subject: Re: Required scripts

Shashank Date sdate@kc.rr.com wrote: