Ruby1.9.2+Gems: Load path not populated, autoloading fails


R

Rickard Bennekom

Platform: Windows XP 32-Bit.
Preliminaries: Fresh Ruby install (Ruby 1.9.2-p0 Binary).

After running 'gem install nokogiri' (any other gem can be chosen) the
$LOAD_PATH remains unchanged.
Unlike Ruby 1.9.1, the $LOAD_PATH is first populated with the
gem-specific paths after a 'require "nokogiri"'.

Since Rubygems doesn't intercept autoloading, the following snippet
fails on Ruby 1.9.2:

autoload :Nokogiri, 'nokogiri'
Nokogiri

autoload_fail.rb:2:in `<main>': no such file to load -- nokogiri
(LoadError)
 
Ad

Advertisements

L

Luis Lavena

Platform: Windows XP 32-Bit.
Preliminaries: Fresh Ruby install (Ruby 1.9.2-p0 Binary).

After running 'gem install nokogiri' (any other gem can be chosen) the
$LOAD_PATH remains unchanged.
Unlike Ruby 1.9.1, the $LOAD_PATH is first populated with the
gem-specific paths after a 'require "nokogiri"'.

What you;re mentioning is a bug in 1.9.1 bundled RubyGems, which has
been corrected in 1.9.2
Since Rubygems doesn't intercept autoloading, the following snippet
fails on Ruby 1.9.2:

autoload :Nokogiri, 'nokogiri'
Nokogiri

autoload_fail.rb:2:in `<main>': no such file to load -- nokogiri
(LoadError)

Do not use autoload to load code from gems, or at least use "gem
'nokogiri'" to indicate you're going to use it.

See the list of changes and the full changelog of Ruby 1.9.2 for
details on gem_prelude changes and associated bugs.
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top