6

我已经安装了 MacPorts 的 Ruby on Rails,从昨天开始我一直在更新和修改它,因为我想重新学习这门语言。

眼镜

ruby -v
ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-darwin10]
rails -v
Rails 3.0.3
gem -v
1.8.5

旅程

到目前为止,让 Ruby、Rails 和 Gems 在我的 Mac 上运行是一段相当长的旅程。在遵循教程后,我决定安装/更新 Rails API 文档,但遇到了以下错误

Password:
NOTE: Gem::SourceIndex.from_installed_gems is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::SourceIndex.from_installed_gems called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/rdoc_command.rb:58.
NOTE: Gem::SourceIndex.installed_spec_directories is deprecated, use Specification.dirs. It will be removed on or after 2011-11-01.
Gem::SourceIndex.installed_spec_directories called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:47.
NOTE: Gem::SourceIndex.from_gems_in is deprecated with no replacement. It will be removed on or after 2011-10-01.
Gem::SourceIndex.from_gems_in called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:47.
NOTE: Gem::SourceIndex#initialize is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#initialize called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:67.
NOTE: Gem::SourceIndex#spec_dirs= is deprecated, use Specification.dirs=. It will be removed on or after 2011-11-01.
Gem::SourceIndex#spec_dirs= called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:94.
NOTE: Gem::SourceIndex#refresh! is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#refresh! called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:95.
NOTE: Gem::SourceIndex#load_gems_in is deprecated with no replacement. It will be removed on or after 2011-11-01.
Gem::SourceIndex#load_gems_in called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:320.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#add_spec called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/source_index.rb:127.
NOTE: Gem::SourceIndex#add_spec is deprecated, use Specification.add_spec. It will be removed on or after 2011-11-01.
Gem::SourceIndex#each called from /opt/local/lib/ruby/site_ruby/1.8/rubygems/commands/rdoc_command.rb:58.
Installing ri documentation for activesupport-3.2.3...

unrecognized option `--encoding'

For help on options, try 'rdoc --help'

ERROR:  While generating documentation for activesupport-3.2.3
... MESSAGE:   exit
... RDOC args: --ri --op /opt/local/lib/ruby/gems/1.8/doc/activesupport-3.2.3/ri --encoding UTF-8 lib --title activesupport-3.2.3 Documentation --quiet

当我这样做时gem server,服务器已启动。所以我可能在一年前安装了文档并且完全忘记了它。

我该怎么做才能摆脱所有这些错误?或者我可以安全地忽略它们并继续前进吗?

4

3 回答 3

8

您可以放心地忽略这些错误。

gem install rails --no-ri --no-rdoc现在,您可以通过指定安装 Rails来安装 gems而不会出现这些错误。

将来,您可以添加:

gem: --no-ri --no-rdoc

到您的~/.gemrc文件中,以全局忽略未来 gem 安装的文档。

此外,如果您刚刚开始,我建议您使用 ruby​​ 版本管理器,例如rvmrbenv。在管理不同的 ruby​​ 版本和 gemset 时,它让生活变得如此轻松。

于 2012-05-13T04:17:09.683 回答
5

尝试gem install rdoc或者 gem update rdoc如果您的 rdoc 版本 < 3.0。

RDoc 从 Ruby 源文件生成文档。因此,正如@Mark Sands 所说,让您的代码运行并不是绝对必要的,拥有并解决错误的根源可能会很好。

于 2013-01-31T16:11:25.460 回答
3

我在 linux 上得到了同样的警告Debian,我正在使用rvmwith ruby-1.9.3-p194

我通过更改第 127 行消除了它们中的大部分

~/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/source_index.rb  

127 add_spec gemspec if gemspec127 Gem::Specification.add_spec gemspec if gemspec

至于其他人,他们说已弃用,没有替代品。

我只发现了这个线程,因为我想了解更多关于这些的信息。有人认为有更新吗?警告声明这些将在 或之后被删除2011-11-01。时间已经过去了。

于 2012-08-28T15:45:50.723 回答