gpt4 book ai didi

ruby - 使用 rakefile 从源代码生成文档

转载 作者:数据小太阳 更新时间:2023-10-29 07:02:42 25 4
gpt4 key购买 nike

我下载了 ruby​​ Twitter gem 源代码并尝试使用 yard 生成文档,我通过 gem install yard 安装了它。在 rakefile 中,我发现了以下内容,我认为它用于为 Twitter gem 生成文档:

require 'yard'
YARD::Rake::YardocTask.new

我尝试在 irb 中require yard 然后运行 ​​YARD::Rake::YardocTask.new 但没有任何反应。

你能帮我走上正轨吗?

最佳答案

来自 the YARD docs :

The second most obvious is to generate docs via a Rake task. You can do this by adding the following to your Rakefile:

YARD::Rake::YardocTask.new do |t|
t.files = ['lib/**/*.rb', OTHER_PATHS] # optional
t.options = ['--any', '--extra', '--opts'] # optional
end

both the files and options settings are optional. files will default to lib/**/*.rb and options will represents any options you might want to add. Again, a full list of options is available by typing yardoc --help in a shell. You can also override the options at the Rake command-line with the OPTS environment variable:

$ rake yard OPTS='--any --extra --opts'

总结:将 YARD::Rake::YardocTask.new 添加到您的 Rakefile 后,运行 rake yard

关于ruby - 使用 rakefile 从源代码生成文档,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13022837/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com