[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

RubyGems Issue

Patrick Fernie

6/25/2005 10:02:00 PM

Hi list,

I'm having a not-so-critical-but-still-irritating issue with
rubygems. It installed fine, and i can use gems, but only using
require_gem; using the redefined require (from custom_require.rb)
results in a load error. Now, NB, I am running on Ubuntu
(i.e. Debian-based distro), and I know there have been issues w/
rubygems on these platforms before. However, since everything else
seems to work, i was wondering if anybody had insight into this
problem.

e.g. (with any gem, not just fxruby, and I have rubygems in RUBYOPT):

irb(main):001:0> require_gem 'fxruby'
=> true
irb(main):002:0> exit

But:
irb(main):001:0> require 'fxruby'
LoadError: No such file to load -- fxruby
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require__'
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:18:in
`require'
from (irb):1
irb(main):002:0> exit

-Patrick


8 Answers

Joel VanderWerf

6/26/2005 5:19:00 AM

0

Patrick Fernie wrote:
> Hi list,
>
> I'm having a not-so-critical-but-still-irritating issue with
> rubygems. It installed fine, and i can use gems, but only using
> require_gem; using the redefined require (from custom_require.rb)
> results in a load error. Now, NB, I am running on Ubuntu
> (i.e. Debian-based distro), and I know there have been issues w/
> rubygems on these platforms before. However, since everything else
> seems to work, i was wondering if anybody had insight into this
> problem.
>
> e.g. (with any gem, not just fxruby, and I have rubygems in RUBYOPT):
>
> irb(main):001:0> require_gem 'fxruby'
> => true
> irb(main):002:0> exit
>
> But:
> irb(main):001:0> require 'fxruby'
> LoadError: No such file to load -- fxruby
> from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:18:in
> `require__'
> from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:18:in
> `require'
> from (irb):1
> irb(main):002:0> exit
>
> -Patrick

I see the same thing you do. However,

require 'fox12'

works for me, and I have fox installed only as a gem:

$ locate fox12.so
/usr/local/lib/ruby/gems/1.8/gems/fxruby-1.2.6/ext/fox12/fox12.so

(Note that "require 'fox12'" is also the right invocation for systems in
which fox was installed from tarball.)


Jim Weirich

6/26/2005 11:47:00 AM

0

On Sunday 26 June 2005 01:18 am, Joel VanderWerf wrote:
> > But:
> > irb(main):001:0> require 'fxruby'
> > LoadError: No such file to load -- fxruby

> Patrick Fernie wrote:
> require 'fox12'
> works for me, and I have fox installed only as a gem:

Don't confuse the name of the gem (e.g. 'fxruby') with the names of the
include files provide by the gem (e.g. 'fox12')

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)


Austin Ziegler

6/28/2005 2:25:00 PM

0

On 6/28/05, Patrick Fernie <patrick.fernie@gmail.com> wrote:
> Ah, this makes sense. Will the patched require eventually load by the
> gem library name?

I hope not.

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


Jim Weirich

6/28/2005 3:15:00 PM

0


Patrick Fernie said:
> Ah, this makes sense. Will the patched require eventually load by the
> gem library name?

Is the question: Will you eventually be able to specify the gem name in a
require statement? The answer is no.

'require' should always work with files.

Here's some guidlelines:

* Always use a plain 'require' in your code.

* Use 'require_gem' only in code that needs to specify a specific version
of a gem to be used.

* When you do use a 'require_gem', collect the require_gem statements in a
contained area of your code base so that when you need to change what
versions are required, it will be easy to do so.

--
-- Jim Weirich jim@weirichhouse.org http://onest...
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)



Ryan Davis

6/29/2005 7:12:00 AM

0


On Jun 28, 2005, at 7:20 AM, Patrick Fernie wrote:

> Ah, this makes sense. Will the patched require eventually load by the
> gem library name? This seems a little more natural, but then again I

No, afaik, it won't. I don't think it is more "natural" either. If
anything, require_gem will be renamed to something that conveys the
orthogonality better.

> suppose it leads to the problem of maintaining gemified and
> non-gemified versions (whereas using the straight library name
> doesn't). I suppose if I had paid more attention to the
> documentation/examples provided by the gems I install, this would have
> been obvious.

Oh, I wouldn't go that far. ;)


--
ryand-ruby@zenspider.com - Seattle.rb - http://www.zens...
seattle.rb
http://blog.zens... - http://rubyforge.org/proje...




Ryan Davis

6/30/2005 8:01:00 AM

0


On Jun 28, 2005, at 8:16 AM, Alan Chen wrote:

>> require 'rubygems' require nil # require for non-gem setups
> Did you mean
> require 'rubygems' rescue nil
> above?

DOH. Yes. I meant that.

--
ryand-ruby@zenspider.com - Seattle.rb - http://www.zens...
seattle.rb
http://blog.zens... - http://rubyforge.org/proje...




Florian Frank

6/30/2005 8:46:00 AM

0

Ryan Davis wrote:

>>> require 'rubygems' require nil # require for non-gem setups
>>
>> Did you mean
>> require 'rubygems' rescue nil
>> above?
>
>
> DOH. Yes. I meant that.

I don't think, that this will work.

irb(main):001:0> LoadError.is_a? StandardError
=> false

--
Florian Frank



Florian Frank

6/30/2005 8:48:00 AM

0

Florian Frank wrote:

> irb(main):001:0> LoadError.is_a? StandardError
> => false

What I really meant to say:

LoadError.ancestors.include? StandardError

--
Florian Frank