[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

gem requires not working

Steve Ross

12/2/2006 7:24:00 PM

I feel stupid about this, but I just did a fresh install of 1.8.5 from
MacPorts, installed a fresh rubygems, installed all my gems, and simple
code like this fails:

require 'redcloth'

Error message:

lacosta:~/nitro/tracker sxross$ ruby bug.rb
bug.rb:1:in `require': no such file to load -- redcloth (LoadError)

The odd thing is that any requires *inside a Rails app* seem to find the
gems just fine. I assume that's because Rails munges the load paths.

Any help is appreciated.

--
Posted via http://www.ruby-....

4 Answers

Devin Mullins

12/2/2006 8:49:00 PM

0

Steve Ross wrote:
> The odd thing is that any requires *inside a Rails app* seem to find the
> gems just fine. I assume that's because Rails munges the load paths.
Actually it's because of config/boot.rb in your Rails app. Specifically:
require 'rubygems'

If your code was working before, and didn't need this, then it's
possible that you had had RUBYOPT set.

Devin

Steve Ross

12/2/2006 11:43:00 PM

0

Devin Mullins wrote:
> Steve Ross wrote:
>> The odd thing is that any requires *inside a Rails app* seem to find the
>> gems just fine. I assume that's because Rails munges the load paths.
> Actually it's because of config/boot.rb in your Rails app. Specifically:
> require 'rubygems'
>
> If your code was working before, and didn't need this, then it's
> possible that you had had RUBYOPT set.
>
> Devin

You're right, it's the explicit:

require 'rubygems'

Shouldn't this be implicit? Or am I misremembering...

Thanks

--
Posted via http://www.ruby-....

Eric Hodel

12/3/2006 3:43:00 AM

0

On Dec 2, 2006, at 15:43 , Steve Ross wrote:
> Devin Mullins wrote:
>> Steve Ross wrote:
>>> The odd thing is that any requires *inside a Rails app* seem to
>>> find the
>>> gems just fine. I assume that's because Rails munges the load paths.
>> Actually it's because of config/boot.rb in your Rails app.
>> Specifically:
>> require 'rubygems'
>>
>> If your code was working before, and didn't need this, then it's
>> possible that you had had RUBYOPT set.
>>
>> Devin
>
> You're right, it's the explicit:
>
> require 'rubygems'
>
> Shouldn't this be implicit? Or am I misremembering...

You are misremembering.

Some people set RUBYOPT=-rubygems (or is it RUBY_OPT?)

--
Eric Hodel - drbrain@segment7.net - http://blog.se...

I LIT YOUR GEM ON FIRE!


Michael Greenly

12/3/2006 1:17:00 PM

0

Steve Ross wrote:
> Devin Mullins wrote:
>> Steve Ross wrote:
>>> The odd thing is that any requires *inside a Rails app* seem to find the
>>> gems just fine. I assume that's because Rails munges the load paths.
>> Actually it's because of config/boot.rb in your Rails app. Specifically:
>> require 'rubygems'
>>
>> If your code was working before, and didn't need this, then it's
>> possible that you had had RUBYOPT set.
>>
>> Devin
>
> You're right, it's the explicit:
>
> require 'rubygems'
>
> Shouldn't this be implicit? Or am I misremembering...
>
> Thanks

It's not a standard part of Ruby, it's an external library, so it should
remain explicit. If you're using it on your system you most likely do
want to set RUBYOPT="-r rubygems".


--
Posted via http://www.ruby-....