我在 OSX 上的 Ruby 2.0.0 (rvm)下运行Rails 3.2.14。当我尝试访问大多数方法的 ri 文档时,我得到以下堆栈跟踪。
堆栈跟踪:
/Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:196:in `load': instance of RDoc::Context::Section needs to have method `marshal_load' (TypeError)
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:196:in `block in load_class'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:195:in `open'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/store.rb:195:in `load_class'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:609:in `block in classes_and_includes_for'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:607:in `map'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:607:in `classes_and_includes_for'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:681:in `display_class'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:712:in `display_name'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:739:in `block in display_names'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:736:in `each'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:736:in `display_names'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:1137:in `run'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/lib/rdoc/ri/driver.rb:320:in `run'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/gems/rdoc-3.12.2/bin/ri:12:in `<top (required)>'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ri:23:in `load'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ri:23:in `<main>'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ruby_noexec_wrapper:14:in `eval'
from /Users/daryl/.rvm/gems/ruby-2.0.0-p195@deals/bin/ruby_noexec_wrapper:14:in `<main>'
我认为问题与默认为RDoc 4.0的 Ruby 2 有关,而由于依赖关系,捆绑程序环境正在使用RDoc 3.12.2 :
journey-1.0.4 depends on rdoc (~> 3.11, development)
journey-1.0.4 depends on rdoc (~> 3.10, development)
tilt-1.4.1 depends on rdoc (>= 0, development)
tilt-1.4.1 depends on rdoc (>= 0, development)
mail-2.5.4 depends on rdoc (>= 0, development)
rdoc-3.12.2 depends on rdoc (~> 3.10, development)
railties-3.2.14 depends on rdoc (~> 3.4)
kaminari-0.14.1 depends on rdoc (>= 0, development)
arel-3.0.2 depends on rdoc (~> 3.10, development)
nokogiri-1.6.0 depends on rdoc (~> 3.10, development)
launchy-2.3.0 depends on rdoc (~> 3.12, development)
oauth2-0.8.1 depends on rdoc (>= 0, development)
sqlite3-1.3.7 depends on rdoc (~> 3.10, development)
uglifier-2.1.1 depends on rdoc (>= 3.11, development)
我的猜测是,当 gem 生成 ri 文档时,它使用的是rdoc 4.0.0,但随后使用3.12.2来尝试阅读它。在我的 Rails 项目上下文之外访问文档没有问题。
有什么建议么?我猜这可能不再是Rails 4中的问题,但目前这不是一个真正的选择。
非常感谢!