From: aurelianito Date: 2005-11-05T03:07:09+09:00 Subject: Re: RUBYLIB on Windows Thank you very much, the third option worked like a charm (ruby -S arf_cmp.rb). Aureliano. Stefan Lang wrote: > On Friday 04 November 2005 16:27, aurelianito wrote: > > Hi all, > > I'm using the excelent ruby one click installer's ruby on windows, > > but I'm unable to add a folder to the path that ruby uses to fetch > > the scripts. > > > > I have a script named arf_cmp.rb in C:\devel\scripts\test_scripts. > > So I've set RUBYLIB=C:\devel\scripts\test_scripts (environment > > variable). But when I run: "ruby arf_cmp.rb" the error "ruby: No > > such file or directory -- arf_cmp.rb (LoadError)" is shown. If I > > run the script using the full path "ruby > > C:\devel\scripts\test_scripts\arf_cmp.rb" it runs flawlessly. > > > > I've tried to set the following variables: > > RUBYLIB > > RUBY_LIB > > RUBY_PATH > > LOAD_PATH > > > > How can I do to run the script without hardcoding the entire path? > > Put your script in Ruby's bindir. This command: > ruby -r rbconfig -e "puts Config::CONFIG['bindir']" > will print it, on Windows something like "C:\ruby\bin". > > The OneClick Installer usually sets up the file extension > association *.rb => Ruby interpreter, thus you should be > able to run your script by typing its name with the .rb extension, > like: > arf_cmp.rb > > And if that doesn't work, try: > ruby -S arf_cmp.rb > > How does it work: > When you install Ruby with the OneClick Installer, it permanently > adds Ruby's bindir to the Path environment variable with the help > of the registry. Whenever you start a program (not only a ruby > script) from the console, the console will look for the program > file in the directories listed in the Path environment variable > and start the first it can find. > > HTH, > Stefan