Rails 2.3.12 throws uninitialized constant RDoc (NameError) on boot #1551

Closed
jamesbebbington opened this Issue Jun 8, 2011 · 20 comments

Comments

Projects
None yet
@jamesbebbington

Having updated rails from 2.3.11 to 2.3.12 our app (which uses bundler) now fails to boot:

$ rake --trace
(in /Users/fractious/application)
rake aborted!
uninitialized constant RDoc
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@application/gems/rails-2.3.12/lib/tasks/documentation.rake:3
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:1882:in `in_namespace'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:910:in `namespace'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@application/gems/rails-2.3.12/lib/tasks/documentation.rake:1
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@application/gems/rails-2.3.12/lib/tasks/rails.rb:4:in `load'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@application/gems/rails-2.3.12/lib/tasks/rails.rb:4
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@application/gems/rails-2.3.12/lib/tasks/rails.rb:4:in `each'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@application/gems/rails-2.3.12/lib/tasks/rails.rb:4
/Users/fractious/application/Rakefile:10:in `require'
/Users/fractious/application/Rakefile:10
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/gems/rake-0.8.7/bin/rake:31
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/bin/rake:19:in `load'
/Users/fractious/.rvm/gems/ree-1.8.7-2011.03@global/bin/rake:19

$ cat Rakefile
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require(File.join(File.dirname(__FILE__), 'config', 'boot'))

require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'

require 'tasks/rails'

# delayed_job tasks
begin
  require 'delayed/tasks'
rescue LoadError
  STDERR.puts "Run `rake gems:install` to install delayed_job"
end

It looks like it might be this commit that has caused the breakage.

I figured there might now be a unspecified dependency on the rdoc gem but specifying it in our GemFile doesn't help.

$ gem list

*** LOCAL GEMS ***

aasm (2.2.0)
abstract (1.0.0)
actionmailer (2.3.12, 2.3.11)
actionpack (2.3.12, 2.3.11)
activerecord (2.3.12, 2.3.11)
activeresource (2.3.12, 2.3.11)
activesupport (2.3.12, 2.3.11)
ansi (1.2.5)
attribute_normalizer (1.0.0.pre3, 0.3.1)
authlogic (2.1.1)
autotest-fsevent (0.2.5)
autotest-rails (4.1.0)
awesome_print (0.4.0)
aws-s3 (0.6.2)
builder (3.0.0)
bundler (1.0.14)
chronic (0.2.3)
compass (0.10.2)
daemon_controller (0.2.6)
daemons (1.0.10)
delayed_job (2.0.7)
delorean (0.1.1)
erubis (2.6.5)
factory_girl (1.2.3)
faker (0.3.1)
fastthread (1.0.7)
haml (3.0.10)
hoe (2.3.3)
hookup (1.0.3)
hoptoad_notifier (2.4.2)
i18n (0.4.1)
json_pure (1.5.1)
mail_safe (0.2.0)
metaid (1.0)
mime-types (1.16)
mocha (0.9.8)
multipart-post (1.1.2)
mysql (2.8.1)
newrelic_rpm (3.0.1)
nokogiri (1.3.3)
passenger (3.0.7)
rack (1.1.2)
rack-test (0.6.0)
rails (2.3.12, 2.3.11)
rainbow (1.1.1)
rake (0.8.7)
RedCloth (4.2.3)
redgreen (1.2.2)
roleful (0.0.4)
rubyforge (2.0.4)
shoulda (2.10.2)
sinatra (1.2.6)
sprockets (1.0.2)
sys-uname (0.8.5)
tilt (1.3.2)
trollop (1.16.2)
web_translate_it (1.8.1.0, 1.8.0.1, 1.7.3.0)
webrat (0.7.1)
xml-simple (1.0.16)
ZenTest (4.4.0)

Generating a fresh rails 2.3.12 application using this gemset also results in the same exception being thrown.

@jamesbebbington

This comment has been minimized.

Show comment Hide comment
@jamesbebbington

jamesbebbington Jun 8, 2011

On further investigation it appears that even though the rails gem specifies a dependency on rake >= 0.8.3 it is incompatible with v0.8.7. Updating to rake v0.9.2 fixes this issue. I'll investigate further to find the minimum version of rake needed.

On further investigation it appears that even though the rails gem specifies a dependency on rake >= 0.8.3 it is incompatible with v0.8.7. Updating to rake v0.9.2 fixes this issue. I'll investigate further to find the minimum version of rake needed.

@jamesbebbington

This comment has been minimized.

Show comment Hide comment
@jamesbebbington

jamesbebbington Jun 8, 2011

So it appears that rake >= 0.9.0 is a requirement for rails 2.3.12.

So it appears that rake >= 0.9.0 is a requirement for rails 2.3.12.

@tenderlove

This comment has been minimized.

Show comment Hide comment
@tenderlove

tenderlove Jun 8, 2011

Member

@Fractious can you try installing the latest RDoc gem too? I think it might clear up the problem.

Member

tenderlove commented Jun 8, 2011

@Fractious can you try installing the latest RDoc gem too? I think it might clear up the problem.

@jamesbebbington

This comment has been minimized.

Show comment Hide comment
@jamesbebbington

jamesbebbington Jun 8, 2011

Hey @tenderlove I did mention that above; I tried installing the latest RDoc but that didn't help.

Hey @tenderlove I did mention that above; I tried installing the latest RDoc but that didn't help.

@tenderlove

This comment has been minimized.

Show comment Hide comment
@tenderlove

tenderlove Jun 8, 2011

Member

Ah, yes. This is a problem with rake. Unfortunately you will need to use 0.9.2. :-(

I think 0.9.0 is the minimum, but I'm not sure.

Member

tenderlove commented Jun 8, 2011

Ah, yes. This is a problem with rake. Unfortunately you will need to use 0.9.2. :-(

I think 0.9.0 is the minimum, but I'm not sure.

@jamesbebbington

This comment has been minimized.

Show comment Hide comment
@jamesbebbington

jamesbebbington Jun 8, 2011

@tenderlove yeah 0.9.0 does appear to be the minimum. The rails gem spec does specify >= 0.8.3 though, so I guess that needs updating.

I'd post a patch but I'm not set up for testing rails and it's only a one-liner so figured someone on core could easily make the change.

@tenderlove yeah 0.9.0 does appear to be the minimum. The rails gem spec does specify >= 0.8.3 though, so I guess that needs updating.

I'd post a patch but I'm not set up for testing rails and it's only a one-liner so figured someone on core could easily make the change.

@ctm

This comment has been minimized.

Show comment Hide comment
@ctm

ctm Jun 8, 2011

Contributor

I ran into the same problem. Upgrading to rake 0.9.2 alone didn't do it. I had to add rdoc to my Gemfile, too.

Contributor

ctm commented Jun 8, 2011

I ran into the same problem. Upgrading to rake 0.9.2 alone didn't do it. I had to add rdoc to my Gemfile, too.

@aselder

This comment has been minimized.

Show comment Hide comment
@aselder

aselder Jun 8, 2011

I was able to work around this by changing

require 'rake/rdoctask' => require 'rdoc/task'

in my rake file

aselder commented Jun 8, 2011

I was able to work around this by changing

require 'rake/rdoctask' => require 'rdoc/task'

in my rake file

@matthewrudy

This comment has been minimized.

Show comment Hide comment
@matthewrudy

matthewrudy Jun 9, 2011

Contributor

I think the only real thing you need to do is add "rdoc" to your gemfile
But it makes sense to change your Rakefile to use the new "rdoc/task".

But here is my diff.

--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
-gem "rails", "2.3.11"
+gem "rails", "2.3.12"
 gem "mysql"
+# required for rails 2.3.12 to work
+gem "rdoc"
+

--- a/Rakefile
+++ b/Rakefile
 require 'rake'
 require 'rake/testtask'
-require 'rake/rdoctask'
+require 'rdoc/task'
Contributor

matthewrudy commented Jun 9, 2011

I think the only real thing you need to do is add "rdoc" to your gemfile
But it makes sense to change your Rakefile to use the new "rdoc/task".

But here is my diff.

--- a/Gemfile
+++ b/Gemfile
@@ -1,6 +1,6 @@
-gem "rails", "2.3.11"
+gem "rails", "2.3.12"
 gem "mysql"
+# required for rails 2.3.12 to work
+gem "rdoc"
+

--- a/Rakefile
+++ b/Rakefile
 require 'rake'
 require 'rake/testtask'
-require 'rake/rdoctask'
+require 'rdoc/task'
@lagartoflojo

This comment has been minimized.

Show comment Hide comment
@lagartoflojo

lagartoflojo Jun 13, 2011

Rails 2.3.12 works fine with Rake 0.8.7 after applying the changes posted by @matthewrudy.

Rails 2.3.12 works fine with Rake 0.8.7 after applying the changes posted by @matthewrudy.

@swaj

This comment has been minimized.

Show comment Hide comment
@swaj

swaj Jun 16, 2011

The @matthewrudy method worked for me too using rails 2.3.12 and rake 0.8.7. Unfortunately in my environment, upgrading to rake 0.9.2 isn't an option because passenger 3.0.7 breaks when using it.

swaj commented Jun 16, 2011

The @matthewrudy method worked for me too using rails 2.3.12 and rake 0.8.7. Unfortunately in my environment, upgrading to rake 0.9.2 isn't an option because passenger 3.0.7 breaks when using it.

@chiragsinghal

This comment has been minimized.

Show comment Hide comment
@chiragsinghal

chiragsinghal Jun 28, 2011

Contributor

+1 for solution by @matthewrudy. Works for me also that way

Contributor

chiragsinghal commented Jun 28, 2011

+1 for solution by @matthewrudy. Works for me also that way

jake3030 pushed a commit to jake3030/rails that referenced this issue Jun 28, 2011

Don't use the transaction instance method so that people with has_one…
…/belongs_to :transaction aren't fubared

[#1551 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
@supairish

This comment has been minimized.

Show comment Hide comment
@supairish

supairish Jul 5, 2011

This also worked for my project, thanks!

This also worked for my project, thanks!

@tjgfernandes

This comment has been minimized.

Show comment Hide comment
@tjgfernandes

tjgfernandes Jul 12, 2011

+1 for solution by @matthewrudy.

+1 for solution by @matthewrudy.

@chillicoder

This comment has been minimized.

Show comment Hide comment
@chillicoder

chillicoder Jul 14, 2011

+1 for solution by @matthewrudy it also worked for me

+1 for solution by @matthewrudy it also worked for me

@rebelcolony

This comment has been minimized.

Show comment Hide comment
@rebelcolony

rebelcolony Sep 8, 2011

that solution didn't work for me

#Gemfile
gem "rails", "2.3.12"
gem "rdoc"
gem "rake", "0.8.7"

#Rakefile
require 'rake'
require 'rake/testtask'
require 'tasks/rails'
require 'rdoc/task'

that solution didn't work for me

#Gemfile
gem "rails", "2.3.12"
gem "rdoc"
gem "rake", "0.8.7"

#Rakefile
require 'rake'
require 'rake/testtask'
require 'tasks/rails'
require 'rdoc/task'

@tjgfernandes

This comment has been minimized.

Show comment Hide comment
@tjgfernandes

tjgfernandes Sep 8, 2011

try to remove the last line from your Gemfile....

try to remove the last line from your Gemfile....

@rebelcolony

This comment has been minimized.

Show comment Hide comment
@rebelcolony

rebelcolony Sep 8, 2011

[21:36:48]kevin[ndthub]$ rake -T
rake aborted!
uninitialized constant RDoc

(See full trace by running task with --trace)
[21:36:56]kevin[ndthub]$ rake --trace
rake aborted!
uninitialized constant RDoc
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in const_missing' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/documentation.rake:3 /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/task_manager.rb:207:inin_namespace'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/dsl_definition.rb:95:in namespace' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/documentation.rake:1 /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4:inload'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4:in each' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4 /Users/kevin/projects/ndthub/Rakefile:8:inrequire'
/Users/kevin/projects/ndthub/Rakefile:8
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in load' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/rake_module.rb:25:inload_rakefile'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:495:in raw_load_rakefile' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:78:inload_rakefile'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:77:inload_rakefile'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:61:in run' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:59:in run' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/bin/rake:32 /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/bin/rake:19:inload'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/bin/rake:19

[21:36:48]kevin[ndthub]$ rake -T
rake aborted!
uninitialized constant RDoc

(See full trace by running task with --trace)
[21:36:56]kevin[ndthub]$ rake --trace
rake aborted!
uninitialized constant RDoc
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in const_missing' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/documentation.rake:3 /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/task_manager.rb:207:inin_namespace'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/dsl_definition.rb:95:in namespace' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/documentation.rake:1 /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4:inload'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4:in each' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/gems/rails-2.3.12/lib/tasks/rails.rb:4 /Users/kevin/projects/ndthub/Rakefile:8:inrequire'
/Users/kevin/projects/ndthub/Rakefile:8
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/rake_module.rb:25:in load' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/rake_module.rb:25:inload_rakefile'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:495:in raw_load_rakefile' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:78:inload_rakefile'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:77:inload_rakefile'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:61:in run' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/lib/rake/application.rb:59:in run' /Users/kevin/.rvm/gems/ruby-1.8.7-p352@global/gems/rake-0.9.2/bin/rake:32 /Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/bin/rake:19:inload'
/Users/kevin/.rvm/gems/ruby-1.8.7-p352@rails2/bin/rake:19

@rebelcolony

This comment has been minimized.

Show comment Hide comment
@rebelcolony

rebelcolony Sep 9, 2011

the last 2 lines of my Rakefile were the wrong way around. now the solution by @matthewrudy works for me

#Rakefile
require(File.join(File.dirname(FILE), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'tasks/rails'

the last 2 lines of my Rakefile were the wrong way around. now the solution by @matthewrudy works for me

#Rakefile
require(File.join(File.dirname(FILE), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rdoc/task'
require 'tasks/rails'

@rafaelfranca

This comment has been minimized.

Show comment Hide comment
@rafaelfranca

rafaelfranca Mar 31, 2012

Member

So I guess we can close this issue. Thanks for sharing the solution.

Member

rafaelfranca commented Mar 31, 2012

So I guess we can close this issue. Thanks for sharing the solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment