From: Timothy Hunter Date: 2007-03-26T22:17:47+09:00 Subject: Re: importing GEM libraries .... newby questions cugf_0956 wrote: > I have installed ruby on my laptop using rpm and I installed a whole > bunch of packages using GEM. Now when I run any scripts on my laptop, > ruby can locate any package that is installed via rpm but not the one > installed via GEM. How can I make it work such that everything that is > installed using Gem can be seen by ruby. > Here is an example: > I have > /usr/lib/ruby/1.8/date > I can call "require date" in my script and it will work. > > I have > /usr/lib/ruby/gems/1.8/gems/Selenium-1.0.1/bin/selenium > > when I call "require selenium" it doesn't work. > What is the catch here? > > Also, if I want to package my scripts to run on somebody else machine, > how can I make it, if he/she has right packages installed, can run my > scripts without errors? > > And one more question, I know that Perl can be pre-compiled for better > performance, can ruby scripts be pre-compiled as well? > > Thanks a lot. > > You need to have RubyGems loaded before you require any libraries that were installed using RubyGems. You can do this: export RUBYOPT=rubygems or in every script that requires a gem, require 'rubygems' before requiring any gem.