Domanda

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
È stato utile?

Soluzione

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.

Altri suggerimenti

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top