summaryrefslogtreecommitdiff
path: root/lib/rdoc
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-14 05:16:56 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-14 05:16:56 +0000
commit8adec52962b261ade1ec1d538d93ebeea69db5b2 (patch)
tree5be48a871519733101cadc1bf67d7b1d2a1fb94a /lib/rdoc
parent1dfe3d93fa5d9ddabae8db067c5705ea6e551442 (diff)
* 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
Diffstat (limited to 'lib/rdoc')
-rw-r--r--lib/rdoc/rubygems_hook.rb26
-rw-r--r--lib/rdoc/store.rb2
2 files changed, 17 insertions, 11 deletions
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