This project is archived and is in readonly mode.

#6663 new
Samu Voutilainen

Loading rails/cli with missing plugin provides obscure error

Reported by Samu Voutilainen | April 1st, 2011 @ 02:02 PM

In Gentoo ebuilds there is bug that Rails doesn’t depend on rake where railties needs it. When trying to use rails(with any argument), one gets fun error message:

www ~ # rails -v
/usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require': no such file to load -- rails/cli (LoadError)

    from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
    from /usr/lib64/ruby/gems/1.8/gems/rails-3.0.3/bin/rails:8
    from /usr/bin/rails:8:in `load'
    from /usr/bin/rails:8

Loading this file manually does work:

www ~ # cat foo.rb
require "rails/cli"

www ~ # ruby foo.rb
/usr/lib64/ruby/site_ruby/1.8/rubygems.rb:779:in `report_activate_error': Could not find RubyGem rake (>= 0.8.7) (Gem::LoadError)

    from /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
    from /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:249:in `activate'
    from /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:248:in `each'
    from /usr/lib64/ruby/site_ruby/1.8/rubygems.rb:248:in `activate'
    from /usr/lib64/ruby/site_ruby/1.8/rubygems/custom_require.rb:35:in `require'
    from foo.rb:3

The cause for this dummy error is in file
www ~ # head -n10 /usr/lib64/ruby/gems/1.8/gems/rails-3.0.3/bin/rails

!/usr/bin/env ruby

begin
require "rails/cli" rescue LoadError
railties_path = File.expand_path('../../railties/lib', FILE) $:.unshift(railties_path) require "rails/cli" end

Here, since require fails due missing plugin, it tries with invalid path and is trying to tell that actual plugin is missing. Commenting other stuff than require gives real error. Actual problem fixed out by installing rake too, making requiring work as expected.

No comments found

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

People watching this ticket

Pages