RubyGems Issue

hi all,

i have successfully installed gems on my winxp box. when i type in
gems -v(or is it --version, i can’t recall off hand) i get back the
current version (i think it is version 0.9). so far, so good.

however, when i fire up irb and try to

include ‘rubygems’

false is returned.

what am i doing wrong?

tia…

Skeets [email protected] wrote:

false is returned.

what am i doing wrong?

What happens if you say require instead of include? m.

Skeets wrote:

false is returned.

what am i doing wrong?

tia…

Don’t you mean “require ‘rubygems’”? The “require” method causes a file
to be loaded. The “include” method adds a module’s constants, methods
and module variables into the current module.

What happens if you say require instead of include? m.

Matt, my apologies. i did do

irb> require ‘rubygems’

it returns false.

i found this out in the process of installing fxruby.

require ‘fox16’

works as it should (lots of scrolling text culminating in a “true”).

Timothy H. wrote:
Skeets wrote:

Don’t you mean “require ‘rubygems’”? The “require” method causes a file
to be loaded. The “include” method adds a module’s constants, methods
and module variables into the current module.

Timothy, that is what i actually did, i just articulated it wrong.

if i have rubygems installed, i should be able to automatically…

irb> require ‘rubygems’

right? or is that wrong? do i need to do something else to make it
work? could it be confused about the gems directory path (or is
directory path irrelevant?)?.

tia…

What this means is that you’ve already got “rubygems” loaded. At a guess
I’d say that you have a RUBYOPT environment variable with the value
“rrubygems” or something similar.

thank you very much. that result is not intuitive (especially since
the tutorial for fxruby displayed ‘true’ when doing this), but now that
you explained how it works, i can move on and start learning some
fxruby.

thanks again.

Skeets wrote:

Timothy, that is what i actually did, i just articulated it wrong.

Probably you’re doing nothing wrong. When “require” returns false it
doesn’t mean it failed, it only means that whatever you’re requiring is
already loaded. When require fails it raises an exception:

ruby$ irb
irb(main):001:0> require ‘notthere’
LoadError: no such file to load – notthere
from (irb):1:in `require’
from (irb):1
irb(main):002:0>

What this means is that you’ve already got “rubygems” loaded. At a guess
I’d say that you have a RUBYOPT environment variable with the value
“rrubygems” or something similar.

On 11/12/06, Skeets [email protected] wrote:

thank you very much. that result is not intuitive (especially since
the tutorial for fxruby displayed ‘true’ when doing this), but now that
you explained how it works, i can move on and start learning some
fxruby.

FYI, the reason for this (I am guessing) is that you (or more likely
the Ruby one click installer) has set the environment variable RUBYOPT
with -rubygems. Which require rubygems (or was it ubygems :slight_smile: into
your interpreter at startup automatically.

pth

----- Original Message -----
From: “Skeets” [email protected]
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” [email protected]
Sent: Sunday, November 12, 2006 12:40 PM
Subject: Re: RubyGems Issue

irb> require ‘rubygems’

right? or is that wrong? do i need to do something else to make it
work? could it be confused about the gems directory path (or is
directory path irrelevant?)?.

tia…

you do not need the require ‘rubygems’ statement on Windows … as
evidenced
by the false response which indicates that it has already been loaded

----- Original Message -----
From: “Skeets” [email protected]
Newsgroups: comp.lang.ruby
To: “ruby-talk ML” [email protected]
Sent: Sunday, November 12, 2006 12:10 PM
Subject: RubyGems Issue

false is returned.

what am i doing wrong?

tia…

You are not doing anything wrong

the ‘false’ returns just indicate that rubygems has already be included.

for windows you do not need to include ‘rubygems’ before you include any
other libraries