From 8adec52962b261ade1ec1d538d93ebeea69db5b2 Mon Sep 17 00:00:00 2001 From: drbrain Date: Fri, 14 Dec 2012 05:16:56 +0000 Subject: * lib/rdoc/rubygems_hook.rb: Fixed generation of documentation. Disabled rdoc generation by default to match RubyGems defaults. Reduced diff with RubyGems::RDoc. * test/rdoc/test_rdoc_rubygems_hook.rb: Tests for the above. * test/rubygems/test_gem_rdoc.rb: ditto. * lib/rdoc/store.rb: Removed useless variable assignment git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rdoc/rubygems_hook.rb | 26 ++++++++++++++++---------- lib/rdoc/store.rb | 2 +- 2 files changed, 17 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/rdoc/rubygems_hook.rb b/lib/rdoc/rubygems_hook.rb index 9fcb783425..f001c6d66c 100644 --- a/lib/rdoc/rubygems_hook.rb +++ b/lib/rdoc/rubygems_hook.rb @@ -68,10 +68,12 @@ class RDoc::RubygemsHook ## # Creates a new documentation generator for +spec+. RDoc and ri data - # generation can be disabled through +generate_rdoc+ and +generate_ri+ - # respectively. + # generation can be enabled or disabled through +generate_rdoc+ and + # +generate_ri+ respectively. + # + # Only +generate_ri+ is enabled by default. - def initialize spec, generate_rdoc = true, generate_ri = true + def initialize spec, generate_rdoc = false, generate_ri = true @doc_dir = spec.doc_dir @force = false @rdoc = nil @@ -139,13 +141,11 @@ class RDoc::RubygemsHook setup - options = ::RDoc::Options.new - options.default_title = "#{@spec.full_name} Documentation" - options.files = [] - options.files.concat @spec.require_paths - options.files.concat @spec.extra_rdoc_files + options = nil args = @spec.rdoc_options + args.concat @spec.require_paths + args.concat @spec.extra_rdoc_files case config_args = Gem.configuration[:rdoc] when String then @@ -155,7 +155,13 @@ class RDoc::RubygemsHook end delete_legacy_args args - options.parse args + + Dir.chdir @spec.full_gem_path do + options = ::RDoc::Options.new + options.default_title = "#{@spec.full_name} Documentation" + options.parse args + end + options.quiet = !Gem.configuration.really_verbose @rdoc = new_rdoc @@ -167,7 +173,7 @@ class RDoc::RubygemsHook store.main = options.main_page store.title = options.title - @rdoc.store = RDoc::Store.new + @rdoc.store = store say "Parsing documentation for #{@spec.full_name}" diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb index 9beced6423..2a2acf4edb 100644 --- a/lib/rdoc/store.rb +++ b/lib/rdoc/store.rb @@ -596,7 +596,7 @@ class RDoc::Store def load_class_data klass_name file = class_file klass_name - obj = open file, 'rb' do |io| + open file, 'rb' do |io| Marshal.load io.read end rescue Errno::ENOENT => e -- cgit v1.2.3