<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Depth-First: Tag rdoc</title>
    <link>http://depth-first.com/articles/tag/rdoc</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Walking the Web of Chemical Informatics</description>
    <item>
      <title>Source Code Documentation in Ruby: RDoc for Ruby CDK</title>
      <description>&lt;p&gt;&lt;a href="http://ruby-lang.org"&gt;&lt;img src="http://depth-first.com/files/ruby_logo_new.gif" border="0" align="right"&gt;&lt;/img&gt;&lt;/a&gt;Good source code documentation tools can greatly enhance developer productivity at almost no cost. By eliminating the need to dig through source code files for documentation, tools like Java's &lt;a href="http://java.sun.com/j2se/javadoc/"&gt;Javadoc&lt;/a&gt; are invaluable for quickly seeing the big picture of a new piece of software. They are also handy as a quick reminder for more familiar APIs.&lt;/p&gt;

&lt;p&gt;Ruby comes complete with a source code documentation tool called "RDoc." Running RDoc over your Ruby source produces a group of cross-linked HTML files in a manner analogous to Javadoc.&lt;/p&gt;

&lt;p&gt;The &lt;a href="http://depth-first.com/articles/2006/10/30/agile-chemical-informatics-development-with-cdk-and-ruby-rcdk-0-3-0"&gt;Ruby CDK&lt;/a&gt; distribution contains HTML API documentation generated by RDoc and located in the &lt;strong&gt;doc&lt;/strong&gt; subdirectory. This documentation was automatically generated with a task written for Ruby's build system, &lt;a href="http://docs.rubyrake.org/"&gt;Rake&lt;/a&gt;. This task, contained in the file &lt;strong&gt;Rakefile&lt;/strong&gt;, is shown below:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="constant"&gt;Rake&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;RDocTask&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
  &lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;rdoc_dir&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;doc&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
  &lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;title&lt;/span&gt;    &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;Ruby CDK&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;&lt;/span&gt;
  &lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;rdoc_files&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;include&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;README&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt;
  &lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;options&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;--line-numbers&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
  &lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;options&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;--inline-source&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
  &lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;options&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;--main&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="punct"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;README&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
  &lt;span class="ident"&gt;rdoc&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;rdoc_files&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;include&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;lib/**/*.rb&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Unlike Java's build tool, &lt;a href="http://ant.apache.org/"&gt;Ant&lt;/a&gt;, Rake isn't based on XML. Instead, the entire build system is pure Ruby. This introduces a level of clarity and brevity into the build process that simply doesn't exist with Ant.&lt;/p&gt;

&lt;p&gt;Ruby CDK's RDoc task extends the built-in Rake task named appropriately enough &lt;tt&gt;RDocTask&lt;/tt&gt;. The customization of this task lies completely within the constructor block. Among other modifications, this block activates inlined source code with line numbers, a very handy feature given Ruby's highly dynamic nature.&lt;/p&gt;

&lt;p&gt;As a convenience, &lt;a href="http://depth-first.com/doc/rcdk/"&gt;Ruby CDK's RDoc documentation&lt;/a&gt; is now available online. The API and schema documentation for my other software projects will appear soon on Depth-First in the sidebar to the right.&lt;/p&gt;</description>
      <pubDate>Tue, 05 Dec 2006 14:36:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:0bb72cfb-1fb1-400e-8b8d-75395b5813eb</guid>
      <author>Rich Apodaca</author>
      <link>http://depth-first.com/articles/2006/12/05/source-code-documentation-in-ruby-rdoc-for-ruby-cdk</link>
      <category>Tools</category>
      <category>ruby</category>
      <category>rake</category>
      <category>rdoc</category>
      <category>build</category>
      <category>documentation</category>
    </item>
  </channel>
</rss>
