A newbie question about path

Hello!

I’ve got a simple question.

I want to have my own libraries in a directory.
Let’s say that it’s “C:\mylib”.
And there’s a file names “a.rb”.

I want to write like
require “a”

What should I do to make ruby interpreter know where to find the file all
the time.

ENV[“RUBYLIB”] is valid only for the session, right?

Thanks.

Sam

Sam Sungshik Kong wrote:

Hello!

I’ve got a simple question.

I want to have my own libraries in a directory.
Let’s say that it’s "C:\mylib".
And there’s a file names “a.rb”.

I want to write like
require “a”

What should I do to make ruby interpreter know where to find the file all
the time.

ENV[“RUBYLIB”] is valid only for the session, right?

Consider putting your own libraries in:

RUBY/lib/ruby/site_ruby/1.x (if version specific)
RUBY/lib/ruby/site_ruby (general utilities)

They’re not just for other people’s packages.

···

If your library is in the “current directory”, Ruby would find it there, too.


There’s the -I’C:/mylib’ command line option.


Or $LOAD_PATH << ‘C:/mylib’ before “require”.


Someone may even answer the question you asked :slight_smile:

daz

Add RUBYLIB to the list env. variables defined during startup. If
you’re using Win95/98, add

SET RUBYLIB=C:\mylib

to your autoexec.bat. If you’re using WinXP, use Control
Panel->System->Advanced->Environment Variables to add RUBYLIB to the
list of user variables.

···

On Wed, 02 Jun 2004 01:16:40 GMT, “Sam Sungshik Kong” ssk@chol.nospam.net wrote:

ENV[“RUBYLIB”] is valid only for the session, right?