ruby-changes:25835
From: drbrain <ko1@a...>
Date: Tue, 27 Nov 2012 15:01:50 +0900 (JST)
Subject: [ruby-changes:25835] drbrain:r37892 (trunk): * lib/rdoc/rubygems_hook.rb: Updated for (upcoming) RubyGems 2
drbrain 2012-11-27 15:01:41 +0900 (Tue, 27 Nov 2012) New Revision: 37892 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37892 Log: * lib/rdoc/rubygems_hook.rb: Updated for (upcoming) RubyGems 2 import. * test/rdoc/test_rdoc_rubygems_hook.rb: ditto Modified files: trunk/ChangeLog trunk/lib/rdoc/rubygems_hook.rb trunk/test/rdoc/test_rdoc_rubygems_hook.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 37891) +++ ChangeLog (revision 37892) @@ -1,3 +1,9 @@ +Tue Nov 27 14:56:45 2012 Eric Hodel <drbrain@s...> + + * lib/rdoc/rubygems_hook.rb: Updated for (upcoming) RubyGems 2 + import. + * test/rdoc/test_rdoc_rubygems_hook.rb: ditto + Tue Nov 27 13:59:29 2012 Narihiro Nakamura <authornari@g...> * NEWS: add improvements of the garbage collector. Index: lib/rdoc/rubygems_hook.rb =================================================================== --- lib/rdoc/rubygems_hook.rb (revision 37891) +++ lib/rdoc/rubygems_hook.rb (revision 37892) @@ -109,8 +109,10 @@ options.op_dir = destination options.finish + generator = options.generator.new @rdoc.store, options + @rdoc.options = options - @rdoc.generator = options.generator.new options + @rdoc.generator = generator say "Installing #{generator} documentation for #{@spec.full_name}" @@ -134,8 +136,6 @@ setup - ::RDoc::RDoc.reset - options = ::RDoc::Options.new options.default_title = "#{@spec.full_name} Documentation" options.files = [] @@ -158,6 +158,14 @@ @rdoc = new_rdoc @rdoc.options = options + store = RDoc::Store.new + store.encoding = options.encoding if options.respond_to? :encoding + store.dry_run = options.dry_run + store.main = options.main_page + store.title = options.title + + @rdoc.store = RDoc::Store.new + Dir.chdir @spec.full_gem_path do @rdoc.parse_files options.files end Index: test/rdoc/test_rdoc_rubygems_hook.rb =================================================================== --- test/rdoc/test_rdoc_rubygems_hook.rb (revision 37891) +++ test/rdoc/test_rdoc_rubygems_hook.rb (revision 37892) @@ -12,7 +12,7 @@ @a = quick_spec 'a' - @rdoc = RDoc::RubygemsHook.new @a + @hook = RDoc::RubygemsHook.new @a begin RDoc::RubygemsHook.load_rdoc @@ -24,8 +24,8 @@ end def test_initialize - assert @rdoc.generate_rdoc - assert @rdoc.generate_ri + assert @hook.generate_rdoc + assert @hook.generate_ri rdoc = RDoc::RubygemsHook.new @a, false, false @@ -41,7 +41,7 @@ -p ] - @rdoc.delete_legacy_args args + @hook.delete_legacy_args args assert_empty args end @@ -50,24 +50,26 @@ options = RDoc::Options.new options.files = [] - @rdoc.instance_variable_set :@rdoc, @rdoc.new_rdoc - @rdoc.instance_variable_set :@file_info, [] + rdoc = @hook.new_rdoc + rdoc.store = RDoc::Store.new + @hook.instance_variable_set :@rdoc, rdoc + @hook.instance_variable_set :@file_info, [] - @rdoc.document 'darkfish', options, @a.doc_dir('rdoc') + @hook.document 'darkfish', options, @a.doc_dir('rdoc') - assert @rdoc.rdoc_installed? + assert @hook.rdoc_installed? end def test_generate FileUtils.mkdir_p @a.doc_dir FileUtils.mkdir_p File.join(@a.gem_dir, 'lib') - @rdoc.generate + @hook.generate - assert @rdoc.rdoc_installed? - assert @rdoc.ri_installed? + assert @hook.rdoc_installed? + assert @hook.ri_installed? - rdoc = @rdoc.instance_variable_get :@rdoc + rdoc = @hook.instance_variable_get :@rdoc refute rdoc.options.hyperlink_all end @@ -78,9 +80,9 @@ FileUtils.mkdir_p @a.doc_dir FileUtils.mkdir_p File.join(@a.gem_dir, 'lib') - @rdoc.generate + @hook.generate - rdoc = @rdoc.instance_variable_get :@rdoc + rdoc = @hook.instance_variable_get :@rdoc assert rdoc.options.hyperlink_all end @@ -91,21 +93,21 @@ FileUtils.mkdir_p @a.doc_dir FileUtils.mkdir_p File.join(@a.gem_dir, 'lib') - @rdoc.generate + @hook.generate - rdoc = @rdoc.instance_variable_get :@rdoc + rdoc = @hook.instance_variable_get :@rdoc assert rdoc.options.hyperlink_all end def test_generate_disabled - @rdoc.generate_rdoc = false - @rdoc.generate_ri = false + @hook.generate_rdoc = false + @hook.generate_ri = false - @rdoc.generate + @hook.generate - refute @rdoc.rdoc_installed? - refute @rdoc.ri_installed? + refute @hook.rdoc_installed? + refute @hook.ri_installed? end def test_generate_force @@ -113,9 +115,9 @@ FileUtils.mkdir_p @a.doc_dir 'rdoc' FileUtils.mkdir_p File.join(@a.gem_dir, 'lib') - @rdoc.force = true + @hook.force = true - @rdoc.generate + @hook.generate assert_path_exists File.join(@a.doc_dir('rdoc'), 'index.html') assert_path_exists File.join(@a.doc_dir('ri'), 'cache.ri') @@ -126,32 +128,32 @@ FileUtils.mkdir_p @a.doc_dir 'rdoc' FileUtils.mkdir_p File.join(@a.gem_dir, 'lib') - @rdoc.generate + @hook.generate refute_path_exists File.join(@a.doc_dir('rdoc'), 'index.html') refute_path_exists File.join(@a.doc_dir('ri'), 'cache.ri') end def test_new_rdoc - assert_kind_of RDoc::RDoc, @rdoc.new_rdoc + assert_kind_of RDoc::RDoc, @hook.new_rdoc end def test_rdoc_installed? - refute @rdoc.rdoc_installed? + refute @hook.rdoc_installed? FileUtils.mkdir_p @a.doc_dir 'rdoc' - assert @rdoc.rdoc_installed? + assert @hook.rdoc_installed? end def test_remove FileUtils.mkdir_p @a.doc_dir 'rdoc' FileUtils.mkdir_p @a.doc_dir 'ri' - @rdoc.remove + @hook.remove - refute @rdoc.rdoc_installed? - refute @rdoc.ri_installed? + refute @hook.rdoc_installed? + refute @hook.ri_installed? assert_path_exists @a.doc_dir end @@ -162,7 +164,7 @@ FileUtils.chmod 0, @a.base_dir e = assert_raises Gem::FilePermissionError do - @rdoc.remove + @hook.remove end assert_equal @a.base_dir, e.directory @@ -171,15 +173,15 @@ end def test_ri_installed? - refute @rdoc.ri_installed? + refute @hook.ri_installed? FileUtils.mkdir_p @a.doc_dir 'ri' - assert @rdoc.ri_installed? + assert @hook.ri_installed? end def test_setup - @rdoc.setup + @hook.setup assert_path_exists @a.doc_dir end @@ -190,7 +192,7 @@ FileUtils.chmod 0, @a.doc_dir e = assert_raises Gem::FilePermissionError do - @rdoc.setup + @hook.setup end assert_equal @a.doc_dir, e.directory -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/