A newbie question about path

  • Thread starter Sam Sungshik Kong
  • Start date
S

Sam Sungshik Kong

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
 
D

daz

Sam said:
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 :)


daz
 
T

Tim Hunter

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

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.
 

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

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top