rdoc 2.4.3 → 2.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rdoc might be problematic. Click here for more details.

Files changed (139) hide show
  1. data.tar.gz.sig +0 -0
  2. data/.autotest +3 -1
  3. data/History.txt +68 -0
  4. data/LICENSE.txt +57 -0
  5. data/Manifest.txt +37 -19
  6. data/README.txt +2 -12
  7. data/Rakefile +12 -12
  8. data/bin/rdoc +4 -4
  9. data/lib/rdoc.rb +32 -9
  10. data/lib/rdoc/alias.rb +2 -2
  11. data/lib/rdoc/any_method.rb +108 -16
  12. data/lib/rdoc/attr.rb +87 -1
  13. data/lib/rdoc/class_module.rb +131 -5
  14. data/lib/rdoc/code_object.rb +28 -5
  15. data/lib/rdoc/constant.rb +22 -0
  16. data/lib/rdoc/context.rb +80 -37
  17. data/lib/rdoc/gauntlet.rb +48 -0
  18. data/lib/rdoc/generator/darkfish.rb +25 -23
  19. data/lib/rdoc/generator/markup.rb +6 -29
  20. data/lib/rdoc/generator/ri.rb +39 -189
  21. data/lib/rdoc/generator/template/darkfish/classpage.rhtml +17 -1
  22. data/lib/rdoc/generator/template/darkfish/filepage.rhtml +10 -0
  23. data/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  24. data/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  25. data/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  26. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  27. data/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  28. data/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  29. data/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  30. data/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  31. data/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  32. data/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  33. data/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  34. data/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  35. data/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  36. data/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  37. data/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  38. data/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  39. data/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  40. data/lib/rdoc/generator/template/darkfish/index.rhtml +2 -2
  41. data/lib/rdoc/generator/template/darkfish/rdoc.css +38 -33
  42. data/lib/rdoc/include.rb +22 -0
  43. data/lib/rdoc/markup.rb +10 -262
  44. data/lib/rdoc/markup/attribute_manager.rb +57 -50
  45. data/lib/rdoc/markup/blank_line.rb +19 -0
  46. data/lib/rdoc/markup/document.rb +72 -0
  47. data/lib/rdoc/markup/formatter.rb +118 -0
  48. data/lib/rdoc/markup/formatter_test_case.rb +341 -0
  49. data/lib/rdoc/markup/heading.rb +17 -0
  50. data/lib/rdoc/markup/inline.rb +6 -5
  51. data/lib/rdoc/markup/list.rb +78 -0
  52. data/lib/rdoc/markup/list_item.rb +83 -0
  53. data/lib/rdoc/markup/paragraph.rb +66 -0
  54. data/lib/rdoc/markup/parser.rb +528 -0
  55. data/lib/rdoc/markup/rule.rb +17 -0
  56. data/lib/rdoc/markup/to_ansi.rb +72 -0
  57. data/lib/rdoc/markup/to_bs.rb +74 -0
  58. data/lib/rdoc/markup/to_html.rb +106 -172
  59. data/lib/rdoc/markup/to_html_crossref.rb +10 -4
  60. data/lib/rdoc/markup/to_rdoc.rb +243 -0
  61. data/lib/rdoc/markup/to_test.rb +27 -16
  62. data/lib/rdoc/markup/verbatim.rb +42 -0
  63. data/lib/rdoc/normal_class.rb +38 -1
  64. data/lib/rdoc/normal_module.rb +38 -8
  65. data/lib/rdoc/options.rb +39 -151
  66. data/lib/rdoc/parser.rb +36 -18
  67. data/lib/rdoc/parser/c.rb +102 -109
  68. data/lib/rdoc/parser/ruby.rb +359 -1662
  69. data/lib/rdoc/parser/ruby_tools.rb +157 -0
  70. data/lib/rdoc/parser/simple.rb +0 -2
  71. data/lib/rdoc/rdoc.rb +142 -82
  72. data/lib/rdoc/ri.rb +10 -0
  73. data/lib/rdoc/ri/driver.rb +674 -444
  74. data/lib/rdoc/ri/formatter.rb +2 -651
  75. data/lib/rdoc/ri/paths.rb +70 -45
  76. data/lib/rdoc/ri/store.rb +248 -0
  77. data/lib/rdoc/ruby_lex.rb +1284 -0
  78. data/lib/rdoc/ruby_token.rb +416 -0
  79. data/lib/rdoc/single_class.rb +5 -0
  80. data/lib/rdoc/stats.rb +152 -83
  81. data/lib/rdoc/task.rb +27 -49
  82. data/lib/rdoc/text.rb +130 -0
  83. data/lib/rdoc/tokenstream.rb +28 -9
  84. data/lib/rdoc/top_level.rb +49 -43
  85. data/test/hidden.zip.txt +1 -0
  86. data/test/test_attribute_manager.rb +9 -16
  87. data/test/test_rdoc_any_method.rb +23 -0
  88. data/test/test_rdoc_attr.rb +40 -0
  89. data/test/test_rdoc_class_module.rb +100 -0
  90. data/test/test_rdoc_code_object.rb +18 -2
  91. data/test/test_rdoc_context.rb +41 -0
  92. data/test/test_rdoc_generator_ri.rb +56 -0
  93. data/test/test_rdoc_markup.rb +21 -610
  94. data/test/test_rdoc_markup_attribute_manager.rb +14 -17
  95. data/test/test_rdoc_markup_document.rb +51 -0
  96. data/test/test_rdoc_markup_paragraph.rb +27 -0
  97. data/test/test_rdoc_markup_parser.rb +1327 -0
  98. data/test/test_rdoc_markup_to_ansi.rb +426 -0
  99. data/test/test_rdoc_markup_to_bs.rb +443 -0
  100. data/test/test_rdoc_markup_to_html.rb +183 -18
  101. data/test/test_rdoc_markup_to_html_crossref.rb +1 -3
  102. data/test/test_rdoc_markup_to_rdoc.rb +426 -0
  103. data/test/test_rdoc_normal_class.rb +17 -0
  104. data/test/test_rdoc_normal_module.rb +6 -6
  105. data/test/test_rdoc_options.rb +41 -0
  106. data/test/test_rdoc_parser.rb +66 -13
  107. data/test/test_rdoc_parser_c.rb +93 -38
  108. data/test/test_rdoc_parser_perl.rb +2 -3
  109. data/test/test_rdoc_parser_ruby.rb +291 -28
  110. data/test/test_rdoc_parser_simple.rb +48 -0
  111. data/test/test_rdoc_rdoc.rb +66 -0
  112. data/test/test_rdoc_ri_driver.rb +752 -38
  113. data/test/test_rdoc_ri_paths.rb +39 -0
  114. data/test/test_rdoc_ri_store.rb +309 -0
  115. data/test/test_rdoc_text.rb +157 -0
  116. data/test/test_rdoc_top_level.rb +35 -9
  117. data/test/xref_data.rb +9 -1
  118. data/test/xref_test_case.rb +8 -3
  119. metadata +110 -38
  120. metadata.gz.sig +0 -0
  121. data/lib/rdoc/cache.rb +0 -41
  122. data/lib/rdoc/diagram.rb +0 -340
  123. data/lib/rdoc/dot.rb +0 -249
  124. data/lib/rdoc/markup/fragments.rb +0 -377
  125. data/lib/rdoc/markup/lines.rb +0 -156
  126. data/lib/rdoc/markup/to_flow.rb +0 -211
  127. data/lib/rdoc/markup/to_latex.rb +0 -328
  128. data/lib/rdoc/markup/to_texinfo.rb +0 -73
  129. data/lib/rdoc/ri/cache.rb +0 -187
  130. data/lib/rdoc/ri/descriptions.rb +0 -156
  131. data/lib/rdoc/ri/display.rb +0 -340
  132. data/lib/rdoc/ri/reader.rb +0 -106
  133. data/lib/rdoc/ri/util.rb +0 -79
  134. data/lib/rdoc/ri/writer.rb +0 -68
  135. data/test/test_rdoc_ri_attribute_formatter.rb +0 -44
  136. data/test/test_rdoc_ri_default_display.rb +0 -302
  137. data/test/test_rdoc_ri_formatter.rb +0 -320
  138. data/test/test_rdoc_ri_html_formatter.rb +0 -141
  139. data/test/test_rdoc_ri_overstrike_formatter.rb +0 -71
@@ -1,11 +1,16 @@
1
1
  require 'rdoc'
2
+ require 'rdoc/text'
2
3
 
3
4
  ##
5
+ # Base class for the RDoc code tree.
6
+ #
4
7
  # We contain the common stuff for contexts (which are containers) and other
5
8
  # elements (methods, attributes and so on)
6
9
 
7
10
  class RDoc::CodeObject
8
11
 
12
+ include RDoc::Text
13
+
9
14
  ##
10
15
  # Our comment
11
16
 
@@ -71,11 +76,13 @@ class RDoc::CodeObject
71
76
  # Creates a new CodeObject that will document itself and its children
72
77
 
73
78
  def initialize
74
- @comment = nil
75
- @document_children = true
76
- @document_self = true
77
- @done_documenting = false
79
+ @comment = ''
80
+
81
+ @document_children = true
82
+ @document_self = true
83
+ @done_documenting = false
78
84
  @force_documentation = false
85
+
79
86
  @parent = nil
80
87
  end
81
88
 
@@ -83,7 +90,16 @@ class RDoc::CodeObject
83
90
  # Replaces our comment with +comment+, unless it is empty.
84
91
 
85
92
  def comment=(comment)
86
- @comment = comment unless comment.empty?
93
+ @comment = case comment
94
+ when NilClass then ''
95
+ when RDoc::Markup::Document then comment
96
+ else
97
+ if comment and not comment.empty? then
98
+ normalize_comment comment
99
+ else
100
+ @comment
101
+ end
102
+ end
87
103
  end
88
104
 
89
105
  ##
@@ -104,6 +120,13 @@ class RDoc::CodeObject
104
120
  remove_methods_etc unless document_self
105
121
  end
106
122
 
123
+ ##
124
+ # Does this class have a comment with content or is document_self false.
125
+
126
+ def documented?
127
+ !(@document_self and @comment.empty?)
128
+ end
129
+
107
130
  ##
108
131
  # File name of our parent
109
132
 
@@ -25,6 +25,28 @@ class RDoc::Constant < RDoc::CodeObject
25
25
  self.comment = comment
26
26
  end
27
27
 
28
+ ##
29
+ # Constants are ordered by name
30
+
31
+ def <=> other
32
+ return unless self.class === other
33
+
34
+ [parent_name, name] <=> [other.parent_name, other.name]
35
+ end
36
+
37
+ def == other
38
+ self.class == other.class and
39
+ @parent == other.parent and
40
+ @name == other.name
41
+ end
42
+
43
+ def inspect # :nodoc:
44
+ "#<%s:0x%x %s::%s>" % [
45
+ self.class, object_id,
46
+ parent_name, @name,
47
+ ]
48
+ end
49
+
28
50
  ##
29
51
  # Path to this constant
30
52
 
@@ -1,4 +1,3 @@
1
- require 'thread'
2
1
  require 'rdoc/code_object'
3
2
 
4
3
  ##
@@ -8,6 +7,8 @@ require 'rdoc/code_object'
8
7
 
9
8
  class RDoc::Context < RDoc::CodeObject
10
9
 
10
+ include Comparable
11
+
11
12
  ##
12
13
  # Types of methods
13
14
 
@@ -107,7 +108,6 @@ class RDoc::Context < RDoc::CodeObject
107
108
  attr_reader :title
108
109
 
109
110
  @@sequence = "SEC00000"
110
- @@sequence_lock = Mutex.new
111
111
 
112
112
  ##
113
113
  # Creates a new section with +title+ and +comment+
@@ -116,10 +116,8 @@ class RDoc::Context < RDoc::CodeObject
116
116
  @parent = parent
117
117
  @title = title
118
118
 
119
- @@sequence_lock.synchronize do
120
- @@sequence.succ!
121
- @sequence = @@sequence.dup
122
- end
119
+ @@sequence.succ!
120
+ @sequence = @@sequence.dup
123
121
 
124
122
  set_comment comment
125
123
  end
@@ -239,16 +237,24 @@ class RDoc::Context < RDoc::CodeObject
239
237
  end
240
238
 
241
239
  ##
242
- # Adds +an_alias+ pointing to +meth+
240
+ # Turns +an_alias+ into an AnyMethod that points to +meth+
243
241
 
244
242
  def add_alias_impl(an_alias, meth)
245
243
  new_meth = RDoc::AnyMethod.new an_alias.text, an_alias.new_name
246
244
  new_meth.is_alias_for = meth
247
245
  new_meth.singleton = meth.singleton
248
246
  new_meth.params = meth.params
249
- new_meth.comment = "Alias for \##{meth.name}"
247
+
248
+ new_meth.comment = an_alias.comment
249
+
250
250
  meth.add_alias new_meth
251
+
251
252
  add_method new_meth
253
+
254
+ # aliases don't use ongoing visibility
255
+ new_meth.visibility = meth.visibility
256
+
257
+ new_meth
252
258
  end
253
259
 
254
260
  ##
@@ -268,25 +274,30 @@ class RDoc::Context < RDoc::CodeObject
268
274
  def add_class(class_type, name, superclass = 'Object')
269
275
  klass = add_class_or_module @classes, class_type, name, superclass
270
276
 
277
+ existing = klass.superclass
278
+ existing = existing.name if existing and not String === existing
279
+
280
+ if superclass != existing and superclass != 'Object' then
281
+ klass.superclass = superclass
282
+ end
283
+
271
284
  # If the parser encounters Container::Item before encountering
272
285
  # Container, then it assumes that Container is a module. This may not
273
286
  # be the case, so remove Container from the module list if present and
274
287
  # transfer any contained classes and modules to the new class.
275
288
 
276
- RDoc::TopLevel.lock.synchronize do
277
- mod = RDoc::TopLevel.modules_hash.delete klass.full_name
289
+ mod = RDoc::TopLevel.modules_hash.delete klass.full_name
278
290
 
279
- if mod then
280
- klass.classes_hash.update mod.classes_hash
281
- klass.modules_hash.update mod.modules_hash
282
- klass.method_list.concat mod.method_list
283
-
284
- @modules.delete klass.name
285
- end
291
+ if mod then
292
+ klass.classes_hash.update mod.classes_hash
293
+ klass.modules_hash.update mod.modules_hash
294
+ klass.method_list.concat mod.method_list
286
295
 
287
- RDoc::TopLevel.classes_hash[klass.full_name] = klass
296
+ @modules.delete klass.name
288
297
  end
289
298
 
299
+ RDoc::TopLevel.classes_hash[klass.full_name] = klass
300
+
290
301
  klass
291
302
  end
292
303
 
@@ -295,27 +306,20 @@ class RDoc::Context < RDoc::CodeObject
295
306
  # classes Hash +collection+.
296
307
 
297
308
  def add_class_or_module(collection, class_type, name, superclass = nil)
298
- full_name = if RDoc::TopLevel === self then # HACK
299
- name
300
- else
301
- "#{self.full_name}::#{name}"
302
- end
309
+ full_name = child_name name
310
+
303
311
  mod = collection[name]
304
312
 
305
313
  if mod then
306
314
  mod.superclass = superclass unless mod.module?
307
315
  else
308
- all = nil
309
-
310
- RDoc::TopLevel.lock.synchronize do
311
- all = if class_type == RDoc::NormalModule then
312
- RDoc::TopLevel.modules_hash
313
- else
314
- RDoc::TopLevel.classes_hash
315
- end
316
+ all = if class_type == RDoc::NormalModule then
317
+ RDoc::TopLevel.modules_hash
318
+ else
319
+ RDoc::TopLevel.classes_hash
320
+ end
316
321
 
317
- mod = all[full_name]
318
- end
322
+ mod = all[full_name]
319
323
 
320
324
  unless mod then
321
325
  mod = class_type.new name, superclass
@@ -329,9 +333,7 @@ class RDoc::Context < RDoc::CodeObject
329
333
  end
330
334
 
331
335
  unless @done_documenting then
332
- RDoc::TopLevel.lock.synchronize do
333
- all[full_name] = mod
334
- end
336
+ all[full_name] = mod
335
337
  collection[name] = mod
336
338
  end
337
339
 
@@ -384,6 +386,29 @@ class RDoc::Context < RDoc::CodeObject
384
386
  add_class_or_module @modules, class_type, name, nil
385
387
  end
386
388
 
389
+ ##
390
+ # Adds an alias from +from+ to +name+
391
+
392
+ def add_module_alias from, name
393
+ to_name = child_name name
394
+
395
+ unless @done_documenting then
396
+ if from.module? then
397
+ RDoc::TopLevel.modules_hash
398
+ else
399
+ RDoc::TopLevel.classes_hash
400
+ end[to_name] = from
401
+
402
+ if from.module? then
403
+ @modules
404
+ else
405
+ @classes
406
+ end[name] = from
407
+ end
408
+
409
+ from
410
+ end
411
+
387
412
  ##
388
413
  # Adds +require+ to this context's top level
389
414
 
@@ -404,6 +429,17 @@ class RDoc::Context < RDoc::CodeObject
404
429
  thing.section = @current_section
405
430
  end
406
431
 
432
+ ##
433
+ # Creates the full name for a child with +name+
434
+
435
+ def child_name name
436
+ if RDoc::TopLevel === self then
437
+ name
438
+ else
439
+ "#{self.full_name}::#{name}"
440
+ end
441
+ end
442
+
407
443
  ##
408
444
  # Array of classes in this context
409
445
 
@@ -436,7 +472,7 @@ class RDoc::Context < RDoc::CodeObject
436
472
  # Iterator for attributes
437
473
 
438
474
  def each_attribute # :yields: attribute
439
- @attributes.each {|a| yield a}
475
+ @attributes.each { |a| yield a }
440
476
  end
441
477
 
442
478
  ##
@@ -582,6 +618,13 @@ class RDoc::Context < RDoc::CodeObject
582
618
  result
583
619
  end
584
620
 
621
+ ##
622
+ # The full name for this context. This method is overridden by subclasses.
623
+
624
+ def full_name
625
+ '(unknown)'
626
+ end
627
+
585
628
  ##
586
629
  # URL for this with a +prefix+
587
630
 
@@ -0,0 +1,48 @@
1
+ require 'rdoc/rdoc'
2
+ require 'gauntlet'
3
+ require 'fileutils'
4
+
5
+ ##
6
+ # Allows for testing of RDoc against every gem
7
+
8
+ class RDoc::Gauntlet < Gauntlet
9
+
10
+ def run name
11
+ next if self.data[name]
12
+
13
+ ri_dir = File.expand_path "~/.gauntlet/data/ri/#{name}"
14
+ FileUtils.rm_rf ri_dir if File.exist? ri_dir
15
+
16
+ yaml = File.read 'gemspec'
17
+ spec = Gem::Specification.from_yaml yaml
18
+
19
+ args = %W[--ri --op #{ri_dir}]
20
+ args.push(*spec.rdoc_options)
21
+ args << spec.require_paths
22
+ args << spec.extra_rdoc_files
23
+ args = args.flatten.map { |a| a.to_s }
24
+ args.delete '--quiet'
25
+
26
+ puts "#{name} - rdoc #{args.join ' '}"
27
+
28
+ self.dirty = true
29
+ r = RDoc::RDoc.new
30
+
31
+ begin
32
+ r.document args
33
+ self.data[name] = true
34
+ puts 'passed'
35
+ rescue StandardError, RDoc::Error => e
36
+ puts "failed - (#{e.class}) #{e.message}"
37
+ self.data[name] = false
38
+ end
39
+ rescue Gem::Exception
40
+ puts "bad gem #{name}"
41
+ ensure
42
+ puts
43
+ end
44
+
45
+ end
46
+
47
+ RDoc::Gauntlet.new.run_the_gauntlet if $0 == __FILE__
48
+
@@ -2,18 +2,17 @@
2
2
  # vim: noet ts=2 sts=8 sw=2
3
3
 
4
4
  require 'rubygems'
5
- gem 'rdoc', '>= 2.4' unless defined? $rdoc_rakefile
5
+ gem 'rdoc', '>= 2.4' unless ENV['RDOC_TEST'] or defined?($rdoc_rakefile)
6
6
 
7
7
  require 'pp'
8
8
  require 'pathname'
9
9
  require 'fileutils'
10
10
  require 'erb'
11
- require 'yaml'
12
11
 
13
- require 'rdoc/rdoc'
14
- require 'rdoc/generator'
15
12
  require 'rdoc/generator/markup'
16
13
 
14
+ $DARKFISH_DRYRUN = false # TODO make me non-global
15
+
17
16
  #
18
17
  # Darkfish RDoc HTML Generator
19
18
  #
@@ -98,12 +97,11 @@ class RDoc::Generator::Darkfish
98
97
  ### Initialize a few instance variables before we start
99
98
  def initialize( options )
100
99
  @options = options
101
- @options.diagram = false
102
100
 
103
101
  template = @options.template || 'darkfish'
104
102
 
105
103
  template_dir = $LOAD_PATH.map do |path|
106
- File.join path, GENERATOR_DIR, 'template', template
104
+ File.join File.expand_path(path), GENERATOR_DIR, 'template', template
107
105
  end.find do |dir|
108
106
  File.directory? dir
109
107
  end
@@ -151,7 +149,7 @@ class RDoc::Generator::Darkfish
151
149
  ### directory.
152
150
  def write_style_sheet
153
151
  debug_msg "Copying static files"
154
- options = { :verbose => $DEBUG_RDOC, :noop => $dryrun }
152
+ options = { :verbose => $DEBUG_RDOC, :noop => $DARKFISH_DRYRUN }
155
153
 
156
154
  FileUtils.cp @template_dir + 'rdoc.css', '.', options
157
155
 
@@ -223,12 +221,14 @@ class RDoc::Generator::Darkfish
223
221
  ### Generate an index page which lists all the classes which
224
222
  ### are documented.
225
223
  def generate_index
224
+ template_file = @template_dir + 'index.rhtml'
225
+ return unless template_file.exist?
226
+
226
227
  debug_msg "Rendering the index page..."
227
228
 
228
- templatefile = @template_dir + 'index.rhtml'
229
- template_src = templatefile.read
229
+ template_src = template_file.read
230
230
  template = ERB.new( template_src, nil, '<>' )
231
- template.filename = templatefile.to_s
231
+ template.filename = template_file.to_s
232
232
  context = binding()
233
233
 
234
234
  output = nil
@@ -237,14 +237,14 @@ class RDoc::Generator::Darkfish
237
237
  output = template.result( context )
238
238
  rescue NoMethodError => err
239
239
  raise RDoc::Error, "Error while evaluating %s: %s (at %p)" % [
240
- templatefile,
240
+ template_file,
241
241
  err.message,
242
242
  eval( "_erbout[-50,50]", context )
243
243
  ], err.backtrace
244
244
  end
245
245
 
246
246
  outfile = @basedir + @options.op_dir + 'index.html'
247
- unless $dryrun
247
+ unless $DARKFISH_DRYRUN
248
248
  debug_msg "Outputting to %s" % [outfile.expand_path]
249
249
  outfile.open( 'w', 0644 ) do |fh|
250
250
  fh.print( output )
@@ -256,8 +256,9 @@ class RDoc::Generator::Darkfish
256
256
 
257
257
  ### Generate a documentation file for each class
258
258
  def generate_class_files
259
+ template_file = @template_dir + 'classpage.rhtml'
260
+ return unless template_file.exist?
259
261
  debug_msg "Generating class documentation in #@outputdir"
260
- templatefile = @template_dir + 'classpage.rhtml'
261
262
 
262
263
  @classes.each do |klass|
263
264
  debug_msg " working on %s (%s)" % [ klass.full_name, klass.path ]
@@ -266,14 +267,15 @@ class RDoc::Generator::Darkfish
266
267
  svninfo = self.get_svninfo( klass )
267
268
 
268
269
  debug_msg " rendering #{outfile}"
269
- self.render_template( templatefile, binding(), outfile )
270
+ self.render_template( template_file, binding(), outfile )
270
271
  end
271
272
  end
272
273
 
273
274
  ### Generate a documentation file for each file
274
275
  def generate_file_files
276
+ template_file = @template_dir + 'filepage.rhtml'
277
+ return unless template_file.exist?
275
278
  debug_msg "Generating file documentation in #@outputdir"
276
- templatefile = @template_dir + 'filepage.rhtml'
277
279
 
278
280
  @files.each do |file|
279
281
  outfile = @outputdir + file.path
@@ -282,7 +284,7 @@ class RDoc::Generator::Darkfish
282
284
  context = binding()
283
285
 
284
286
  debug_msg " rendering #{outfile}"
285
- self.render_template( templatefile, binding(), outfile )
287
+ self.render_template( template_file, binding(), outfile )
286
288
  end
287
289
  end
288
290
 
@@ -335,26 +337,26 @@ class RDoc::Generator::Darkfish
335
337
  end
336
338
 
337
339
 
338
- ### Load and render the erb template in the given +templatefile+ within the
340
+ ### Load and render the erb template in the given +template_file+ within the
339
341
  ### specified +context+ (a Binding object) and write it out to +outfile+.
340
- ### Both +templatefile+ and +outfile+ should be Pathname-like objects.
342
+ ### Both +template_file+ and +outfile+ should be Pathname-like objects.
341
343
 
342
- def render_template( templatefile, context, outfile )
343
- template_src = templatefile.read
344
+ def render_template( template_file, context, outfile )
345
+ template_src = template_file.read
344
346
  template = ERB.new( template_src, nil, '<>' )
345
- template.filename = templatefile.to_s
347
+ template.filename = template_file.to_s
346
348
 
347
349
  output = begin
348
350
  template.result( context )
349
351
  rescue NoMethodError => err
350
352
  raise RDoc::Error, "Error while evaluating %s: %s (at %p)" % [
351
- templatefile.to_s,
353
+ template_file.to_s,
352
354
  err.message,
353
355
  eval( "_erbout[-50,50]", context )
354
356
  ], err.backtrace
355
357
  end
356
358
 
357
- unless $dryrun
359
+ unless $DARKFISH_DRYRUN
358
360
  outfile.dirname.mkpath
359
361
  outfile.open( 'w', 0644 ) do |ofh|
360
362
  ofh.print( output )