Forum: Ruby include core class extensions

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Carlos F. (Guest)
on 2007-03-27 23:33
<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
Gavin K. (Guest)
on 2007-03-28 03:20
(Received via mailing list)
On Mar 27, 1:33 pm, Carlos F. <removed_email_address@domain.invalid>
wrote:
> 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/
Carlos F. (Guest)
on 2007-03-28 18:41
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
This topic is locked and can not be replied to.