Generate YARD Docs for Your Gem

By Loren Segal on November 11, 2009 at 1120:1042:06 PM

A little tidbit that most people don’t know about is that since 0.2.3.5, YARD can actually be used in place of RDoc to generate documentation when a gem is installed. All you need to do is add the following to your .gemspec:

SPEC = Gem::Specification.new do |s|
  ...
  s.has_rdoc = 'yard'
end

If you use BlueCloth or another lib to do your markdown processing, you'll need to add that as a dependency to your gem.

And with that, YARD will generate docs when your gem is installed if YARD is on the user’s system. This works with RubyGems 1.3.1+. Best part of all, it integrates perfectly seamlessly with your RubyGems doc server. gem server will show YARD docs for the rdoc link of your project.

Questions? Comments? Follow me on Twitter (@lsegal) or email me.