include core class extensions

C

Carlos Fernandez

<newbie>

An internal application, the "manager", will periodically locate a
series of ruby files in a directory structure. The application will
execute each ruby file using backticks (e.g. `ruby myfile.rb`). This
means that a single execution of the manager may end up spinning a
number of separate ruby processes. Although there are clear issues with
this, it is working well enough.

Now we need to include some core class extensions in each ruby process
this application spins up. The files that the manager will run do not
know about the extensions.

I have tried variations of the following interpreter options will no
success (probably user error):

-rlibrary require the library, before executing your script
-Idirectory specify $LOAD_PATH directory (may be used more than
once)

How, can I force each ruby process to "require" these class extensions?

thanks in advance.

Carlos
 
P

Phrogz

I have tried variations of the following interpreter options will no
success (probably user error):

-rlibrary require the library, before executing your script
-Idirectory specify $LOAD_PATH directory (may be used more than
once)

Perhaps a few more details would help. What about them failed? How did
they fail? Where are your libraries installed, or are you only talking
about items in the Standard Library[1]? What values did you use for
directory, and where is your ruby lib installed? What OS are you on?

[1] http://ruby-doc.org/stdlib/
 
C

Carlos Fernandez

Gavin,

sorry that my question was so vague. between lack of sleep and not
knowing really want to ask I didn't provide enough for you to go on.

I solved my issue last night as soon as put a decent amount of distance
between me and my computer.

I was specifying the "-I" as a relative path, but the rest of the
command: "c:\tools\ruby\bin\ruby.exe . . . " was specified using
absolute paths. At that point, I wasn't even sure what the relative
path, would be relative to? The original process, or the new process.
As soon as i specified "-I" in absolute terms it worked as expected.

One last . . . semi-related question. Is the file specified with the -r
switch, as well as all files specified with "require", considered
relative to a dir on the $LOAD_PATH if it does not start with a '/'?

Carlos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,998
Messages
2,570,242
Members
46,835
Latest member
lila30

Latest Threads

Top