[Rubygems-developers] Question about RDoc Files

Jim Weirich jim at weirichhouse.org
Wed Jun 16 02:03:23 EDT 2004

Chad Fowler wrote:
>> This can probably be easily fixed, but before I make any changes, was 
>> the choice of absolute file names deliberate? (or arbitrary ... sorry, 
>> don't go there).  I seem to recall some rdoc path problems with 
>> windows machines and don't want to break anything there.
> I could accept absolutely no less than absolute file names.

Yes, you could accept that, which leaves open the possibility that you 
could also accept relatively no less than relative file names.

I think ??

> I say give the change a try. :)

I have done so and have included the patch below.  I didn't apply it to 
the source, because it does touch the code that detects drive letters to 
support rdocs on a different windows drive than the current directory (I 
_think_ that's the purpose of the code).

So, could someone on a windows box could try the patch and see if I 
broke --gen-rdoc on a windows platform?


-- Jim Weirich    jim at weirichhouse.org     http://onestepback.org
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

cvs diff: Diffing lib
cvs diff: Diffing lib/rubygems
Index: lib/rubygems/doc_manager.rb
RCS file: /var/cvs/rubygems/rubygems/lib/rubygems/doc_manager.rb,v
retrieving revision 1.14
diff -u -r1.14 doc_manager.rb
--- lib/rubygems/doc_manager.rb	11 Jun 2004 03:15:47 -0000	1.14
+++ lib/rubygems/doc_manager.rb	16 Jun 2004 05:51:19 -0000
@@ -44,25 +44,18 @@
        rdoc_dir = File.join(@doc_dir, "rdoc")
          drive = nil
-        source_dirs = 
@spec.require_paths.clone.concat(@spec.extra_rdoc_files).collect do 
-          path = File.join(@spec.full_gem_path, req)
-          if path =~ /^[a-zA-Z]\:/
-            drive = path[0, 2]
-            path = path[2..-1]
-          end
-          path
-        end
+        source_dirs = 
          current_dir = Dir.pwd
-        target_directory = (drive && Dir.pwd[0,2]!=drive) ? drive : nil
-        Dir.chdir(target_directory) if target_directory
+        Dir.chdir(@spec.full_gem_path)
            @rdoc_args = rdoc_args_from_spec(@rdoc_args)
            r = RDoc::RDoc.new
            r.document(['--op', rdoc_dir, '--template', 'kilmer'] + 
@rdoc_args.flatten + source_dirs)
          rescue RDoc::RDocError => e
            alert_error e.message
+        ensure
+          Dir.chdir(current_dir)
-        Dir.chdir(current_dir) if target_directory
        rescue RDoc::RDocError => e
          alert_error e.message

More information about the Rubygems-developers mailing list