components/ruby/patches/02-code_objects-html_generator.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 19 Aug 2013 10:02:46 -0700
changeset 1445 4219a6332b8e
parent 688 9333dc6e30ba
permissions -rw-r--r--
Close of build 29.

--- ruby-1.8.7-p357.orig/lib/rdoc/code_objects.rb	2007-02-12 15:01:19.000000000 -0800
+++ ruby-1.8.7-p357/lib/rdoc/code_objects.rb	2012-02-09 12:51:13.913971000 -0800
@@ -345,6 +345,14 @@ module RDoc
       @classes.each_value {|c| yield c}
     end
 
+    # New method for Solaris, to provide a sorted array.
+    # Return array of all modules and classes, each sorted by name.
+
+    def sorted_modules_classes
+      @modules.values.sort_by { |m| m.name } + 
+      @classes.values.sort_by { |c| c.name }
+    end
+
     def each_method
       @method_list.each {|m| yield m}
     end
--- ruby-1.8.7-p357.orig/lib/rdoc/generators/html_generator.rb	2007-02-12 15:01:19.000000000 -0800
+++ ruby-1.8.7-p357/lib/rdoc/generators/html_generator.rb	2012-02-09 16:24:17.290851000 -0800
@@ -1256,14 +1256,26 @@ module Generators
         @files << HtmlFile.new(toplevel, @options, FILE_DIR)
       end
 
-      RDoc::TopLevel.all_classes_and_modules.each do |cls|
+      # Solaris fix:  sort the top level classes and modules,
+      # to provide fixed ordering for creation of html files,
+      # since the file names are numbered sequentially.  This is 
+      # needed for creating a deterministic set of file names for 
+      # html document files generated by ruby.
+      sorted_classes_and_modules =
+        RDoc::TopLevel.all_classes_and_modules.sort_by { |x| x.full_name }
+
+      sorted_classes_and_modules.each do |cls|
         build_class_list(cls, @files[0], CLASS_DIR)
       end
     end
 
     def build_class_list(from, html_file, class_dir)
       @classes << HtmlClass.new(from, html_file, class_dir, @options)
-      from.each_classmodule do |mod|
+
+      # Solaris fix:  sorts modules and classes by name, to provide
+      # a fixed set of html file pathnames, which are numbered
+      # sequentially.
+      from.sorted_modules_classes.each do |mod|
         build_class_list(mod, html_file, class_dir)
       end
     end