# Rake and rdoc help needed - target seems to be generated twice

**URL:** <https://rubytalk.org/t/rake-and-rdoc-help-needed-target-seems-to-be-generated-twice/26438>\
**Category:** ruby-talk\
**Created:** [5 April 2006 01:13 UTC](https://rubytalk.org/t/rake-and-rdoc-help-needed-target-seems-to-be-generated-twice/26438 "2006-04-05T01:13:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kelly\_Dwight\_Felkins](https://avatars.discourse-cdn.com/v4/letter/k/ecccb3/32.png) [@Kelly\_Dwight\_Felkins](https://rubytalk.org/u/Kelly_Dwight_Felkins)\
**Post date:** [5 April 2006 01:13 UTC](https://rubytalk.org/t/rake-and-rdoc-help-needed-target-seems-to-be-generated-twice/26438/1 "2006-04-05T01:13:00Z")

</div>

Hello,

I set up some rake tasks to generate documentation for my rails app. I  
started with the doc:app task from rails and the rdoctask in rake  
definitions. I'm learning rake so please go easy on me. 😉 Here is what I  
came up with:

desc "Generate API Documentation"  
SRC =  
FileList['doc/README\_FOR\_APP','doc/REQUIREMENTS','doc/DESIGN','app/\*\*/\*.rb']  
file "doc/app/index.html" =\> SRC do  
&nbsp;&nbsp;rm Dir.glob('doc/app/\*\*/\*.html')  
&nbsp;&nbsp;require 'rdoc/rdoc'  
&nbsp;&nbsp;options = []  
&nbsp;&nbsp;options \<\< "-o" \<\< 'doc/app'  
&nbsp;&nbsp;options \<\< "--title" \<\< "Goals System"  
&nbsp;&nbsp;RDoc::RDoc.new.document( options+SRC )  
end

task :gendocs =\> "doc/app/index.html"

desc "Clobber API Documentation"  
task :clobberdocs do  
&nbsp;&nbsp;rm Dir.glob('doc/app/\*\*/\*.html')  
end

When I do

rake --trace gendocs

It appears the documentation is generated, then deleted, then generated  
again.

???

That's my question -- why does it generate, delete, and then generate it  
again.

Additional background:

I'm trying to address 2 problems:

&nbsp;&nbsp;&nbsp;1. I want to include doc/REQUIREMENTS, and doc/DESIGN in my rdoc run.  
&nbsp;&nbsp;&nbsp;2. We have a policy here of saving generated documentation in cvs. The  
&nbsp;&nbsp;&nbsp;rdoctask that comes with rake does a rm\_r, deleting everything in the target  
&nbsp;&nbsp;&nbsp;directory including .CVS files. This makes it difficult to do a commit to  
&nbsp;&nbsp;&nbsp;cvs.

Thank you.

-Kelly

---

<div class="post-metadata">

**Author:** ![Jim\_Weirich1](https://avatars.discourse-cdn.com/v4/letter/j/73ab20/32.png) [@Jim\_Weirich1](https://rubytalk.org/u/Jim_Weirich1)\
**Post date:** [5 April 2006 04:24 UTC](https://rubytalk.org/t/rake-and-rdoc-help-needed-target-seems-to-be-generated-twice/26438/2 "2006-04-05T04:24:47Z")

</div>

Kelly Felkins wrote:

> I set up some rake tasks to generate documentation for my rails app.

[...]

> When I do
> 
> rake --trace gendocs
> 
> It appears the documentation is generated, then deleted, then generated  
> again.
> 
> ???
> 
> That's my question -- why does it generate, delete, and then generate it  
> again.

I'm getting this:

> **···**
>
> -------------------------------------------  
> $ rake gendocs --trace  
> (in /media/hda5/jim/pgm/ruby/rake/docapi)  
> \*\* Invoke gendocs (first\_time)  
> \*\* Invoke doc/app/index.html (first\_time)  
> \*\* Invoke doc/README\_FOR\_APP (first\_time, not\_needed)  
> \*\* Invoke doc/REQUIREMENTS (first\_time, not\_needed)  
> \*\* Invoke doc/DESIGN (first\_time, not\_needed)  
> \*\* Invoke app/code.rb (first\_time, not\_needed)  
> \*\* Execute doc/app/index.html  
> rm doc/app/fr\_file\_index.html doc/app/fr\_class\_index.html  
> doc/app/fr\_method\_index.html doc/app/index.html  
> doc/app/files/doc/README\_FOR\_APP.html  
> doc/app/files/doc/REQUIREMENTS.html doc/app/files/doc/DESIGN.html  
> doc/app/files/app/code\_rb.html doc/app/classes/Code.html
> 
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;README\_FOR\_APP:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;REQUIREMENTS:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DESIGN:  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;code.rb: c  
> Generating HTML...
> 
> Files: 4  
> Classes: 1  
> Modules: 0  
> Methods: 0  
> Elapsed: 0.079s  
> \*\* Execute gendocs  
> -------------------------------------------
> 
> It looks ok to me. Are you getting something different?
> 
> --  
> -- Jim Weirich
> 
> --  
> Posted via [http://www.ruby-forum.com/\](http://www.ruby-forum.com/%5C).
