[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RubyGems Issue

Skeets

11/12/2006 5:06:00 PM

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

9 Answers

matt

11/12/2006 5:15:00 PM

0

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?

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


--
matt neuburg, phd = matt@tidbits.com, http://www.tidbits...
Tiger - http://www.takecontrolbooks.com/tiger-custom...
AppleScript - http://www.amazon.com/gp/product/...
Read TidBITS! It's free and smart. http://www.t...

Skeets

11/12/2006 5:27:00 PM

0

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

Tim Hunter

11/12/2006 5:29:00 PM

0

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.

Skeets

11/12/2006 5:37:00 PM

0

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

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

Tim Hunter

11/12/2006 5:47:00 PM

0

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

Skeets

11/12/2006 5:58:00 PM

0

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

Patrick Hurley

11/12/2006 6:44:00 PM

0

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.

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 :-) into
your interpreter at startup automatically.

pth

Bernard Kenik

11/13/2006 11:49:00 PM

0


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


> 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


Bernard Kenik

11/14/2006

0


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


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