Rails:如何解决"rake/rdoctask"已过时"警告? [英] Rails: how do I resolve the 'rake/rdoctask'' is deprecated' warning?

查看:122
本文介绍了Rails:如何解决"rake/rdoctask"已过时"警告?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只是一个警告:我是Rails菜鸟.

Just a forewarning: I'm a rails noob.

当我跑步时:

rake db:migrate

我收到此弃用警告:

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

我正在使用:

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

如果我卸载rake 0.9.2.2并使用0.8.7,则没有警告,但我不认为这是解决方案.

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.

在Google搜索之后,许多网站都说我需要更新Rakefile中的一行(基本上更改要求为"rake/rdoctask",而要求为"rdoc/task").但是,我的Rakefile看起来像这样:

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

没有require语句可以替换.当我添加要求'rdoc/task'时,它没有任何作用.当我在项目中搜索已过时的"rake/rdoctask"时,没有结果.那么,为什么Rails会抱怨呢?

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?

不确定是否重要,但这是我的gemfile:

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

推荐答案

请注意,此问题已在更高的Rails 3.0.x版本(例如Rails 3.0.9)中修复.

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

此修复程序不在顶级Rakefile中,而是在错误中提到的文件中;这只是一个通用通知:

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.

这篇关于Rails:如何解决"rake/rdoctask"已过时"警告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆