openvox 8.28.1 → 8.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +37 -1
- data/Gemfile +1 -1
- data/ext/redhat/client.sysconfig +1 -0
- data/lib/puppet/application/ssl.rb +7 -6
- data/lib/puppet/functions/tree_each.rb +1 -1
- data/lib/puppet/generate/type.rb +1 -1
- data/lib/puppet/provider/package/pacman.rb +1 -1
- data/lib/puppet/util/rdoc.rb +6 -3
- data/lib/puppet/util/selinux.rb +16 -1
- data/lib/puppet/version.rb +1 -1
- metadata +10 -6
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +0 -902
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +0 -1068
|
@@ -1,902 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'rdoc/generators/html_generator'
|
|
4
|
-
require_relative '../../../../puppet/util/rdoc/code_objects'
|
|
5
|
-
require 'digest/md5'
|
|
6
|
-
|
|
7
|
-
module Generators
|
|
8
|
-
# This module holds all the classes needed to generate the HTML documentation
|
|
9
|
-
# of a bunch of puppet manifests.
|
|
10
|
-
#
|
|
11
|
-
# It works by traversing all the code objects defined by the Puppet RDoc::Parser
|
|
12
|
-
# and produces HTML counterparts objects that in turns are used by RDoc template engine
|
|
13
|
-
# to produce the final HTML.
|
|
14
|
-
#
|
|
15
|
-
# It is also responsible of creating the whole directory hierarchy, and various index
|
|
16
|
-
# files.
|
|
17
|
-
#
|
|
18
|
-
# It is to be noted that the whole system is built on top of ruby RDoc. As such there
|
|
19
|
-
# is an implicit mapping of puppet entities to ruby entitites:
|
|
20
|
-
#
|
|
21
|
-
# Puppet => Ruby
|
|
22
|
-
# ------------------------
|
|
23
|
-
# Module Module
|
|
24
|
-
# Class Class
|
|
25
|
-
# Definition Method
|
|
26
|
-
# Resource
|
|
27
|
-
# Node
|
|
28
|
-
# Plugin
|
|
29
|
-
# Fact
|
|
30
|
-
|
|
31
|
-
MODULE_DIR = "modules"
|
|
32
|
-
NODE_DIR = "nodes"
|
|
33
|
-
PLUGIN_DIR = "plugins"
|
|
34
|
-
|
|
35
|
-
# We're monkey patching RDoc markup to allow
|
|
36
|
-
# lowercase class1::class2::class3 crossref hyperlinking
|
|
37
|
-
module MarkUp
|
|
38
|
-
alias :old_markup :markup
|
|
39
|
-
|
|
40
|
-
def new_markup(str, remove_para = false)
|
|
41
|
-
first = @markup.nil?
|
|
42
|
-
res = old_markup(str, remove_para)
|
|
43
|
-
if first and !@markup.nil?
|
|
44
|
-
@markup.add_special(/\b([a-z]\w+(::\w+)*)/, :CROSSREF)
|
|
45
|
-
# we need to call it again, since we added a rule
|
|
46
|
-
res = old_markup(str, remove_para)
|
|
47
|
-
end
|
|
48
|
-
res
|
|
49
|
-
end
|
|
50
|
-
alias :markup :new_markup
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
# This is a specialized HTMLGenerator tailored to Puppet manifests
|
|
54
|
-
class PuppetGenerator < HTMLGenerator
|
|
55
|
-
def self.for(options)
|
|
56
|
-
AllReferences.reset
|
|
57
|
-
HtmlMethod.reset
|
|
58
|
-
|
|
59
|
-
if options.all_one_file
|
|
60
|
-
PuppetGeneratorInOne.new(options)
|
|
61
|
-
else
|
|
62
|
-
PuppetGenerator.new(options)
|
|
63
|
-
end
|
|
64
|
-
end
|
|
65
|
-
|
|
66
|
-
def initialize(options) # :not-new:
|
|
67
|
-
@options = options
|
|
68
|
-
load_html_template
|
|
69
|
-
end
|
|
70
|
-
|
|
71
|
-
# loads our own html template file
|
|
72
|
-
def load_html_template
|
|
73
|
-
require_relative '../../../../puppet/util/rdoc/generators/template/puppet/puppet'
|
|
74
|
-
extend RDoc::Page
|
|
75
|
-
rescue LoadError
|
|
76
|
-
$stderr.puts "Could not find Puppet template '#{template}'"
|
|
77
|
-
exit 99
|
|
78
|
-
end
|
|
79
|
-
|
|
80
|
-
def gen_method_index
|
|
81
|
-
# we don't generate an all define index
|
|
82
|
-
# as the presentation is per module/per class
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
# This is the central method, it generates the whole structures
|
|
86
|
-
# along with all the indices.
|
|
87
|
-
def generate_html
|
|
88
|
-
super
|
|
89
|
-
gen_into(@nodes)
|
|
90
|
-
gen_into(@plugins)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
|
-
##
|
|
94
|
-
# Generate:
|
|
95
|
-
# the list of modules
|
|
96
|
-
# the list of classes and definitions of a specific module
|
|
97
|
-
# the list of all classes
|
|
98
|
-
# the list of nodes
|
|
99
|
-
# the list of resources
|
|
100
|
-
def build_indices
|
|
101
|
-
@allfiles = []
|
|
102
|
-
@nodes = []
|
|
103
|
-
@plugins = []
|
|
104
|
-
|
|
105
|
-
# contains all the seen modules
|
|
106
|
-
@modules = {}
|
|
107
|
-
@allclasses = {}
|
|
108
|
-
|
|
109
|
-
# remove unknown toplevels
|
|
110
|
-
# it can happen that RDoc triggers a different parser for some files (ie .c, .cc or .h)
|
|
111
|
-
# in this case RDoc generates a RDoc::TopLevel which we do not support in this generator
|
|
112
|
-
# So let's make sure we don't generate html for those.
|
|
113
|
-
@toplevels = @toplevels.select { |tl| tl.is_a? RDoc::PuppetTopLevel }
|
|
114
|
-
|
|
115
|
-
# build the modules, classes and per modules classes and define list
|
|
116
|
-
@toplevels.each do |toplevel|
|
|
117
|
-
next unless toplevel.document_self
|
|
118
|
-
|
|
119
|
-
file = HtmlFile.new(toplevel, @options, FILE_DIR)
|
|
120
|
-
classes = []
|
|
121
|
-
methods = []
|
|
122
|
-
modules = []
|
|
123
|
-
nodes = []
|
|
124
|
-
|
|
125
|
-
# find all classes of this toplevel
|
|
126
|
-
# store modules if we find one
|
|
127
|
-
toplevel.each_classmodule do |k|
|
|
128
|
-
generate_class_list(classes, modules, k, toplevel, CLASS_DIR)
|
|
129
|
-
end
|
|
130
|
-
|
|
131
|
-
# find all defines belonging to this toplevel
|
|
132
|
-
HtmlMethod.all_methods.each do |m|
|
|
133
|
-
# find parent module, check this method is not already
|
|
134
|
-
# defined.
|
|
135
|
-
if m.context.parent.toplevel === toplevel
|
|
136
|
-
methods << m
|
|
137
|
-
end
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
classes.each do |k|
|
|
141
|
-
@allclasses[k.index_name] = k unless @allclasses.has_key?(k.index_name)
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# generate nodes and plugins found
|
|
145
|
-
classes.each do |k|
|
|
146
|
-
next unless k.context.is_module?
|
|
147
|
-
|
|
148
|
-
k.context.each_node do |_name, node|
|
|
149
|
-
nodes << HTMLPuppetNode.new(node, toplevel, NODE_DIR, @options)
|
|
150
|
-
@nodes << nodes.last
|
|
151
|
-
end
|
|
152
|
-
k.context.each_plugin do |plugin|
|
|
153
|
-
@plugins << HTMLPuppetPlugin.new(plugin, toplevel, PLUGIN_DIR, @options)
|
|
154
|
-
end
|
|
155
|
-
k.context.each_fact do |fact|
|
|
156
|
-
@plugins << HTMLPuppetPlugin.new(fact, toplevel, PLUGIN_DIR, @options)
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
@files << file
|
|
161
|
-
@allfiles << { "file" => file, "modules" => modules, "classes" => classes, "methods" => methods, "nodes" => nodes }
|
|
162
|
-
end
|
|
163
|
-
|
|
164
|
-
# scan all classes to create the child's references
|
|
165
|
-
@allclasses.values.each do |klass|
|
|
166
|
-
superklass = klass.context.superclass
|
|
167
|
-
next unless superklass
|
|
168
|
-
|
|
169
|
-
superklass = AllReferences[superklass]
|
|
170
|
-
if superklass && (superklass.is_a?(HTMLPuppetClass) || superklass.is_a?(HTMLPuppetNode))
|
|
171
|
-
superklass.context.add_child(klass.context)
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
@classes = @allclasses.values
|
|
176
|
-
end
|
|
177
|
-
|
|
178
|
-
# produce a class/module list of HTMLPuppetModule/HTMLPuppetClass
|
|
179
|
-
# based on the code object traversal.
|
|
180
|
-
def generate_class_list(classes, modules, from, html_file, class_dir)
|
|
181
|
-
if from.is_module? and !@modules.has_key?(from.name)
|
|
182
|
-
k = HTMLPuppetModule.new(from, html_file, class_dir, @options)
|
|
183
|
-
classes << k
|
|
184
|
-
@modules[from.name] = k
|
|
185
|
-
modules << @modules[from.name]
|
|
186
|
-
elsif from.is_module?
|
|
187
|
-
modules << @modules[from.name]
|
|
188
|
-
elsif !from.is_module?
|
|
189
|
-
k = HTMLPuppetClass.new(from, html_file, class_dir, @options)
|
|
190
|
-
classes << k
|
|
191
|
-
end
|
|
192
|
-
from.each_classmodule do |mod|
|
|
193
|
-
generate_class_list(classes, modules, mod, html_file, class_dir)
|
|
194
|
-
end
|
|
195
|
-
end
|
|
196
|
-
|
|
197
|
-
# generate all the subdirectories, modules, classes and files
|
|
198
|
-
def gen_sub_directories
|
|
199
|
-
super
|
|
200
|
-
File.makedirs(MODULE_DIR)
|
|
201
|
-
File.makedirs(NODE_DIR)
|
|
202
|
-
File.makedirs(PLUGIN_DIR)
|
|
203
|
-
rescue
|
|
204
|
-
$stderr.puts $ERROR_INFO.message
|
|
205
|
-
exit 1
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
# generate the index of modules
|
|
209
|
-
def gen_file_index
|
|
210
|
-
gen_top_index(@modules.values, 'All Modules', RDoc::Page::TOP_INDEX, "fr_modules_index.html")
|
|
211
|
-
end
|
|
212
|
-
|
|
213
|
-
# generate a top index
|
|
214
|
-
def gen_top_index(collection, title, template, filename)
|
|
215
|
-
template = TemplatePage.new(RDoc::Page::FR_INDEX_BODY, template)
|
|
216
|
-
res = []
|
|
217
|
-
collection.sort.each do |f|
|
|
218
|
-
if f.document_self
|
|
219
|
-
res << { "classlist" => CGI.escapeHTML("#{MODULE_DIR}/fr_#{f.index_name}.html"), "module" => CGI.escapeHTML("#{CLASS_DIR}/#{f.index_name}.html"), "name" => CGI.escapeHTML(f.index_name) }
|
|
220
|
-
end
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
values = {
|
|
224
|
-
"entries" => res,
|
|
225
|
-
'list_title' => CGI.escapeHTML(title),
|
|
226
|
-
'index_url' => main_url,
|
|
227
|
-
'charset' => @options.charset,
|
|
228
|
-
'style_url' => style_url('', @options.css),
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
Puppet::FileSystem.open(filename, nil, "w:UTF-8") do |f|
|
|
232
|
-
template.write_html_on(f, values)
|
|
233
|
-
end
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
# generate the all classes index file and the combo index
|
|
237
|
-
def gen_class_index
|
|
238
|
-
gen_an_index(@classes, 'All Classes', RDoc::Page::CLASS_INDEX, "fr_class_index.html")
|
|
239
|
-
@allfiles.each do |file|
|
|
240
|
-
next if file['file'].context.file_relative_name =~ /\.rb$/
|
|
241
|
-
|
|
242
|
-
gen_composite_index(
|
|
243
|
-
file,
|
|
244
|
-
RDoc::Page::COMBO_INDEX,
|
|
245
|
-
"#{MODULE_DIR}/fr_#{file['file'].context.module_name}.html"
|
|
246
|
-
)
|
|
247
|
-
end
|
|
248
|
-
end
|
|
249
|
-
|
|
250
|
-
def gen_composite_index(collection, template, filename)
|
|
251
|
-
return if Puppet::FileSystem.exist?(filename)
|
|
252
|
-
|
|
253
|
-
template = TemplatePage.new(RDoc::Page::FR_INDEX_BODY, template)
|
|
254
|
-
res1 = []
|
|
255
|
-
collection['classes'].sort.each do |f|
|
|
256
|
-
if f.document_self
|
|
257
|
-
res1 << { "href" => "../" + CGI.escapeHTML(f.path), "name" => CGI.escapeHTML(f.index_name) } unless f.context.is_module?
|
|
258
|
-
end
|
|
259
|
-
end
|
|
260
|
-
|
|
261
|
-
res2 = []
|
|
262
|
-
collection['methods'].sort.each do |f|
|
|
263
|
-
res2 << { "href" => "../#{f.path}", "name" => f.index_name.sub(/\(.*\)$/, '') } if f.document_self
|
|
264
|
-
end
|
|
265
|
-
|
|
266
|
-
module_name = []
|
|
267
|
-
res3 = []
|
|
268
|
-
res4 = []
|
|
269
|
-
collection['modules'].sort.each do |f|
|
|
270
|
-
module_name << { "href" => "../" + CGI.escapeHTML(f.path), "name" => CGI.escapeHTML(f.index_name) }
|
|
271
|
-
unless f.facts.nil?
|
|
272
|
-
f.facts.each do |fact|
|
|
273
|
-
res3 << { "href" => "../" + CGI.escapeHTML(AllReferences["PLUGIN(#{fact.name})"].path), "name" => CGI.escapeHTML(fact.name) }
|
|
274
|
-
end
|
|
275
|
-
end
|
|
276
|
-
next if f.plugins.nil?
|
|
277
|
-
|
|
278
|
-
f.plugins.each do |plugin|
|
|
279
|
-
res4 << { "href" => "../" + CGI.escapeHTML(AllReferences["PLUGIN(#{plugin.name})"].path), "name" => CGI.escapeHTML(plugin.name) }
|
|
280
|
-
end
|
|
281
|
-
end
|
|
282
|
-
|
|
283
|
-
res5 = []
|
|
284
|
-
collection['nodes'].sort.each do |f|
|
|
285
|
-
res5 << { "href" => "../" + CGI.escapeHTML(f.path), "name" => CGI.escapeHTML(f.name) } if f.document_self
|
|
286
|
-
end
|
|
287
|
-
|
|
288
|
-
values = {
|
|
289
|
-
"module" => module_name,
|
|
290
|
-
"classes" => res1,
|
|
291
|
-
'classes_title' => CGI.escapeHTML("Classes"),
|
|
292
|
-
'defines_title' => CGI.escapeHTML("Defines"),
|
|
293
|
-
'facts_title' => CGI.escapeHTML("Custom Facts"),
|
|
294
|
-
'plugins_title' => CGI.escapeHTML("Plugins"),
|
|
295
|
-
'nodes_title' => CGI.escapeHTML("Nodes"),
|
|
296
|
-
'index_url' => main_url,
|
|
297
|
-
'charset' => @options.charset,
|
|
298
|
-
'style_url' => style_url('', @options.css),
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
values["defines"] = res2 if res2.size > 0
|
|
302
|
-
values["facts"] = res3 if res3.size > 0
|
|
303
|
-
values["plugins"] = res4 if res4.size > 0
|
|
304
|
-
values["nodes"] = res5 if res5.size > 0
|
|
305
|
-
|
|
306
|
-
Puppet::FileSystem.open(filename, nil, "w:UTF-8") do |f|
|
|
307
|
-
template.write_html_on(f, values)
|
|
308
|
-
end
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
# returns the initial_page url
|
|
312
|
-
def main_url
|
|
313
|
-
main_page = @options.main_page
|
|
314
|
-
ref = nil
|
|
315
|
-
if main_page
|
|
316
|
-
ref = AllReferences[main_page]
|
|
317
|
-
if ref
|
|
318
|
-
ref = ref.path
|
|
319
|
-
else
|
|
320
|
-
$stderr.puts "Could not find main page #{main_page}"
|
|
321
|
-
end
|
|
322
|
-
end
|
|
323
|
-
|
|
324
|
-
unless ref
|
|
325
|
-
@files.each do |file|
|
|
326
|
-
if file.document_self and file.context.global
|
|
327
|
-
ref = CGI.escapeHTML("#{CLASS_DIR}/#{file.context.module_name}.html")
|
|
328
|
-
break
|
|
329
|
-
end
|
|
330
|
-
end
|
|
331
|
-
end
|
|
332
|
-
|
|
333
|
-
unless ref
|
|
334
|
-
@files.each do |file|
|
|
335
|
-
if file.document_self and !file.context.global
|
|
336
|
-
ref = CGI.escapeHTML("#{CLASS_DIR}/#{file.context.module_name}.html")
|
|
337
|
-
break
|
|
338
|
-
end
|
|
339
|
-
end
|
|
340
|
-
end
|
|
341
|
-
|
|
342
|
-
unless ref
|
|
343
|
-
$stderr.puts "Couldn't find anything to document"
|
|
344
|
-
$stderr.puts "Perhaps you've used :stopdoc: in all classes"
|
|
345
|
-
exit(1)
|
|
346
|
-
end
|
|
347
|
-
|
|
348
|
-
ref
|
|
349
|
-
end
|
|
350
|
-
end
|
|
351
|
-
|
|
352
|
-
# This module is used to generate a referenced full name list of ContextUser
|
|
353
|
-
module ReferencedListBuilder
|
|
354
|
-
def build_referenced_list(list)
|
|
355
|
-
res = []
|
|
356
|
-
list.each do |i|
|
|
357
|
-
ref = AllReferences[i.name] || @context.find_symbol(i.name)
|
|
358
|
-
ref = ref.viewer if ref and ref.respond_to?(:viewer)
|
|
359
|
-
name = i.respond_to?(:full_name) ? i.full_name : i.name
|
|
360
|
-
h_name = CGI.escapeHTML(name)
|
|
361
|
-
if ref and ref.document_self
|
|
362
|
-
path = url(ref.path)
|
|
363
|
-
res << { "name" => h_name, "aref" => path }
|
|
364
|
-
else
|
|
365
|
-
res << { "name" => h_name }
|
|
366
|
-
end
|
|
367
|
-
end
|
|
368
|
-
res
|
|
369
|
-
end
|
|
370
|
-
end
|
|
371
|
-
|
|
372
|
-
# This module is used to hold/generate a list of puppet resources
|
|
373
|
-
# this is used in HTMLPuppetClass and HTMLPuppetNode
|
|
374
|
-
module ResourceContainer
|
|
375
|
-
def collect_resources
|
|
376
|
-
list = @context.resource_list
|
|
377
|
-
@resources = list.collect { |m| HTMLPuppetResource.new(m, self, @options) }
|
|
378
|
-
end
|
|
379
|
-
|
|
380
|
-
def build_resource_summary_list(path_prefix = '')
|
|
381
|
-
collect_resources unless @resources
|
|
382
|
-
resources = @resources.sort
|
|
383
|
-
res = []
|
|
384
|
-
resources.each do |r|
|
|
385
|
-
res << {
|
|
386
|
-
"name" => CGI.escapeHTML(r.name),
|
|
387
|
-
"aref" => Puppet::Util.uri_encode(path_prefix) + "\#" + Puppet::Util.uri_query_encode(r.aref)
|
|
388
|
-
}
|
|
389
|
-
end
|
|
390
|
-
res
|
|
391
|
-
end
|
|
392
|
-
|
|
393
|
-
def build_resource_detail_list(section)
|
|
394
|
-
outer = []
|
|
395
|
-
resources = @resources.sort
|
|
396
|
-
resources.each do |r|
|
|
397
|
-
row = {}
|
|
398
|
-
next unless r.section == section and r.document_self
|
|
399
|
-
|
|
400
|
-
row["name"] = CGI.escapeHTML(r.name)
|
|
401
|
-
desc = r.description.strip
|
|
402
|
-
row["m_desc"] = desc unless desc.empty?
|
|
403
|
-
row["aref"] = r.aref
|
|
404
|
-
row["params"] = r.params
|
|
405
|
-
outer << row
|
|
406
|
-
end
|
|
407
|
-
outer
|
|
408
|
-
end
|
|
409
|
-
end
|
|
410
|
-
|
|
411
|
-
class HTMLPuppetClass < HtmlClass
|
|
412
|
-
include ResourceContainer, ReferencedListBuilder
|
|
413
|
-
|
|
414
|
-
def value_hash
|
|
415
|
-
super
|
|
416
|
-
rl = build_resource_summary_list
|
|
417
|
-
@values["resources"] = rl unless rl.empty?
|
|
418
|
-
|
|
419
|
-
@context.sections.each do |section|
|
|
420
|
-
secdata = @values["sections"].select { |s| s["secsequence"] == section.sequence }
|
|
421
|
-
next unless secdata.size == 1
|
|
422
|
-
|
|
423
|
-
secdata = secdata[0]
|
|
424
|
-
|
|
425
|
-
rdl = build_resource_detail_list(section)
|
|
426
|
-
secdata["resource_list"] = rdl unless rdl.empty?
|
|
427
|
-
end
|
|
428
|
-
|
|
429
|
-
rl = build_require_list(@context)
|
|
430
|
-
@values["requires"] = rl unless rl.empty?
|
|
431
|
-
|
|
432
|
-
rl = build_realize_list(@context)
|
|
433
|
-
@values["realizes"] = rl unless rl.empty?
|
|
434
|
-
|
|
435
|
-
cl = build_child_list(@context)
|
|
436
|
-
@values["childs"] = cl unless cl.empty?
|
|
437
|
-
|
|
438
|
-
@values
|
|
439
|
-
end
|
|
440
|
-
|
|
441
|
-
def build_require_list(context)
|
|
442
|
-
build_referenced_list(context.requires)
|
|
443
|
-
end
|
|
444
|
-
|
|
445
|
-
def build_realize_list(context)
|
|
446
|
-
build_referenced_list(context.realizes)
|
|
447
|
-
end
|
|
448
|
-
|
|
449
|
-
def build_child_list(context)
|
|
450
|
-
build_referenced_list(context.childs)
|
|
451
|
-
end
|
|
452
|
-
end
|
|
453
|
-
|
|
454
|
-
class HTMLPuppetNode < ContextUser
|
|
455
|
-
include ResourceContainer, ReferencedListBuilder
|
|
456
|
-
|
|
457
|
-
attr_reader :path
|
|
458
|
-
|
|
459
|
-
def initialize(context, html_file, prefix, options)
|
|
460
|
-
super(context, options)
|
|
461
|
-
|
|
462
|
-
@html_file = html_file
|
|
463
|
-
@is_module = context.is_module?
|
|
464
|
-
@values = {}
|
|
465
|
-
|
|
466
|
-
context.viewer = self
|
|
467
|
-
|
|
468
|
-
if options.all_one_file
|
|
469
|
-
@path = context.full_name
|
|
470
|
-
else
|
|
471
|
-
@path = http_url(context.full_name, prefix)
|
|
472
|
-
end
|
|
473
|
-
|
|
474
|
-
AllReferences.add("NODE(#{@context.full_name})", self)
|
|
475
|
-
end
|
|
476
|
-
|
|
477
|
-
def name
|
|
478
|
-
@context.name
|
|
479
|
-
end
|
|
480
|
-
|
|
481
|
-
# return the relative file name to store this class in,
|
|
482
|
-
# which is also its url
|
|
483
|
-
def http_url(full_name, prefix)
|
|
484
|
-
path = full_name.dup
|
|
485
|
-
path.gsub!(/<<\s*(\w*)/) { "from-#{::Regexp.last_match(1)}" } if path['<<']
|
|
486
|
-
File.join(prefix, path.split("::").collect { |p| Digest::MD5.hexdigest(p) }) + ".html"
|
|
487
|
-
end
|
|
488
|
-
|
|
489
|
-
def parent_name
|
|
490
|
-
@context.parent.full_name
|
|
491
|
-
end
|
|
492
|
-
|
|
493
|
-
def index_name
|
|
494
|
-
name
|
|
495
|
-
end
|
|
496
|
-
|
|
497
|
-
def write_on(f)
|
|
498
|
-
value_hash
|
|
499
|
-
|
|
500
|
-
template = TemplatePage.new(
|
|
501
|
-
RDoc::Page::BODYINC,
|
|
502
|
-
RDoc::Page::NODE_PAGE,
|
|
503
|
-
RDoc::Page::METHOD_LIST
|
|
504
|
-
)
|
|
505
|
-
template.write_html_on(f, @values)
|
|
506
|
-
end
|
|
507
|
-
|
|
508
|
-
def value_hash
|
|
509
|
-
class_attribute_values
|
|
510
|
-
add_table_of_sections
|
|
511
|
-
|
|
512
|
-
@values["charset"] = @options.charset
|
|
513
|
-
@values["style_url"] = style_url(path, @options.css)
|
|
514
|
-
|
|
515
|
-
d = markup(@context.comment)
|
|
516
|
-
@values["description"] = d unless d.empty?
|
|
517
|
-
|
|
518
|
-
ml = build_method_summary_list
|
|
519
|
-
@values["methods"] = ml unless ml.empty?
|
|
520
|
-
|
|
521
|
-
rl = build_resource_summary_list
|
|
522
|
-
@values["resources"] = rl unless rl.empty?
|
|
523
|
-
|
|
524
|
-
il = build_include_list(@context)
|
|
525
|
-
@values["includes"] = il unless il.empty?
|
|
526
|
-
|
|
527
|
-
rl = build_require_list(@context)
|
|
528
|
-
@values["requires"] = rl unless rl.empty?
|
|
529
|
-
|
|
530
|
-
rl = build_realize_list(@context)
|
|
531
|
-
@values["realizes"] = rl unless rl.empty?
|
|
532
|
-
|
|
533
|
-
cl = build_child_list(@context)
|
|
534
|
-
@values["childs"] = cl unless cl.empty?
|
|
535
|
-
|
|
536
|
-
@values["sections"] = @context.sections.map do |section|
|
|
537
|
-
secdata = {
|
|
538
|
-
"sectitle" => section.title,
|
|
539
|
-
"secsequence" => section.sequence,
|
|
540
|
-
"seccomment" => markup(section.comment)
|
|
541
|
-
}
|
|
542
|
-
|
|
543
|
-
al = build_alias_summary_list(section)
|
|
544
|
-
secdata["aliases"] = al unless al.empty?
|
|
545
|
-
|
|
546
|
-
co = build_constants_summary_list(section)
|
|
547
|
-
secdata["constants"] = co unless co.empty?
|
|
548
|
-
|
|
549
|
-
al = build_attribute_list(section)
|
|
550
|
-
secdata["attributes"] = al unless al.empty?
|
|
551
|
-
|
|
552
|
-
cl = build_class_list(0, @context, section)
|
|
553
|
-
secdata["classlist"] = cl unless cl.empty?
|
|
554
|
-
|
|
555
|
-
mdl = build_method_detail_list(section)
|
|
556
|
-
secdata["method_list"] = mdl unless mdl.empty?
|
|
557
|
-
|
|
558
|
-
rdl = build_resource_detail_list(section)
|
|
559
|
-
secdata["resource_list"] = rdl unless rdl.empty?
|
|
560
|
-
|
|
561
|
-
secdata
|
|
562
|
-
end
|
|
563
|
-
|
|
564
|
-
@values
|
|
565
|
-
end
|
|
566
|
-
|
|
567
|
-
def build_attribute_list(section)
|
|
568
|
-
atts = @context.attributes.sort
|
|
569
|
-
res = []
|
|
570
|
-
atts.each do |att|
|
|
571
|
-
next unless att.section == section
|
|
572
|
-
|
|
573
|
-
next unless att.visibility == :public || att.visibility == :protected || @options.show_all
|
|
574
|
-
|
|
575
|
-
entry = {
|
|
576
|
-
"name" => CGI.escapeHTML(att.name),
|
|
577
|
-
"rw" => att.rw,
|
|
578
|
-
"a_desc" => markup(att.comment, true)
|
|
579
|
-
}
|
|
580
|
-
unless att.visibility == :public || att.visibility == :protected
|
|
581
|
-
entry["rw"] << "-"
|
|
582
|
-
end
|
|
583
|
-
res << entry
|
|
584
|
-
end
|
|
585
|
-
res
|
|
586
|
-
end
|
|
587
|
-
|
|
588
|
-
def class_attribute_values
|
|
589
|
-
h_name = CGI.escapeHTML(name)
|
|
590
|
-
|
|
591
|
-
@values["classmod"] = "Node"
|
|
592
|
-
@values["title"] = CGI.escapeHTML("#{@values['classmod']}: #{h_name}")
|
|
593
|
-
|
|
594
|
-
c = @context
|
|
595
|
-
c = c.parent while c and !c.diagram
|
|
596
|
-
|
|
597
|
-
@values["diagram"] = diagram_reference(c.diagram) if c && c.diagram
|
|
598
|
-
|
|
599
|
-
@values["full_name"] = h_name
|
|
600
|
-
|
|
601
|
-
parent_class = @context.superclass
|
|
602
|
-
|
|
603
|
-
if parent_class
|
|
604
|
-
@values["parent"] = CGI.escapeHTML(parent_class)
|
|
605
|
-
|
|
606
|
-
if parent_name
|
|
607
|
-
lookup = parent_name + "::#{parent_class}"
|
|
608
|
-
else
|
|
609
|
-
lookup = parent_class
|
|
610
|
-
end
|
|
611
|
-
lookup = "NODE(#{lookup})"
|
|
612
|
-
parent_url = AllReferences[lookup] || AllReferences[parent_class]
|
|
613
|
-
@values["par_url"] = aref_to(parent_url.path) if parent_url and parent_url.document_self
|
|
614
|
-
end
|
|
615
|
-
|
|
616
|
-
files = []
|
|
617
|
-
@context.in_files.each do |f|
|
|
618
|
-
res = {}
|
|
619
|
-
full_path = CGI.escapeHTML(f.file_absolute_name)
|
|
620
|
-
|
|
621
|
-
res["full_path"] = full_path
|
|
622
|
-
res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
|
|
623
|
-
|
|
624
|
-
res["cvsurl"] = cvs_url(@options.webcvs, full_path) if @options.webcvs
|
|
625
|
-
|
|
626
|
-
files << res
|
|
627
|
-
end
|
|
628
|
-
|
|
629
|
-
@values['infiles'] = files
|
|
630
|
-
end
|
|
631
|
-
|
|
632
|
-
def build_require_list(context)
|
|
633
|
-
build_referenced_list(context.requires)
|
|
634
|
-
end
|
|
635
|
-
|
|
636
|
-
def build_realize_list(context)
|
|
637
|
-
build_referenced_list(context.realizes)
|
|
638
|
-
end
|
|
639
|
-
|
|
640
|
-
def build_child_list(context)
|
|
641
|
-
build_referenced_list(context.childs)
|
|
642
|
-
end
|
|
643
|
-
|
|
644
|
-
def <=>(other)
|
|
645
|
-
name <=> other.name
|
|
646
|
-
end
|
|
647
|
-
end
|
|
648
|
-
|
|
649
|
-
class HTMLPuppetModule < HtmlClass
|
|
650
|
-
def value_hash
|
|
651
|
-
@values = super
|
|
652
|
-
|
|
653
|
-
fl = build_facts_summary_list
|
|
654
|
-
@values["facts"] = fl unless fl.empty?
|
|
655
|
-
|
|
656
|
-
pl = build_plugins_summary_list
|
|
657
|
-
@values["plugins"] = pl unless pl.empty?
|
|
658
|
-
|
|
659
|
-
nl = build_nodes_list(0, @context)
|
|
660
|
-
@values["nodelist"] = nl unless nl.empty?
|
|
661
|
-
|
|
662
|
-
@values
|
|
663
|
-
end
|
|
664
|
-
|
|
665
|
-
def build_nodes_list(level, context)
|
|
666
|
-
res = ""
|
|
667
|
-
prefix = " ::" * level;
|
|
668
|
-
|
|
669
|
-
context.nodes.sort.each do |node|
|
|
670
|
-
next unless node.document_self
|
|
671
|
-
|
|
672
|
-
res <<
|
|
673
|
-
prefix <<
|
|
674
|
-
"Node " <<
|
|
675
|
-
href(url(node.viewer.path), "link", node.full_name) <<
|
|
676
|
-
"<br />\n"
|
|
677
|
-
end
|
|
678
|
-
res
|
|
679
|
-
end
|
|
680
|
-
|
|
681
|
-
def build_facts_summary_list
|
|
682
|
-
potentially_referenced_list(context.facts) { |fn| ["PLUGIN(#{fn})"] }
|
|
683
|
-
end
|
|
684
|
-
|
|
685
|
-
def build_plugins_summary_list
|
|
686
|
-
potentially_referenced_list(context.plugins) { |fn| ["PLUGIN(#{fn})"] }
|
|
687
|
-
end
|
|
688
|
-
|
|
689
|
-
def facts
|
|
690
|
-
@context.facts
|
|
691
|
-
end
|
|
692
|
-
|
|
693
|
-
def plugins
|
|
694
|
-
@context.plugins
|
|
695
|
-
end
|
|
696
|
-
end
|
|
697
|
-
|
|
698
|
-
class HTMLPuppetPlugin < ContextUser
|
|
699
|
-
attr_reader :path
|
|
700
|
-
|
|
701
|
-
def initialize(context, html_file, prefix, options)
|
|
702
|
-
super(context, options)
|
|
703
|
-
|
|
704
|
-
@html_file = html_file
|
|
705
|
-
@is_module = false
|
|
706
|
-
@values = {}
|
|
707
|
-
|
|
708
|
-
context.viewer = self
|
|
709
|
-
|
|
710
|
-
if options.all_one_file
|
|
711
|
-
@path = context.full_name
|
|
712
|
-
else
|
|
713
|
-
@path = http_url(context.full_name, prefix)
|
|
714
|
-
end
|
|
715
|
-
|
|
716
|
-
AllReferences.add("PLUGIN(#{@context.full_name})", self)
|
|
717
|
-
end
|
|
718
|
-
|
|
719
|
-
def name
|
|
720
|
-
@context.name
|
|
721
|
-
end
|
|
722
|
-
|
|
723
|
-
# return the relative file name to store this class in,
|
|
724
|
-
# which is also its url
|
|
725
|
-
def http_url(full_name, prefix)
|
|
726
|
-
path = full_name.dup
|
|
727
|
-
path.gsub!(/<<\s*(\w*)/) { "from-#{::Regexp.last_match(1)}" } if path['<<']
|
|
728
|
-
File.join(prefix, path.split("::")) + ".html"
|
|
729
|
-
end
|
|
730
|
-
|
|
731
|
-
def parent_name
|
|
732
|
-
@context.parent.full_name
|
|
733
|
-
end
|
|
734
|
-
|
|
735
|
-
def index_name
|
|
736
|
-
name
|
|
737
|
-
end
|
|
738
|
-
|
|
739
|
-
def write_on(f)
|
|
740
|
-
value_hash
|
|
741
|
-
|
|
742
|
-
template = TemplatePage.new(
|
|
743
|
-
RDoc::Page::BODYINC,
|
|
744
|
-
RDoc::Page::PLUGIN_PAGE,
|
|
745
|
-
RDoc::Page::PLUGIN_LIST
|
|
746
|
-
)
|
|
747
|
-
template.write_html_on(f, @values)
|
|
748
|
-
end
|
|
749
|
-
|
|
750
|
-
def value_hash
|
|
751
|
-
attribute_values
|
|
752
|
-
add_table_of_sections
|
|
753
|
-
|
|
754
|
-
@values["charset"] = @options.charset
|
|
755
|
-
@values["style_url"] = style_url(path, @options.css)
|
|
756
|
-
|
|
757
|
-
d = markup(@context.comment)
|
|
758
|
-
@values["description"] = d unless d.empty?
|
|
759
|
-
|
|
760
|
-
if context.is_fact?
|
|
761
|
-
unless context.confine.empty?
|
|
762
|
-
res = {}
|
|
763
|
-
res["type"] = context.confine[:type]
|
|
764
|
-
res["value"] = context.confine[:value]
|
|
765
|
-
@values["confine"] = [res]
|
|
766
|
-
end
|
|
767
|
-
else
|
|
768
|
-
@values["type"] = context.type
|
|
769
|
-
end
|
|
770
|
-
|
|
771
|
-
@values["sections"] = @context.sections.map do |section|
|
|
772
|
-
secdata = {
|
|
773
|
-
"sectitle" => section.title,
|
|
774
|
-
"secsequence" => section.sequence,
|
|
775
|
-
"seccomment" => markup(section.comment)
|
|
776
|
-
}
|
|
777
|
-
secdata
|
|
778
|
-
end
|
|
779
|
-
|
|
780
|
-
@values
|
|
781
|
-
end
|
|
782
|
-
|
|
783
|
-
def attribute_values
|
|
784
|
-
h_name = CGI.escapeHTML(name)
|
|
785
|
-
|
|
786
|
-
if @context.is_fact?
|
|
787
|
-
@values["classmod"] = "Fact"
|
|
788
|
-
else
|
|
789
|
-
@values["classmod"] = "Plugin"
|
|
790
|
-
end
|
|
791
|
-
@values["title"] = "#{@values['classmod']}: #{h_name}"
|
|
792
|
-
|
|
793
|
-
@values["full_name"] = h_name
|
|
794
|
-
|
|
795
|
-
files = []
|
|
796
|
-
@context.in_files.each do |f|
|
|
797
|
-
res = {}
|
|
798
|
-
full_path = CGI.escapeHTML(f.file_absolute_name)
|
|
799
|
-
|
|
800
|
-
res["full_path"] = full_path
|
|
801
|
-
res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
|
|
802
|
-
|
|
803
|
-
res["cvsurl"] = cvs_url(@options.webcvs, full_path) if @options.webcvs
|
|
804
|
-
|
|
805
|
-
files << res
|
|
806
|
-
end
|
|
807
|
-
|
|
808
|
-
@values['infiles'] = files
|
|
809
|
-
end
|
|
810
|
-
|
|
811
|
-
def <=>(other)
|
|
812
|
-
name <=> other.name
|
|
813
|
-
end
|
|
814
|
-
end
|
|
815
|
-
|
|
816
|
-
class HTMLPuppetResource
|
|
817
|
-
include MarkUp
|
|
818
|
-
|
|
819
|
-
attr_reader :context
|
|
820
|
-
|
|
821
|
-
@@seq = "R000000"
|
|
822
|
-
|
|
823
|
-
def initialize(context, html_class, options)
|
|
824
|
-
@context = context
|
|
825
|
-
@html_class = html_class
|
|
826
|
-
@options = options
|
|
827
|
-
@@seq = @@seq.succ
|
|
828
|
-
@seq = @@seq
|
|
829
|
-
|
|
830
|
-
context.viewer = self
|
|
831
|
-
|
|
832
|
-
AllReferences.add(name, self)
|
|
833
|
-
end
|
|
834
|
-
|
|
835
|
-
def as_href(from_path)
|
|
836
|
-
if @options.all_one_file
|
|
837
|
-
"##{path}"
|
|
838
|
-
else
|
|
839
|
-
HTMLGenerator.gen_url(from_path, path)
|
|
840
|
-
end
|
|
841
|
-
end
|
|
842
|
-
|
|
843
|
-
def name
|
|
844
|
-
@context.name
|
|
845
|
-
end
|
|
846
|
-
|
|
847
|
-
def section
|
|
848
|
-
@context.section
|
|
849
|
-
end
|
|
850
|
-
|
|
851
|
-
def index_name
|
|
852
|
-
@context.name.to_s
|
|
853
|
-
end
|
|
854
|
-
|
|
855
|
-
def params
|
|
856
|
-
@context.params
|
|
857
|
-
end
|
|
858
|
-
|
|
859
|
-
def parent_name
|
|
860
|
-
if @context.parent.parent
|
|
861
|
-
@context.parent.parent.full_name
|
|
862
|
-
else
|
|
863
|
-
nil
|
|
864
|
-
end
|
|
865
|
-
end
|
|
866
|
-
|
|
867
|
-
def aref
|
|
868
|
-
@seq
|
|
869
|
-
end
|
|
870
|
-
|
|
871
|
-
def path
|
|
872
|
-
if @options.all_one_file
|
|
873
|
-
aref
|
|
874
|
-
else
|
|
875
|
-
@html_class.path + "##{aref}"
|
|
876
|
-
end
|
|
877
|
-
end
|
|
878
|
-
|
|
879
|
-
def description
|
|
880
|
-
markup(@context.comment)
|
|
881
|
-
end
|
|
882
|
-
|
|
883
|
-
def <=>(other)
|
|
884
|
-
@context <=> other.context
|
|
885
|
-
end
|
|
886
|
-
|
|
887
|
-
def document_self
|
|
888
|
-
@context.document_self
|
|
889
|
-
end
|
|
890
|
-
|
|
891
|
-
def find_symbol(symbol, method = nil)
|
|
892
|
-
res = @context.parent.find_symbol(symbol, method)
|
|
893
|
-
res && res.viewer
|
|
894
|
-
end
|
|
895
|
-
end
|
|
896
|
-
|
|
897
|
-
class PuppetGeneratorInOne < HTMLGeneratorInOne
|
|
898
|
-
def gen_method_index
|
|
899
|
-
gen_an_index(HtmlMethod.all_methods, 'Defines')
|
|
900
|
-
end
|
|
901
|
-
end
|
|
902
|
-
end
|