Skip to content

Commit 6936fe8

Browse files
committed
Centralize generator setup
Currently we need to call `setup` in individual generation methods, despite having already called it in `RDoc#generate`. This is because `setup` is lazily called when we run `ri`'s server mode. By calling `setup` eagerly in `Servlet#generator_for`, we can avoid the repeated calls to `setup` in individual generation methods.
1 parent 152035b commit 6936fe8

File tree

2 files changed

+1
-16
lines changed

2 files changed

+1
-16
lines changed

lib/rdoc/generator/darkfish.rb

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,6 @@ def get_sorted_module_list classes
301301
# Generate an index page which lists all the classes which are documented.
302302

303303
def generate_index
304-
setup
305-
306304
template_file = @template_dir + 'index.rhtml'
307305
return unless template_file.exist?
308306

@@ -338,8 +336,6 @@ def generate_index
338336
# Generates a class file for +klass+
339337

340338
def generate_class klass, template_file = nil
341-
setup
342-
343339
current = klass
344340

345341
template_file ||= @template_dir + 'class.rhtml'
@@ -372,8 +368,6 @@ def generate_class klass, template_file = nil
372368
# Generate a documentation file for each class and module
373369

374370
def generate_class_files
375-
setup
376-
377371
template_file = @template_dir + 'class.rhtml'
378372
template_file = @template_dir + 'classpage.rhtml' unless
379373
template_file.exist?
@@ -399,8 +393,6 @@ def generate_class_files
399393
# Generate a documentation file for each file
400394

401395
def generate_file_files
402-
setup
403-
404396
page_file = @template_dir + 'page.rhtml'
405397
fileinfo_file = @template_dir + 'fileinfo.rhtml'
406398

@@ -468,8 +460,6 @@ def generate_file_files
468460
# Generate a page file for +file+
469461

470462
def generate_page file
471-
setup
472-
473463
template_file = @template_dir + 'page.rhtml'
474464

475465
out_file = @outputdir + file.path
@@ -497,8 +487,6 @@ def generate_page file
497487
# Generates the 404 page for the RDoc servlet
498488

499489
def generate_servlet_not_found message
500-
setup
501-
502490
template_file = @template_dir + 'servlet_not_found.rhtml'
503491
return unless template_file.exist?
504492

@@ -530,8 +518,6 @@ def generate_servlet_not_found message
530518
# Generates the servlet root page for the RDoc servlet
531519

532520
def generate_servlet_root installed
533-
setup
534-
535521
template_file = @template_dir + 'servlet_root.rhtml'
536522
return unless template_file.exist?
537523

@@ -557,8 +543,6 @@ def generate_servlet_root installed
557543
# Generate an index page which lists all the classes which are documented.
558544

559545
def generate_table_of_contents
560-
setup
561-
562546
template_file = @template_dir + 'table_of_contents.rhtml'
563547
return unless template_file.exist?
564548

lib/rdoc/servlet.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ def generator_for store
247247
generator = RDoc::Generator::Darkfish.new store, @options
248248
generator.file_output = false
249249
generator.asset_rel_path = '..'
250+
generator.setup
250251

251252
rdoc = RDoc::RDoc.new
252253
rdoc.store = store

0 commit comments

Comments
 (0)