我已经安装了Ruby on Rails的MacPorts,我从昨天起就一直在更新和改造,因为我想重新学习这门语言。
功能
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
服务器启动时。所以我可能在一年前安装了docs并完全忘了它。
我可以做些什么来摆脱所有这些错误?或者我可以安全地忽略它们并继续前进吗?
答案 0 :(得分:8)
您可以放心地忽略这些错误。
现在,您可以通过指定gem install rails --no-ri --no-rdoc
安装Rails来安装Gems,而不会出现这些错误。
将来,您可以添加:
gem: --no-ri --no-rdoc
到您的~/.gemrc
文件,全局忽略未来gem安装的文档。
此外,如果您刚开始使用,我建议您使用ruby版本管理器,例如rvm或rbenv。在管理不同的ruby版本和gemsets时,它使生活变得更加容易。
答案 1 :(得分:5)
如果您拥有rdoc版本< {p>请尝试gem install rdoc
或gem update rdoc
3.0。
RDoc从Ruby Source Files生成文档。因此,正如@Mark Sands所说,使代码运行并不是绝对必要的,因此可以很好地解决错误的根源。
答案 2 :(得分:3)
我在Debian
linux上收到了相同的警告,我正在rvm
使用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 gemspec
至127 Gem::Specification.add_spec gemspec if gemspec
至于其他人,他们说弃用了,没有替换。
我只发现了这个帖子,因为我试图找到更多关于这些的信息。
有人认为有更新吗?
警告声明这些将在2011-11-01
之后或之后删除。
时间已经过去了。