总之,我有以下问题 my Ruby Gem project:
rake doc
本地运行没有问题。 (Ruby 2.3.1)rake doc
错误。 (Ruby 2.5)bundle exec rake doc
在本地出错,但错误相同。 (Ruby 2.3.1)怎么可能?
现在了解详情。我的相关部分
gemspec
是:
s.add_development_dependency 'github-markup', '~> 2.0'
s.add_development_dependency 'rake', '~> 12.3'
s.add_development_dependency 'redcarpet', '~> 3.4'
s.add_development_dependency 'yard', '~> 0.9'
s.metadata['yard.run'] = 'yri' # use "yard" to build full HTML docs.
我像往常一样用bundle install
安装依赖项。
而我的
Rakefile
:
require 'yard'
desc 'Build documentation'
YARD::Rake::YardocTask.new do |t|
t.name = 'doc'
t.options = %w(--markup-provider=redcarpet --markup=markdown --main=README.md)
end
在 errors I get 是:
rake aborted!
ArgumentError: wrong number of arguments (given 1, expected 0)
/usr/local/bundle/gems/yard-0.9.12/lib/yard/logging.rb:44:in `initialize'
<snip>
/usr/local/bundle/gems/yard-0.9.12/lib/yard/rake/yardoc_task.rb:74:in `block in define'
/usr/local/bundle/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:104:in `load'
/usr/local/bundle/bin/bundle:104:in `<main>'
Caused by:
NameError: undefined method `<<' for class `YARD::Logger'
Did you mean? <
/usr/local/bundle/gems/yard-0.9.12/lib/yard/logging.rb:136:in `<class:Logger>'
<snip>
/usr/local/bundle/gems/yard-0.9.12/lib/yard/cli/yardoc.rb:245:in `run'
/usr/local/bundle/gems/yard-0.9.12/lib/yard/rake/yardoc_task.rb:74:in `block in define'
/usr/local/bundle/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
/usr/local/bundle/bin/bundle:104:in `load'
/usr/local/bundle/bin/bundle:104:in `<main>'
查找bundle exec rake doc --trace
的完整输出
here
这看起来非常错误。
在当地,我有 many more gems installed 比起这个项目所要求的那些,所以我怀疑Rake与YARD的组合/配置可能隐含地取决于其他一些宝石。没有一个接一个地,然后两个接一个,等等,有没有办法诊断这个问题?是否有任何我可能陷入的规范陷阱?