From: Jano Svitok Date: 2007-06-26T00:00:02+09:00 Subject: Re: gems gone missing? On 6/25/07, Sharon Phillips wrote: > On 26/06/2007, at 12:30 AM, Jano Svitok wrote: > > > On 6/25/07, Sharon Phillips wrote: > >> Hi, > >> > >> I've just spent the evening installing gruff (all the way from step > >> 1: install X11...), but now any ruby code I have that uses a gem > >> can't seem to find it. > >> > >> For example, > >> irb(main):001:0> require 'net-ssh' > >> LoadError: no such file to load -- net-ssh > >> from (irb):1:in `require' > >> from (irb):1 > >> > >> gem list lists all the gems I expect to be present, including gruff > >> and net-ssh (which is one I know was working beforehand) > >> > >> Only thing I can think of that may have contributed to this is > >> combining two .profile files into one, now ~/.profile (most of this > >> is new to me). Could the one I removed (contents moved to the new > >> one) have had a path to the gems, and Ruby doesn't read the new one? > >> > >> Any other ideas. I feel right stupid at the moment. > >> > >> Cheers, > >> Dave > > > > Check your $RUBYOPT setting, use -rubygems argument to ruby, or add > > 'require "rubygems" ' to the beginning of the file. > > > > J. > > Thanks for the help Jano, > > Not sure where to find $RUBYOPT, but adding require 'rubygems' solves > the problem temporarily. I now have my very first gruff graph! > Does this give any clue as to the underlying issue? > > Cheers, > Dave 1. Please bottom-post. 2. The problem is that in order to use a gem, rubygems must be loaded. You can achieve that by any of the means I mentioned above. (If rubygems are loaded, and the gem is not there, the message looks different. 3. the means to load rubygems in detail: - require 'rubygems' is pretty obvious I think. - ruby -rubygems uses -r switch to ruby, that requires 'ubygems' before running the script. ubygems just contains require 'rubygems' - it's a cosmetic hack to avoid having to write -r rubygems or -rrubygems - RUBYOPT environment variable contains default arguments to ruby. If you set it to 'rubygems' they will be loaded for all ruby scripts. J.