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...

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

···

Skeets <skillet3232@yahoo.com> wrote:

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?

--
matt neuburg, phd = matt@tidbits.com, Matt Neuburg’s Home Page
Tiger - http://www.takecontrolbooks.com/tiger-customizing.html
AppleScript - http://www.amazon.com/gp/product/0596102119
Read TidBITS! It's free and smart. http://www.tidbits.com

Skeets wrote:

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...

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.

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...

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

···

----- Original Message ----- From: "Skeets" <skillet3232@yahoo.com>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Sunday, November 12, 2006 12:10 PM
Subject: RubyGems Issue

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

Matt, my apologies. i did do

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 Hunter 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...

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...

Skeets wrote:

Timothy Hunter 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...

> 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...

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.

Timothy Hunter 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...

> 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" <skillet3232@yahoo.com>
Newsgroups: comp.lang.ruby
To: "ruby-talk ML" <ruby-talk@ruby-lang.org>
Sent: Sunday, November 12, 2006 12:40 PM
Subject: Re: RubyGems Issue

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.

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.

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

···

On 11/12/06, Skeets <skillet3232@yahoo.com> 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.