From: Eric Hodel Date: 2011-02-12T04:05:01+09:00 Subject: Re: Telling rdoc1.9 not delete the doc directory when publishing new documenation On Feb 11, 2011, at 6:46 AM, Zeno Davatz wrote: > Hi > > I know that with > > rdoc1.9 --op doc3 > > I can set a specific doc directory where rdoc1.9 should publish the > documentation to. > > BUT: > > rdoc1.9 always _deletes_ the old doc dir before publishing the new one! > So If I got another doc Directory there and that has other stuff in it > then I do not appreciate it when that directory is just overwritten or > deleted with out myself being asked if I want it deleted or not. > > So my question is: Is there any possibility to tell rdoc1.9 not to > delete any existing doc directory? The rdoc command has never deleted directories. RDoc has always preserved existing directories that were not used for rdoc output. The latest gem does not: $ gem unpack rdoc Unpacked gem: '/Users/ehodel/Work/git/rdoc/tmp/rdoc-3.5.2' $ cd rdoc-3.5.2/ ./rdoc-3.5.2/ $ grep -r \\.rm lib lib/rdoc/gauntlet.rb: FileUtils.rm_rf dir if File.exist? dir lib/rdoc/gauntlet.rb: FileUtils.rm_rf dir $ Nor does the version shipped with 1.9.2-p136 (rdoc 2.5.8) $ ~/.multiruby/install/1.9.2-p136/bin/ruby -v ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0] $ ~/.multiruby/install/1.9.2-p136/bin/gem which rdoc /Users/ehodel/.multiruby/install/1.9.2-p136/lib/ruby/1.9.1/rdoc.rb $ cd /Users/ehodel/.multiruby/install/1.9.2-p136/lib/ruby/1.9.1/ $ grep -r \\.rm rdoc.rb rdoc $ Nor does the version shipped with 1.9.1-p378 (rdoc 2.2.2) $ ~/.multiruby/install/1.9.1-p378/bin/ruby -v ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.6.0] $ cd /Users/ehodel/.multiruby/install/1.9.1-p378/lib/ruby/1.9.1/ $ grep -r \\.rm rdoc.rb rdoc rdoc/ri/writer.rb: FileUtils.rm_rf(path_to_dir(class_desc.full_name)) This rm_rf is called by the (old) ri generator when it is merging classes. The class is immediately replaced by the merged copy. Same for ruby 1.8.7-p330 (rdoc 1.0.1) $ ~/.multiruby/install/1.8.7-p330/bin/ruby -v ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10.6.0] $ cd ~/.multiruby/install/1.8.7-p330/lib/ruby/1.8/ $ grep -r \\.rm rdoc rdoc/ri/ri_writer.rb: FileUtils.rm_rf(path_to_dir(class_desc.full_name)) (no rdoc.rb in 1.0.1) The RDoc rake task adds a clobber task for deleting the rdoc output directory. Since the files are generated this should not be a problem.