lib/rubygems/doc_manager.rb in rubygems-update-1.3.1 vs lib/rubygems/doc_manager.rb in rubygems-update-1.3.2

- old
+ new

@@ -39,16 +39,27 @@ # use built-in RDoc end begin require 'rdoc/rdoc' + + @rdoc_version = if defined? RDoc::VERSION then + Gem::Version.new RDoc::VERSION + else + Gem::Version.new '1.0.1' # HACK parsing is hard + end + rescue LoadError => e raise Gem::DocumentError, - "ERROR: RDoc documentation generator not installed!" + "ERROR: RDoc documentation generator not installed: #{e}" end end + def self.rdoc_version + @rdoc_version + end + ## # Updates the RI cache for RDoc 2 if it is installed def self.update_ri_cache load_rdoc rescue return @@ -149,12 +160,21 @@ args << @spec.rdoc_options args << self.class.configured_args args << '--quiet' args << @spec.require_paths.clone args << @spec.extra_rdoc_files + args << '--title' << "#{@spec.full_name} Documentation" args = args.flatten.map do |arg| arg.to_s end + if self.class.rdoc_version >= Gem::Version.new('2.4.0') then + args.delete '--inline-source' + args.delete '--promiscuous' + args.delete '-p' + args.delete '--one-file' + # HACK more + end + r = RDoc::RDoc.new old_pwd = Dir.pwd Dir.chdir(@spec.full_gem_path) begin @@ -192,23 +212,23 @@ File.writable? @spec.installation_path original_name = [ @spec.name, @spec.version, @spec.original_platform].join '-' - doc_dir = File.join @spec.installation_path, 'doc', @spec.full_name - unless File.directory? doc_dir then - doc_dir = File.join @spec.installation_path, 'doc', original_name - end + doc_dir = File.join @spec.installation_path, 'doc', @spec.full_name + unless File.directory? doc_dir then + doc_dir = File.join @spec.installation_path, 'doc', original_name + end - FileUtils.rm_rf doc_dir + FileUtils.rm_rf doc_dir - ri_dir = File.join @spec.installation_path, 'ri', @spec.full_name + ri_dir = File.join @spec.installation_path, 'ri', @spec.full_name - unless File.directory? ri_dir then - ri_dir = File.join @spec.installation_path, 'ri', original_name - end + unless File.directory? ri_dir then + ri_dir = File.join @spec.installation_path, 'ri', original_name + end - FileUtils.rm_rf ri_dir + FileUtils.rm_rf ri_dir end end