Rails: how do I resolve the 'rake/rdoctask'' is deprecated' warning?
Asked Answered
T

2

6

Just a forewarning: I'm a rails noob.

When I run:

rake db:migrate

I get this deprecation warning:

WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /Users/username/Code/rails/appname/rake/ruby/1.9.1/gems/rake-0.9.2.2/lib/rake/rdoctask.rb

I'm using:

  • Rails 3.0.1
  • Rake 0.9.2.2
  • RSpec 2.0.1
  • RDoc 3.12

If I uninstall rake 0.9.2.2 and use 0.8.7 there's no warning, but I rather not count that as a solution.

After a google search, many sites say I need to update a line in my Rakefile (basically changing require ‘rake/rdoctask’ to require ‘rdoc/task’). However, my Rakefile looks like this:

require File.expand_path('../config/application', __FILE__)
require 'rake'

AppName::Application.load_tasks

There's no require statement to replace. When I add require 'rdoc/task', it has no effect. When I search the project for the deprecated 'rake/rdoctask', there are no results. So why is rails complaining?

edit: Not sure if it matters, but here's my gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.1'
gem 'sqlite3-ruby', :require => 'sqlite3'

group :development, :test do
   gem 'rspec-rails', '2.0.1'
   gem 'annotate-models', '1.0.4'
end

group :test do
   gem 'rspec', '2.0.1'
   gem 'webrat', '0.7.1'
   gem 'spork', '0.8.4'
end
Thor answered 2/1, 2012 at 15:25 Comment(3)
try bundle exec rake db:migrateJulieannjulien
bundle exec rake db:migrate gives me the same warning.Thor
This warning often follows a GEM that is failing to load or not properly packaged. Do you have any require statements in your migrations or could you post your Gemfile? Update: sorry, long night... just saw the require statements in your OPDiapason
S
7

Note this is fixed in later Rails 3.0.x versions (e.g., Rails 3.0.9).

The fix isn't in the top-level Rakefile but rather in the file mentioned in the error; it's just a general purpose notification:

if Rake.application
  Rake.application.deprecate('require \'rake/rdoctask\'', 'require \'rdoc/task\' (in RDoc 2.4.2+)', __FILE__)
end

It's actually related to something else, though; see this.

Simla answered 2/1, 2012 at 16:14 Comment(2)
Where did you put this? In the Rakefile?Celio
@Celio I didn't put it anywhere; that's the line that prints the warning :)Simla
B
2

this is my rakefile

require File.expand_path('../config/application', __FILE__)
require 'rake'
require 'rake/testtask'
require 'rdoc/task'

# add this (and perhaps make it conditional on Rails.version if you like):
Rake.application.options.ignore_deprecate = true

myapp::Application.load_tasks

that's working for bug notification.

Begot answered 3/10, 2012 at 4:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.