diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-09 21:38:59 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-09 21:38:59 +0000 |
commit | 31c94ffeb5f09d09ac2c86fc9e6614e38251a43d (patch) | |
tree | 10e44506238c7af3d7c9d822111996731726e38d /lib/rubygems/doc_manager.rb | |
parent | a6afbaeb3be396c0fdea3b9077d9256c59edcfca (diff) |
Update to RubyGems 1.3.4 r2223
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/doc_manager.rb')
-rw-r--r-- | lib/rubygems/doc_manager.rb | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/lib/rubygems/doc_manager.rb b/lib/rubygems/doc_manager.rb index 00ef4c51e3..e1c8e03b91 100644 --- a/lib/rubygems/doc_manager.rb +++ b/lib/rubygems/doc_manager.rb @@ -41,12 +41,23 @@ class Gem::DocManager 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 @@ -94,10 +105,8 @@ class Gem::DocManager # RI docs generation to fail if run after RDoc). def generate_ri - if @spec.has_rdoc then - setup_rdoc - install_ri # RDoc bug, ri goes first - end + setup_rdoc + install_ri # RDoc bug, ri goes first FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) end @@ -110,10 +119,8 @@ class Gem::DocManager # RI docs generation to fail if run after RDoc). def generate_rdoc - if @spec.has_rdoc then - setup_rdoc - install_rdoc - end + setup_rdoc + install_rdoc FileUtils.mkdir_p @doc_dir unless File.exist?(@doc_dir) end @@ -151,8 +158,17 @@ class Gem::DocManager 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 @@ -194,20 +210,20 @@ class Gem::DocManager 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 |