puppet 0.24.6 → 0.24.7

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

Potentially problematic release.


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

Files changed (383) hide show
  1. data/CHANGELOG +115 -0
  2. data/Rakefile +43 -14
  3. data/bin/puppetca +6 -5
  4. data/bin/puppetdoc +109 -15
  5. data/bin/ralsh +3 -1
  6. data/conf/redhat/puppet.spec +74 -48
  7. data/examples/mcx_dock_absent.pp +4 -0
  8. data/examples/mcx_dock_default.pp +118 -0
  9. data/examples/mcx_dock_full.pp +125 -0
  10. data/examples/mcx_dock_invalid.pp +9 -0
  11. data/examples/mcx_nogroup.pp +118 -0
  12. data/examples/mcx_notexists_absent.pp +4 -0
  13. data/ext/emacs/puppet-mode.el +1 -1
  14. data/lib/puppet.rb +1 -1
  15. data/lib/puppet/external/nagios/base.rb +114 -71
  16. data/lib/puppet/feature/base.rb +6 -0
  17. data/lib/puppet/indirector/yaml.rb +12 -3
  18. data/lib/puppet/module.rb +1 -1
  19. data/lib/puppet/network/client/master.rb +1 -1
  20. data/lib/puppet/network/xmlrpc/client.rb +3 -1
  21. data/lib/puppet/parameter.rb +1 -1
  22. data/lib/puppet/parser/ast.rb +15 -0
  23. data/lib/puppet/parser/ast/astarray.rb +1 -2
  24. data/lib/puppet/parser/ast/casestatement.rb +2 -0
  25. data/lib/puppet/parser/ast/collection.rb +2 -0
  26. data/lib/puppet/parser/ast/comparison_operator.rb +4 -0
  27. data/lib/puppet/parser/ast/definition.rb +2 -0
  28. data/lib/puppet/parser/ast/else.rb +3 -0
  29. data/lib/puppet/parser/ast/function.rb +19 -12
  30. data/lib/puppet/parser/ast/hostclass.rb +9 -1
  31. data/lib/puppet/parser/ast/ifstatement.rb +3 -0
  32. data/lib/puppet/parser/ast/node.rb +3 -0
  33. data/lib/puppet/parser/ast/resource.rb +3 -0
  34. data/lib/puppet/parser/ast/resource_defaults.rb +2 -0
  35. data/lib/puppet/parser/ast/resource_override.rb +3 -0
  36. data/lib/puppet/parser/ast/vardef.rb +3 -0
  37. data/lib/puppet/parser/functions.rb +14 -0
  38. data/lib/puppet/parser/functions/inline_template.rb +21 -0
  39. data/lib/puppet/parser/functions/template.rb +3 -2
  40. data/lib/puppet/parser/lexer.rb +56 -7
  41. data/lib/puppet/parser/parser.rb +114 -98
  42. data/lib/puppet/parser/parser_support.rb +24 -4
  43. data/lib/puppet/parser/resource/reference.rb +4 -3
  44. data/lib/puppet/parser/templatewrapper.rb +30 -22
  45. data/lib/puppet/property.rb +1 -1
  46. data/lib/puppet/property/list.rb +7 -2
  47. data/lib/puppet/property/ordered_list.rb +22 -0
  48. data/lib/puppet/provider/augeas/augeas.rb +189 -0
  49. data/lib/puppet/provider/computer/computer.rb +22 -0
  50. data/lib/puppet/provider/confine.rb +4 -1
  51. data/lib/puppet/provider/confine/variable.rb +13 -2
  52. data/lib/puppet/provider/confine_collection.rb +4 -1
  53. data/lib/puppet/provider/confiner.rb +1 -1
  54. data/lib/puppet/provider/group/directoryservice.rb +6 -3
  55. data/lib/puppet/provider/group/groupadd.rb +5 -2
  56. data/lib/puppet/provider/group/ldap.rb +11 -9
  57. data/lib/puppet/provider/group/netinfo.rb +8 -4
  58. data/lib/puppet/provider/group/pw.rb +5 -1
  59. data/lib/puppet/provider/host/netinfo.rb +5 -2
  60. data/lib/puppet/provider/macauthorization/macauthorization.rb +315 -0
  61. data/lib/puppet/provider/mcx/mcxcontent.rb +201 -0
  62. data/lib/puppet/provider/nameservice/directoryservice.rb +210 -107
  63. data/lib/puppet/provider/nameservice/netinfo.rb +7 -2
  64. data/lib/puppet/provider/package/appdmg.rb +0 -3
  65. data/lib/puppet/provider/package/apt.rb +6 -0
  66. data/lib/puppet/provider/package/rpm.rb +2 -0
  67. data/lib/puppet/provider/package/yum.rb +5 -1
  68. data/lib/puppet/provider/package/yumhelper.py +9 -0
  69. data/lib/puppet/provider/service/base.rb +9 -6
  70. data/lib/puppet/provider/service/daemontools.rb +25 -15
  71. data/lib/puppet/provider/service/debian.rb +6 -2
  72. data/lib/puppet/provider/service/freebsd.rb +5 -2
  73. data/lib/puppet/provider/service/gentoo.rb +6 -3
  74. data/lib/puppet/provider/service/init.rb +31 -21
  75. data/lib/puppet/provider/service/launchd.rb +195 -0
  76. data/lib/puppet/provider/service/redhat.rb +5 -2
  77. data/lib/puppet/provider/service/runit.rb +30 -20
  78. data/lib/puppet/provider/service/smf.rb +7 -4
  79. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +21 -1
  80. data/lib/puppet/provider/user/directoryservice.rb +1 -0
  81. data/lib/puppet/provider/user/netinfo.rb +9 -3
  82. data/lib/puppet/provider/user/user_role_add.rb +43 -6
  83. data/lib/puppet/provider/zfs/solaris.rb +45 -0
  84. data/lib/puppet/provider/zone/solaris.rb +8 -4
  85. data/lib/puppet/provider/zpool/solaris.rb +116 -0
  86. data/lib/puppet/rails/database/003_add_environment_to_host.rb +9 -0
  87. data/lib/puppet/rails/database/schema.rb +1 -0
  88. data/lib/puppet/rails/host.rb +4 -0
  89. data/lib/puppet/reference/configuration.rb +1 -1
  90. data/lib/puppet/reports/tagmail.rb +15 -6
  91. data/lib/puppet/transaction/change.rb +3 -5
  92. data/lib/puppet/transportable.rb +1 -0
  93. data/lib/puppet/type/augeas.rb +155 -0
  94. data/lib/puppet/type/computer.rb +62 -0
  95. data/lib/puppet/type/exec.rb +2 -1
  96. data/lib/puppet/type/file.rb +1 -1
  97. data/lib/puppet/type/file/ensure.rb +8 -5
  98. data/lib/puppet/type/file/mode.rb +0 -14
  99. data/lib/puppet/type/file/owner.rb +32 -64
  100. data/lib/puppet/type/file/selcontext.rb +3 -8
  101. data/lib/puppet/type/group.rb +27 -45
  102. data/lib/puppet/type/k5login.rb +1 -1
  103. data/lib/puppet/type/macauthorization.rb +141 -0
  104. data/lib/puppet/type/mcx.rb +115 -0
  105. data/lib/puppet/type/mount.rb +1 -1
  106. data/lib/puppet/type/nagios_hostdependency.rb +3 -0
  107. data/lib/puppet/type/ssh_authorized_key.rb +16 -0
  108. data/lib/puppet/type/tidy.rb +43 -14
  109. data/lib/puppet/type/user.rb +25 -1
  110. data/lib/puppet/type/zfs.rb +51 -0
  111. data/lib/puppet/type/zone.rb +8 -0
  112. data/lib/puppet/type/zpool.rb +93 -0
  113. data/lib/puppet/util.rb +17 -38
  114. data/lib/puppet/util/file_locking.rb +44 -0
  115. data/lib/puppet/util/filetype.rb +3 -3
  116. data/lib/puppet/util/log.rb +1 -16
  117. data/lib/puppet/util/metric.rb +0 -5
  118. data/lib/puppet/util/rdoc.rb +85 -0
  119. data/lib/puppet/util/rdoc/code_objects.rb +219 -0
  120. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +829 -0
  121. data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +1051 -0
  122. data/lib/puppet/util/rdoc/parser.rb +437 -0
  123. data/lib/puppet/util/selinux.rb +135 -63
  124. data/lib/puppet/util/settings.rb +136 -126
  125. data/lib/puppet/util/storage.rb +4 -2
  126. data/spec/Rakefile +91 -0
  127. data/spec/integration/checksum.rb +47 -0
  128. data/spec/integration/defaults.rb +47 -0
  129. data/spec/integration/file_serving/configuration.rb +43 -0
  130. data/spec/integration/file_serving/content.rb +18 -0
  131. data/spec/integration/file_serving/metadata.rb +18 -0
  132. data/spec/integration/indirector/direct_file_server.rb +80 -0
  133. data/spec/integration/indirector/file_content/file_server.rb +18 -0
  134. data/spec/integration/indirector/file_metadata/file_server.rb +18 -0
  135. data/spec/integration/indirector/module_files.rb +57 -0
  136. data/spec/integration/indirector/node/ldap.rb +15 -0
  137. data/spec/integration/indirector/rest.rb +464 -0
  138. data/spec/integration/network/server/mongrel.rb +48 -0
  139. data/spec/integration/network/server/webrick.rb +48 -0
  140. data/spec/integration/node.rb +93 -0
  141. data/spec/integration/node/catalog.rb +54 -0
  142. data/spec/integration/node/facts.rb +45 -0
  143. data/spec/integration/provider/package.rb +26 -0
  144. data/spec/integration/provider/service/init.rb +32 -0
  145. data/spec/integration/reference/providers.rb +17 -0
  146. data/spec/integration/reports.rb +14 -0
  147. data/spec/integration/transaction/report.rb +26 -0
  148. data/spec/integration/type/package.rb +22 -0
  149. data/spec/integration/util/file_locking.rb +36 -0
  150. data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +46 -0
  151. data/spec/monkey_patches/alias_should_to_must.rb +5 -0
  152. data/spec/shared_behaviours/file_server_terminus.rb +42 -0
  153. data/spec/shared_behaviours/file_serving.rb +64 -0
  154. data/spec/shared_behaviours/memory_terminus.rb +32 -0
  155. data/spec/spec.opts +5 -0
  156. data/spec/spec_helper.rb +36 -0
  157. data/spec/unit/executables/client/certhandler.rb +122 -0
  158. data/spec/unit/file_serving/configuration.rb +224 -0
  159. data/spec/unit/file_serving/configuration/parser.rb +135 -0
  160. data/spec/unit/file_serving/content.rb +71 -0
  161. data/spec/unit/file_serving/file_base.rb +124 -0
  162. data/spec/unit/file_serving/fileset.rb +239 -0
  163. data/spec/unit/file_serving/indirection_hooks.rb +124 -0
  164. data/spec/unit/file_serving/metadata.rb +187 -0
  165. data/spec/unit/file_serving/mount.rb +143 -0
  166. data/spec/unit/file_serving/terminus_helper.rb +76 -0
  167. data/spec/unit/indirector.rb +152 -0
  168. data/spec/unit/indirector/catalog/compiler.rb +156 -0
  169. data/spec/unit/indirector/catalog/yaml.rb +25 -0
  170. data/spec/unit/indirector/checksum/file.rb +139 -0
  171. data/spec/unit/indirector/code.rb +33 -0
  172. data/spec/unit/indirector/direct_file_server.rb +89 -0
  173. data/spec/unit/indirector/envelope.rb +47 -0
  174. data/spec/unit/indirector/exec.rb +51 -0
  175. data/spec/unit/indirector/facts/facter.rb +76 -0
  176. data/spec/unit/indirector/facts/yaml.rb +26 -0
  177. data/spec/unit/indirector/file.rb +154 -0
  178. data/spec/unit/indirector/file_content/file.rb +18 -0
  179. data/spec/unit/indirector/file_content/file_server.rb +18 -0
  180. data/spec/unit/indirector/file_content/modules.rb +18 -0
  181. data/spec/unit/indirector/file_content/rest.rb +11 -0
  182. data/spec/unit/indirector/file_metadata/file.rb +52 -0
  183. data/spec/unit/indirector/file_metadata/file_server.rb +18 -0
  184. data/spec/unit/indirector/file_metadata/modules.rb +42 -0
  185. data/spec/unit/indirector/file_metadata/rest.rb +9 -0
  186. data/spec/unit/indirector/file_server.rb +184 -0
  187. data/spec/unit/indirector/indirection.rb +731 -0
  188. data/spec/unit/indirector/ldap.rb +143 -0
  189. data/spec/unit/indirector/memory.rb +29 -0
  190. data/spec/unit/indirector/module_files.rb +259 -0
  191. data/spec/unit/indirector/node/exec.rb +69 -0
  192. data/spec/unit/indirector/node/ldap.rb +424 -0
  193. data/spec/unit/indirector/node/memory.rb +19 -0
  194. data/spec/unit/indirector/node/plain.rb +19 -0
  195. data/spec/unit/indirector/node/rest.rb +13 -0
  196. data/spec/unit/indirector/node/yaml.rb +25 -0
  197. data/spec/unit/indirector/plain.rb +29 -0
  198. data/spec/unit/indirector/report/processor.rb +81 -0
  199. data/spec/unit/indirector/request.rb +87 -0
  200. data/spec/unit/indirector/rest.rb +372 -0
  201. data/spec/unit/indirector/ssl_rsa/file.rb +116 -0
  202. data/spec/unit/indirector/terminus.rb +245 -0
  203. data/spec/unit/indirector/yaml.rb +145 -0
  204. data/spec/unit/module.rb +247 -0
  205. data/spec/unit/network/client.rb +45 -0
  206. data/spec/unit/network/client/master.rb +442 -0
  207. data/spec/unit/network/handler/fileserver.rb +179 -0
  208. data/spec/unit/network/http.rb +35 -0
  209. data/spec/unit/network/http/mongrel.rb +117 -0
  210. data/spec/unit/network/http/mongrel/rest.rb +377 -0
  211. data/spec/unit/network/http/mongrel/xmlrpc.rb +0 -0
  212. data/spec/unit/network/http/webrick.rb +127 -0
  213. data/spec/unit/network/http/webrick/rest.rb +323 -0
  214. data/spec/unit/network/http/webrick/xmlrpc.rb +0 -0
  215. data/spec/unit/network/http_pool.rb +238 -0
  216. data/spec/unit/network/server.rb +316 -0
  217. data/spec/unit/network/xmlrpc/client.rb +13 -0
  218. data/spec/unit/node.rb +167 -0
  219. data/spec/unit/node/catalog.rb +864 -0
  220. data/spec/unit/node/environment.rb +37 -0
  221. data/spec/unit/node/facts.rb +44 -0
  222. data/spec/unit/other/checksum.rb +92 -0
  223. data/spec/unit/other/pgraph.rb +210 -0
  224. data/spec/unit/other/transaction.rb +33 -0
  225. data/spec/unit/other/transbucket.rb +172 -0
  226. data/spec/unit/other/transobject.rb +92 -0
  227. data/spec/unit/parameter.rb +24 -0
  228. data/spec/unit/parser/ast.rb +37 -0
  229. data/spec/unit/parser/ast/arithmetic_operator.rb +73 -0
  230. data/spec/unit/parser/ast/astarray.rb +66 -0
  231. data/spec/unit/parser/ast/boolean_operator.rb +53 -0
  232. data/spec/unit/parser/ast/collexpr.rb +92 -0
  233. data/spec/unit/parser/ast/comparison_operator.rb +92 -0
  234. data/spec/unit/parser/ast/definition.rb +195 -0
  235. data/spec/unit/parser/ast/function.rb +77 -0
  236. data/spec/unit/parser/ast/hostclass.rb +148 -0
  237. data/spec/unit/parser/ast/minus.rb +36 -0
  238. data/spec/unit/parser/ast/node.rb +125 -0
  239. data/spec/unit/parser/ast/nop.rb +20 -0
  240. data/spec/unit/parser/ast/not.rb +30 -0
  241. data/spec/unit/parser/ast/resource_override.rb +51 -0
  242. data/spec/unit/parser/ast/resource_reference.rb +63 -0
  243. data/spec/unit/parser/ast/vardef.rb +47 -0
  244. data/spec/unit/parser/collector.rb +426 -0
  245. data/spec/unit/parser/compiler.rb +561 -0
  246. data/spec/unit/parser/functions.rb +83 -0
  247. data/spec/unit/parser/functions/inline_template.rb +59 -0
  248. data/spec/unit/parser/functions/template.rb +62 -0
  249. data/spec/unit/parser/interpreter.rb +138 -0
  250. data/spec/unit/parser/lexer.rb +646 -0
  251. data/spec/unit/parser/parser.rb +228 -0
  252. data/spec/unit/parser/resource.rb +336 -0
  253. data/spec/unit/parser/resource/reference.rb +95 -0
  254. data/spec/unit/parser/scope.rb +87 -0
  255. data/spec/unit/parser/templatewrapper.rb +129 -0
  256. data/spec/unit/property.rb +35 -0
  257. data/spec/unit/property/keyvalue.rb +168 -0
  258. data/spec/unit/property/list.rb +156 -0
  259. data/spec/unit/property/ordered_list.rb +64 -0
  260. data/spec/unit/provider/augeas/augeas.rb +238 -0
  261. data/spec/unit/provider/confine.rb +78 -0
  262. data/spec/unit/provider/confine/exists.rb +81 -0
  263. data/spec/unit/provider/confine/false.rb +53 -0
  264. data/spec/unit/provider/confine/feature.rb +60 -0
  265. data/spec/unit/provider/confine/true.rb +53 -0
  266. data/spec/unit/provider/confine/variable.rb +107 -0
  267. data/spec/unit/provider/confine_collection.rb +134 -0
  268. data/spec/unit/provider/confiner.rb +63 -0
  269. data/spec/unit/provider/group/groupadd.rb +31 -0
  270. data/spec/unit/provider/group/ldap.rb +105 -0
  271. data/spec/unit/provider/ldap.rb +248 -0
  272. data/spec/unit/provider/macauthorization.rb +147 -0
  273. data/spec/unit/provider/mcx/mcxcontent.rb +175 -0
  274. data/spec/unit/provider/mount.rb +130 -0
  275. data/spec/unit/provider/mount/parsed.rb +185 -0
  276. data/spec/unit/provider/package/apt.rb +138 -0
  277. data/spec/unit/provider/package/dpkg.rb +163 -0
  278. data/spec/unit/provider/package/gem.rb +87 -0
  279. data/spec/unit/provider/package/hpux.rb +52 -0
  280. data/spec/unit/provider/selboolean.rb +37 -0
  281. data/spec/unit/provider/selmodule-example.pp +0 -0
  282. data/spec/unit/provider/selmodule.rb +66 -0
  283. data/spec/unit/provider/service/daemontools.rb +124 -0
  284. data/spec/unit/provider/service/launchd.rb +134 -0
  285. data/spec/unit/provider/service/runit.rb +117 -0
  286. data/spec/unit/provider/ssh_authorized_key/parsed.rb +102 -0
  287. data/spec/unit/provider/user/hpux.rb +25 -0
  288. data/spec/unit/provider/user/ldap.rb +279 -0
  289. data/spec/unit/provider/user/user_role_add.rb +249 -0
  290. data/spec/unit/provider/user/useradd.rb +115 -0
  291. data/spec/unit/provider/zfs/solaris.rb +87 -0
  292. data/spec/unit/provider/zone/solaris.rb +42 -0
  293. data/spec/unit/provider/zpool/solaris.rb +179 -0
  294. data/spec/unit/rails.rb +125 -0
  295. data/spec/unit/relationship.rb +149 -0
  296. data/spec/unit/reports.rb +61 -0
  297. data/spec/unit/resource_reference.rb +73 -0
  298. data/spec/unit/simple_graph.rb +280 -0
  299. data/spec/unit/transaction/change.rb +187 -0
  300. data/spec/unit/transaction/event.rb +25 -0
  301. data/spec/unit/transaction/report.rb +40 -0
  302. data/spec/unit/type.rb +64 -0
  303. data/spec/unit/type/augeas.rb +113 -0
  304. data/spec/unit/type/computer.rb +82 -0
  305. data/spec/unit/type/exec.rb +91 -0
  306. data/spec/unit/type/file.rb +155 -0
  307. data/spec/unit/type/file/ensure.rb +21 -0
  308. data/spec/unit/type/file/group.rb +118 -0
  309. data/spec/unit/type/file/owner.rb +132 -0
  310. data/spec/unit/type/file/selinux.rb +82 -0
  311. data/spec/unit/type/group.rb +40 -0
  312. data/spec/unit/type/macauthorization.rb +78 -0
  313. data/spec/unit/type/mcx.rb +108 -0
  314. data/spec/unit/type/mount.rb +219 -0
  315. data/spec/unit/type/nagios.rb +63 -0
  316. data/spec/unit/type/noop_metaparam.rb +38 -0
  317. data/spec/unit/type/package.rb +246 -0
  318. data/spec/unit/type/resources.rb +27 -0
  319. data/spec/unit/type/schedule.rb +339 -0
  320. data/spec/unit/type/selboolean.rb +47 -0
  321. data/spec/unit/type/selmodule.rb +18 -0
  322. data/spec/unit/type/service.rb +254 -0
  323. data/spec/unit/type/ssh_authorized_key.rb +106 -0
  324. data/spec/unit/type/tidy.rb +68 -0
  325. data/spec/unit/type/user.rb +260 -0
  326. data/spec/unit/type/zfs.rb +45 -0
  327. data/spec/unit/type/zone.rb +20 -0
  328. data/spec/unit/type/zpool.rb +110 -0
  329. data/spec/unit/util/checksums.rb +99 -0
  330. data/spec/unit/util/constant_inflector.rb +70 -0
  331. data/spec/unit/util/file_locking.rb +115 -0
  332. data/spec/unit/util/ldap/connection.rb +169 -0
  333. data/spec/unit/util/ldap/generator.rb +54 -0
  334. data/spec/unit/util/ldap/manager.rb +654 -0
  335. data/spec/unit/util/loadedfile.rb +65 -0
  336. data/spec/unit/util/log.rb +107 -0
  337. data/spec/unit/util/metric.rb +95 -0
  338. data/spec/unit/util/nagios_maker.rb +128 -0
  339. data/spec/unit/util/posix.rb +256 -0
  340. data/spec/unit/util/resource_template.rb +58 -0
  341. data/spec/unit/util/selinux.rb +219 -0
  342. data/spec/unit/util/settings.rb +847 -0
  343. data/spec/unit/util/storage.rb +248 -0
  344. data/spec/unit/util/tagging.rb +92 -0
  345. data/spec/unit/util/uri_helper.rb +41 -0
  346. data/spec/unit/util/user_attr.rb +47 -0
  347. data/spec/unit/util/warnings.rb +35 -0
  348. data/test/certmgr/support.rb +0 -6
  349. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -0
  350. data/test/data/snippets/multilinecomments.pp +6 -0
  351. data/test/data/snippets/multipleclass.pp +9 -0
  352. data/test/language/functions.rb +11 -1
  353. data/test/language/snippets.rb +16 -0
  354. data/test/lib/puppettest/runnable_test.rb +1 -1
  355. data/test/network/handler/fileserver.rb +5 -0
  356. data/test/other/report.rb +0 -4
  357. data/test/ral/type/resources.rb +2 -19
  358. data/test/util/settings.rb +4 -4
  359. data/test/util/storage.rb +0 -24
  360. data/test/util/utiltest.rb +0 -33
  361. metadata +319 -26
  362. data/conf/debian/README.source +0 -2
  363. data/conf/debian/TODO.Debian +0 -1
  364. data/conf/debian/changelog +0 -257
  365. data/conf/debian/compat +0 -1
  366. data/conf/debian/control +0 -45
  367. data/conf/debian/copyright +0 -17
  368. data/conf/debian/docs +0 -1
  369. data/conf/debian/fileserver.conf +0 -12
  370. data/conf/debian/puppet.NEWS +0 -63
  371. data/conf/debian/puppet.conf +0 -8
  372. data/conf/debian/puppet.dirs +0 -7
  373. data/conf/debian/puppet.files +0 -6
  374. data/conf/debian/puppet.init +0 -64
  375. data/conf/debian/puppet.logrotate +0 -11
  376. data/conf/debian/puppet.postinst +0 -9
  377. data/conf/debian/puppet.postrm +0 -21
  378. data/conf/debian/puppet.preinst +0 -25
  379. data/conf/debian/puppetmaster.files +0 -4
  380. data/conf/debian/puppetmaster.init +0 -58
  381. data/conf/debian/rules +0 -115
  382. data/conf/debian/watch +0 -2
  383. data/lib/puppet/type/nagios_hostgroupescalation.rb +0 -3
@@ -0,0 +1,219 @@
1
+ require 'rdoc/code_objects'
2
+
3
+ module RDoc
4
+
5
+ # This modules contains various class that are used to hold information
6
+ # about the various Puppet language structures we found while parsing.
7
+ #
8
+ # Those will be mapped to their html counterparts which are defined in
9
+ # PuppetGenerator.
10
+
11
+ # PuppetTopLevel is a top level (usually a .pp/.rb file)
12
+ class PuppetTopLevel < TopLevel
13
+ attr_accessor :module_name, :global
14
+
15
+ # will contain all plugins
16
+ @@all_plugins = {}
17
+
18
+ # contains all cutoms facts
19
+ @@all_facts = {}
20
+
21
+ def initialize(toplevel)
22
+ super(toplevel.file_relative_name)
23
+ end
24
+
25
+ def self.all_plugins
26
+ @@all_plugins.values
27
+ end
28
+
29
+ def self.all_facts
30
+ @@all_facts.values
31
+ end
32
+ end
33
+
34
+ # PuppetModule holds a Puppet Module
35
+ # This is mapped to an HTMLPuppetModule
36
+ # it leverage the RDoc (ruby) module infrastructure
37
+ class PuppetModule < NormalModule
38
+ attr_accessor :facts, :plugins
39
+
40
+ def initialize(name,superclass=nil)
41
+ @facts = []
42
+ @plugins = []
43
+ super(name,superclass)
44
+ end
45
+
46
+ def initialize_classes_and_modules
47
+ super
48
+ @nodes = {}
49
+ end
50
+
51
+ def add_plugin(plugin)
52
+ add_to(@plugins, plugin)
53
+ end
54
+
55
+ def add_fact(fact)
56
+ add_to(@facts, fact)
57
+ end
58
+
59
+ def add_node(name,superclass)
60
+ cls = @nodes[name]
61
+ unless cls
62
+ cls = PuppetNode.new(name, superclass)
63
+ @nodes[name] = cls if !@done_documenting
64
+ cls.parent = self
65
+ cls.section = @current_section
66
+ end
67
+ cls
68
+ end
69
+
70
+ def each_fact
71
+ @facts.each {|c| yield c}
72
+ end
73
+
74
+ def each_plugin
75
+ @plugins.each {|c| yield c}
76
+ end
77
+
78
+ def each_node
79
+ @nodes.each {|c| yield c}
80
+ end
81
+
82
+ def nodes
83
+ @nodes.values
84
+ end
85
+ end
86
+
87
+ # PuppetClass holds a puppet class
88
+ # It is mapped to a HTMLPuppetClass for display
89
+ # It leverages RDoc (ruby) Class
90
+ class PuppetClass < ClassModule
91
+ attr_accessor :resource_list
92
+
93
+ def initialize(name, superclass)
94
+ super(name,superclass)
95
+ @resource_list = []
96
+ end
97
+
98
+ def add_resource(resource)
99
+ add_to(@resource_list, resource)
100
+ end
101
+
102
+ def is_module?
103
+ false
104
+ end
105
+ end
106
+
107
+ # PuppetNode holds a puppet node
108
+ # It is mapped to a HTMLPuppetNode for display
109
+ # A node is just a variation of a class
110
+ class PuppetNode < PuppetClass
111
+ def initialize(name, superclass)
112
+ super(name,superclass)
113
+ end
114
+
115
+ def is_module?
116
+ false
117
+ end
118
+ end
119
+
120
+ # Plugin holds a native puppet plugin (function,type...)
121
+ # It is mapped to a HTMLPuppetPlugin for display
122
+ class Plugin < Context
123
+ attr_accessor :name, :type
124
+
125
+ def initialize(name, type)
126
+ super()
127
+ @name = name
128
+ @type = type
129
+ @comment = ""
130
+ end
131
+
132
+ def <=>(other)
133
+ @name <=> other.name
134
+ end
135
+
136
+ def full_name
137
+ @name
138
+ end
139
+
140
+ def http_url(prefix)
141
+ path = full_name.split("::")
142
+ File.join(prefix, *path) + ".html"
143
+ end
144
+
145
+ def is_fact?
146
+ false
147
+ end
148
+
149
+ def to_s
150
+ res = self.class.name + ": " + @name + " (" + @type + ")\n"
151
+ res << @comment.to_s
152
+ res
153
+ end
154
+ end
155
+
156
+ # Fact holds a custom fact
157
+ # It is mapped to a HTMLPuppetPlugin for display
158
+ class Fact < Context
159
+ attr_accessor :name, :confine
160
+
161
+ def initialize(name, confine)
162
+ super()
163
+ @name = name
164
+ @confine = confine
165
+ @comment = ""
166
+ end
167
+
168
+ def <=>(other)
169
+ @name <=> other.name
170
+ end
171
+
172
+ def is_fact?
173
+ true
174
+ end
175
+
176
+ def full_name
177
+ @name
178
+ end
179
+
180
+ def to_s
181
+ res = self.class.name + ": " + @name + "\n"
182
+ res << @comment.to_s
183
+ res
184
+ end
185
+ end
186
+
187
+ # PuppetResource holds a puppet resource
188
+ # It is mapped to a HTMLPuppetResource for display
189
+ # A resource is defined by its "normal" form Type[title]
190
+ class PuppetResource < CodeObject
191
+ attr_accessor :type, :title, :params
192
+
193
+ def initialize(type, title, comment, params)
194
+ super()
195
+ @type = type
196
+ @title = title
197
+ @comment = comment
198
+ @params = params
199
+ end
200
+
201
+ def <=>(other)
202
+ full_name <=> other.full_name
203
+ end
204
+
205
+ def full_name
206
+ @type + "[" + @title + "]"
207
+ end
208
+
209
+ def name
210
+ full_name
211
+ end
212
+
213
+ def to_s
214
+ res = @type + "[" + @title + "]\n"
215
+ res << @comment.to_s
216
+ res
217
+ end
218
+ end
219
+ end
@@ -0,0 +1,829 @@
1
+ require 'rdoc/generators/html_generator'
2
+ require 'puppet/util/rdoc/code_objects'
3
+ module Generators
4
+
5
+ # This module holds all the classes needed to generate the HTML documentation
6
+ # of a bunch of puppet manifests.
7
+ #
8
+ # It works by traversing all the code objects defined by the Puppet RDoc::Parser
9
+ # and produces HTML counterparts objects that in turns are used by RDoc template engine
10
+ # to produce the final HTML.
11
+ #
12
+ # It is also responsible of creating the whole directory hierarchy, and various index
13
+ # files.
14
+ #
15
+ # It is to be noted that the whole system is built on top of ruby RDoc. As such there
16
+ # is an implicit mapping of puppet entities to ruby entitites:
17
+ #
18
+ # Puppet => Ruby
19
+ # ------------------------
20
+ # Module Module
21
+ # Class Class
22
+ # Definition Method
23
+ # Resource
24
+ # Node
25
+ # Plugin
26
+ # Fact
27
+
28
+ MODULE_DIR = "modules"
29
+ NODE_DIR = "nodes"
30
+ PLUGIN_DIR = "plugins"
31
+
32
+ # This is a specialized HTMLGenerator tailored to Puppet manifests
33
+ class PuppetGenerator < HTMLGenerator
34
+
35
+ def PuppetGenerator.for(options)
36
+ AllReferences::reset
37
+ HtmlMethod::reset
38
+
39
+ if options.all_one_file
40
+ PuppetGeneratorInOne.new(options)
41
+ else
42
+ PuppetGenerator.new(options)
43
+ end
44
+ end
45
+
46
+ def initialize(options) #:not-new:
47
+ @options = options
48
+ load_html_template
49
+ end
50
+
51
+ # loads our own html template file
52
+ def load_html_template
53
+ begin
54
+ require 'puppet/util/rdoc/generators/template/puppet/puppet'
55
+ extend RDoc::Page
56
+ rescue LoadError
57
+ $stderr.puts "Could not find Puppet template '#{template}'"
58
+ exit 99
59
+ end
60
+ end
61
+
62
+ def gen_method_index
63
+ # we don't generate an all define index
64
+ # as the presentation is per module/per class
65
+ end
66
+
67
+ # This is the central method, it generates the whole structures
68
+ # along with all the indices.
69
+ def generate_html
70
+ super
71
+ gen_into(@nodes)
72
+ gen_into(@plugins)
73
+ end
74
+
75
+ ##
76
+ # Generate:
77
+ # the list of modules
78
+ # the list of classes and definitions of a specific module
79
+ # the list of all classes
80
+ # the list of nodes
81
+ # the list of resources
82
+ def build_indices
83
+ @allfiles = []
84
+ @nodes = []
85
+ @plugins = []
86
+
87
+ # contains all the seen modules
88
+ @modules = {}
89
+ @allclasses = {}
90
+
91
+ # build the modules, classes and per modules classes and define list
92
+ @toplevels.each do |toplevel|
93
+ next unless toplevel.document_self
94
+ file = HtmlFile.new(toplevel, @options, FILE_DIR)
95
+ classes = []
96
+ methods = []
97
+ modules = []
98
+ nodes = []
99
+
100
+ # find all classes of this toplevel
101
+ # store modules if we find one
102
+ toplevel.each_classmodule do |k|
103
+ generate_class_list(classes, modules, k, toplevel, CLASS_DIR)
104
+ end
105
+
106
+ # find all defines belonging to this toplevel
107
+ HtmlMethod.all_methods.each do |m|
108
+ # find parent module, check this method is not already
109
+ # defined.
110
+ if m.context.parent.toplevel === toplevel
111
+ methods << m
112
+ end
113
+ end
114
+
115
+ classes.each do |k|
116
+ @allclasses[k.index_name] = k if !@allclasses.has_key?(k.index_name)
117
+ end
118
+
119
+ # generate nodes and plugins found
120
+ classes.each do |k|
121
+ if k.context.is_module?
122
+ k.context.each_node do |name,node|
123
+ nodes << HTMLPuppetNode.new(node, toplevel, NODE_DIR, @options)
124
+ @nodes << nodes.last
125
+ end
126
+ k.context.each_plugin do |plugin|
127
+ @plugins << HTMLPuppetPlugin.new(plugin, toplevel, PLUGIN_DIR, @options)
128
+ end
129
+ k.context.each_fact do |fact|
130
+ @plugins << HTMLPuppetPlugin.new(fact, toplevel, PLUGIN_DIR, @options)
131
+ end
132
+ end
133
+ end
134
+
135
+ @files << file
136
+ @allfiles << { "file" => file, "modules" => modules, "classes" => classes, "methods" => methods, "nodes" => nodes }
137
+ end
138
+
139
+ @classes = @allclasses.values
140
+ end
141
+
142
+ # produce a class/module list of HTMLPuppetModule/HTMLPuppetClass
143
+ # based on the code object traversal.
144
+ def generate_class_list(classes, modules, from, html_file, class_dir)
145
+ if from.is_module? and !@modules.has_key?(from.name)
146
+ k = HTMLPuppetModule.new(from, html_file, class_dir, @options)
147
+ classes << k
148
+ @modules[from.name] = k
149
+ modules << @modules[from.name]
150
+ elsif from.is_module?
151
+ modules << @modules[from.name]
152
+ elsif !from.is_module?
153
+ k = HTMLPuppetClass.new(from, html_file, class_dir, @options)
154
+ classes << k
155
+ end
156
+ from.each_classmodule do |mod|
157
+ generate_class_list(classes, modules, mod, html_file, class_dir)
158
+ end
159
+ end
160
+
161
+ # generate all the subdirectories, modules, classes and files
162
+ def gen_sub_directories
163
+ begin
164
+ super
165
+ File.makedirs(MODULE_DIR)
166
+ File.makedirs(NODE_DIR)
167
+ File.makedirs(PLUGIN_DIR)
168
+ rescue
169
+ $stderr.puts $!.message
170
+ exit 1
171
+ end
172
+ end
173
+
174
+ # generate the index of modules
175
+ def gen_file_index
176
+ gen_top_index(@modules.values, 'All Modules', RDoc::Page::TOP_INDEX, "fr_modules_index.html")
177
+ end
178
+
179
+ # generate a top index
180
+ def gen_top_index(collection, title, template, filename)
181
+ template = TemplatePage.new(RDoc::Page::FR_INDEX_BODY, template)
182
+ res = []
183
+ collection.sort.each do |f|
184
+ if f.document_self
185
+ 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) }
186
+ end
187
+ end
188
+
189
+ values = {
190
+ "entries" => res,
191
+ 'list_title' => CGI.escapeHTML(title),
192
+ 'index_url' => main_url,
193
+ 'charset' => @options.charset,
194
+ 'style_url' => style_url('', @options.css),
195
+ }
196
+
197
+ File.open(filename, "w") do |f|
198
+ template.write_html_on(f, values)
199
+ end
200
+ end
201
+
202
+ # generate the all classes index file and the combo index
203
+ def gen_class_index
204
+ gen_an_index(@classes, 'All Classes', RDoc::Page::CLASS_INDEX, "fr_class_index.html")
205
+ @allfiles.each do |file|
206
+ unless file['file'].context.file_relative_name =~ /\.rb$/
207
+ gen_composite_index(file,
208
+ RDoc::Page::COMBO_INDEX,
209
+ "#{MODULE_DIR}/fr_#{file["file"].context.module_name}.html")
210
+ end
211
+ end
212
+ end
213
+
214
+ def gen_composite_index(collection, template, filename)\
215
+ return if FileTest.exists?(filename)
216
+
217
+ template = TemplatePage.new(RDoc::Page::FR_INDEX_BODY, template)
218
+ res1 = []
219
+ collection['classes'].sort.each do |f|
220
+ if f.document_self
221
+ unless f.context.is_module?
222
+ res1 << { "href" => "../"+CGI.escapeHTML(f.path), "name" => CGI.escapeHTML(f.index_name) }
223
+ end
224
+ end
225
+ end
226
+
227
+ res2 = []
228
+ collection['methods'].sort.each do |f|
229
+ if f.document_self
230
+ res2 << { "href" => "../"+f.path, "name" => f.index_name.sub(/\(.*\)$/,'') }
231
+ end
232
+ end
233
+
234
+ module_name = []
235
+ res3 = []
236
+ res4 = []
237
+ collection['modules'].sort.each do |f|
238
+ module_name << { "href" => "../"+CGI.escapeHTML(f.path), "name" => CGI.escapeHTML(f.index_name) }
239
+ unless f.facts.nil?
240
+ f.facts.each do |fact|
241
+ res3 << {"href" => "../"+CGI.escapeHTML(AllReferences["PLUGIN(#{fact.name})"].path), "name" => CGI.escapeHTML(fact.name)}
242
+ end
243
+ end
244
+ unless f.plugins.nil?
245
+ f.plugins.each do |plugin|
246
+ res4 << {"href" => "../"+CGI.escapeHTML(AllReferences["PLUGIN(#{plugin.name})"].path), "name" => CGI.escapeHTML(plugin.name)}
247
+ end
248
+ end
249
+ end
250
+
251
+ res5 = []
252
+ collection['nodes'].sort.each do |f|
253
+ if f.document_self
254
+ res5 << { "href" => "../"+CGI.escapeHTML(f.path), "name" => CGI.escapeHTML(f.name) }
255
+ end
256
+ end
257
+
258
+ values = {
259
+ "module" => module_name,
260
+ "classes" => res1,
261
+ 'classes_title' => CGI.escapeHTML("Classes"),
262
+ 'defines_title' => CGI.escapeHTML("Defines"),
263
+ 'facts_title' => CGI.escapeHTML("Custom Facts"),
264
+ 'plugins_title' => CGI.escapeHTML("Plugins"),
265
+ 'nodes_title' => CGI.escapeHTML("Nodes"),
266
+ 'index_url' => main_url,
267
+ 'charset' => @options.charset,
268
+ 'style_url' => style_url('', @options.css),
269
+ }
270
+
271
+ values["defines"] = res2 if res2.size>0
272
+ values["facts"] = res3 if res3.size>0
273
+ values["plugins"] = res4 if res4.size>0
274
+ values["nodes"] = res5 if res5.size>0
275
+
276
+ File.open(filename, "w") do |f|
277
+ template.write_html_on(f, values)
278
+ end
279
+ end
280
+
281
+ # returns the initial_page url
282
+ def main_url
283
+ main_page = @options.main_page
284
+ ref = nil
285
+ if main_page
286
+ ref = AllReferences[main_page]
287
+ if ref
288
+ ref = ref.path
289
+ else
290
+ $stderr.puts "Could not find main page #{main_page}"
291
+ end
292
+ end
293
+
294
+ unless ref
295
+ for file in @files
296
+ if file.document_self and file.context.global
297
+ ref = CGI.escapeHTML("#{CLASS_DIR}/#{file.context.module_name}.html")
298
+ break
299
+ end
300
+ end
301
+ end
302
+
303
+ unless ref
304
+ for file in @files
305
+ if file.document_self and !file.context.global
306
+ ref = CGI.escapeHTML("#{CLASS_DIR}/#{file.context.module_name}.html")
307
+ break
308
+ end
309
+ end
310
+ end
311
+
312
+ unless ref
313
+ $stderr.puts "Couldn't find anything to document"
314
+ $stderr.puts "Perhaps you've used :stopdoc: in all classes"
315
+ exit(1)
316
+ end
317
+
318
+ ref
319
+ end
320
+
321
+ end
322
+
323
+ # This module is used to hold/generate a list of puppet resources
324
+ # this is used in HTMLPuppetClass and HTMLPuppetNode
325
+ module ResourceContainer
326
+ def collect_resources
327
+ list = @context.resource_list
328
+ @resources = list.collect {|m| HTMLPuppetResource.new(m, self, @options) }
329
+ end
330
+
331
+ def build_resource_summary_list(path_prefix='')
332
+ collect_resources unless @resources
333
+ resources = @resources.sort
334
+ res = []
335
+ resources.each do |r|
336
+ res << {
337
+ "name" => CGI.escapeHTML(r.name),
338
+ "aref" => "#{path_prefix}\##{r.aref}"
339
+ }
340
+ end
341
+ res
342
+ end
343
+
344
+ def build_resource_detail_list(section)
345
+ outer = []
346
+ resources = @resources.sort
347
+ resources.each do |r|
348
+ row = {}
349
+ if r.section == section and r.document_self
350
+ row["name"] = CGI.escapeHTML(r.name)
351
+ desc = r.description.strip
352
+ row["m_desc"] = desc unless desc.empty?
353
+ row["aref"] = r.aref
354
+ row["params"] = r.params
355
+ outer << row
356
+ end
357
+ end
358
+ outer
359
+ end
360
+ end
361
+
362
+ class HTMLPuppetClass < HtmlClass
363
+ include ResourceContainer
364
+
365
+ def value_hash
366
+ super
367
+ rl = build_resource_summary_list
368
+ @values["resources"] = rl unless rl.empty?
369
+
370
+ @context.sections.each do |section|
371
+ secdata = @values["sections"].select { |secdata| secdata["secsequence"] == section.sequence }
372
+ if secdata.size == 1
373
+ secdata = secdata[0]
374
+
375
+ rdl = build_resource_detail_list(section)
376
+ secdata["resource_list"] = rdl unless rdl.empty?
377
+ end
378
+ end
379
+ @values
380
+ end
381
+ end
382
+
383
+ class HTMLPuppetNode < ContextUser
384
+ include ResourceContainer
385
+
386
+ attr_reader :path
387
+
388
+ def initialize(context, html_file, prefix, options)
389
+ super(context, options)
390
+
391
+ @html_file = html_file
392
+ @is_module = context.is_module?
393
+ @values = {}
394
+
395
+ context.viewer = self
396
+
397
+ if options.all_one_file
398
+ @path = context.full_name
399
+ else
400
+ @path = http_url(context.full_name, prefix)
401
+ end
402
+
403
+ AllReferences.add("NODE(#{@context.full_name})", self)
404
+ end
405
+
406
+ def name
407
+ @context.name
408
+ end
409
+
410
+ # return the relative file name to store this class in,
411
+ # which is also its url
412
+ def http_url(full_name, prefix)
413
+ path = full_name.dup
414
+ if path['<<']
415
+ path.gsub!(/<<\s*(\w*)/) { "from-#$1" }
416
+ end
417
+ File.join(prefix, path.split("::")) + ".html"
418
+ end
419
+
420
+ def parent_name
421
+ @context.parent.full_name
422
+ end
423
+
424
+ def index_name
425
+ name
426
+ end
427
+
428
+ def write_on(f)
429
+ value_hash
430
+ template = TemplatePage.new(RDoc::Page::BODYINC,
431
+ RDoc::Page::NODE_PAGE,
432
+ RDoc::Page::METHOD_LIST)
433
+ template.write_html_on(f, @values)
434
+ end
435
+
436
+ def value_hash
437
+ class_attribute_values
438
+ add_table_of_sections
439
+
440
+ @values["charset"] = @options.charset
441
+ @values["style_url"] = style_url(path, @options.css)
442
+
443
+ d = markup(@context.comment)
444
+ @values["description"] = d unless d.empty?
445
+
446
+ ml = build_method_summary_list
447
+ @values["methods"] = ml unless ml.empty?
448
+
449
+ rl = build_resource_summary_list
450
+ @values["resources"] = rl unless rl.empty?
451
+
452
+ il = build_include_list(@context)
453
+ @values["includes"] = il unless il.empty?
454
+
455
+ @values["sections"] = @context.sections.map do |section|
456
+
457
+ secdata = {
458
+ "sectitle" => section.title,
459
+ "secsequence" => section.sequence,
460
+ "seccomment" => markup(section.comment)
461
+ }
462
+
463
+ al = build_alias_summary_list(section)
464
+ secdata["aliases"] = al unless al.empty?
465
+
466
+ co = build_constants_summary_list(section)
467
+ secdata["constants"] = co unless co.empty?
468
+
469
+ al = build_attribute_list(section)
470
+ secdata["attributes"] = al unless al.empty?
471
+
472
+ cl = build_class_list(0, @context, section)
473
+ secdata["classlist"] = cl unless cl.empty?
474
+
475
+ mdl = build_method_detail_list(section)
476
+ secdata["method_list"] = mdl unless mdl.empty?
477
+
478
+ rdl = build_resource_detail_list(section)
479
+ secdata["resource_list"] = rdl unless rdl.empty?
480
+
481
+ secdata
482
+ end
483
+
484
+ @values
485
+ end
486
+
487
+ def build_attribute_list(section)
488
+ atts = @context.attributes.sort
489
+ res = []
490
+ atts.each do |att|
491
+ next unless att.section == section
492
+ if att.visibility == :public || att.visibility == :protected || @options.show_all
493
+ entry = {
494
+ "name" => CGI.escapeHTML(att.name),
495
+ "rw" => att.rw,
496
+ "a_desc" => markup(att.comment, true)
497
+ }
498
+ unless att.visibility == :public || att.visibility == :protected
499
+ entry["rw"] << "-"
500
+ end
501
+ res << entry
502
+ end
503
+ end
504
+ res
505
+ end
506
+
507
+ def class_attribute_values
508
+ h_name = CGI.escapeHTML(name)
509
+
510
+ @values["classmod"] = "Node"
511
+ @values["title"] = "#{@values['classmod']}: #{h_name}"
512
+
513
+ c = @context
514
+ c = c.parent while c and !c.diagram
515
+
516
+ if c && c.diagram
517
+ @values["diagram"] = diagram_reference(c.diagram)
518
+ end
519
+
520
+ @values["full_name"] = h_name
521
+
522
+ parent_class = @context.superclass
523
+
524
+ if parent_class
525
+ @values["parent"] = CGI.escapeHTML(parent_class)
526
+
527
+ if parent_name
528
+ lookup = parent_name + "::" + parent_class
529
+ else
530
+ lookup = parent_class
531
+ end
532
+ lookup = "NODE(#{lookup})"
533
+ parent_url = AllReferences[lookup] || AllReferences[parent_class]
534
+ if parent_url and parent_url.document_self
535
+ @values["par_url"] = aref_to(parent_url.path)
536
+ end
537
+ end
538
+
539
+ files = []
540
+ @context.in_files.each do |f|
541
+ res = {}
542
+ full_path = CGI.escapeHTML(f.file_absolute_name)
543
+
544
+ res["full_path"] = full_path
545
+ res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
546
+
547
+ if @options.webcvs
548
+ res["cvsurl"] = cvs_url( @options.webcvs, full_path )
549
+ end
550
+
551
+ files << res
552
+ end
553
+
554
+ @values['infiles'] = files
555
+ end
556
+
557
+ def <=>(other)
558
+ self.name <=> other.name
559
+ end
560
+ end
561
+
562
+ class HTMLPuppetModule < HtmlClass
563
+
564
+ def initialize(context, html_file, prefix, options)
565
+ super(context, html_file, prefix, options)
566
+ end
567
+
568
+ def value_hash
569
+ @values = super
570
+
571
+ fl = build_facts_summary_list
572
+ @values["facts"] = fl unless fl.empty?
573
+
574
+ pl = build_plugins_summary_list
575
+ @values["plugins"] = pl unless pl.empty?
576
+
577
+ nl = build_nodes_list(0, @context)
578
+ @values["nodelist"] = nl unless nl.empty?
579
+
580
+ @values
581
+ end
582
+
583
+ def build_nodes_list(level, context)
584
+ res = ""
585
+ prefix = "&nbsp;&nbsp;::" * level;
586
+
587
+ context.nodes.sort.each do |node|
588
+ if node.document_self
589
+ res <<
590
+ prefix <<
591
+ "Node " <<
592
+ href(url(node.viewer.path), "link", node.full_name) <<
593
+ "<br />\n"
594
+ end
595
+ end
596
+ res
597
+ end
598
+
599
+ def build_facts_summary_list
600
+ potentially_referenced_list(context.facts) {|fn| ["PLUGIN(#{fn})"] }
601
+ end
602
+
603
+ def build_plugins_summary_list
604
+ potentially_referenced_list(context.plugins) {|fn| ["PLUGIN(#{fn})"] }
605
+ end
606
+
607
+ def facts
608
+ @context.facts
609
+ end
610
+
611
+ def plugins
612
+ @context.plugins
613
+ end
614
+
615
+ end
616
+
617
+ class HTMLPuppetPlugin < ContextUser
618
+ attr_reader :path
619
+
620
+ def initialize(context, html_file, prefix, options)
621
+ super(context, options)
622
+
623
+ @html_file = html_file
624
+ @is_module = false
625
+ @values = {}
626
+
627
+ context.viewer = self
628
+
629
+ if options.all_one_file
630
+ @path = context.full_name
631
+ else
632
+ @path = http_url(context.full_name, prefix)
633
+ end
634
+
635
+ AllReferences.add("PLUGIN(#{@context.full_name})", self)
636
+ end
637
+
638
+ def name
639
+ @context.name
640
+ end
641
+
642
+ # return the relative file name to store this class in,
643
+ # which is also its url
644
+ def http_url(full_name, prefix)
645
+ path = full_name.dup
646
+ if path['<<']
647
+ path.gsub!(/<<\s*(\w*)/) { "from-#$1" }
648
+ end
649
+ File.join(prefix, path.split("::")) + ".html"
650
+ end
651
+
652
+ def parent_name
653
+ @context.parent.full_name
654
+ end
655
+
656
+ def index_name
657
+ name
658
+ end
659
+
660
+ def write_on(f)
661
+ value_hash
662
+ template = TemplatePage.new(RDoc::Page::BODYINC,
663
+ RDoc::Page::PLUGIN_PAGE,
664
+ RDoc::Page::PLUGIN_LIST)
665
+ template.write_html_on(f, @values)
666
+ end
667
+
668
+ def value_hash
669
+ attribute_values
670
+ add_table_of_sections
671
+
672
+ @values["charset"] = @options.charset
673
+ @values["style_url"] = style_url(path, @options.css)
674
+
675
+ d = markup(@context.comment)
676
+ @values["description"] = d unless d.empty?
677
+
678
+ if context.is_fact?
679
+ unless context.confine.empty?
680
+ res = {}
681
+ res["type"] = context.confine[:type]
682
+ res["value"] = context.confine[:value]
683
+ @values["confine"] = [res]
684
+ end
685
+ else
686
+ @values["type"] = context.type
687
+ end
688
+
689
+ @values["sections"] = @context.sections.map do |section|
690
+ secdata = {
691
+ "sectitle" => section.title,
692
+ "secsequence" => section.sequence,
693
+ "seccomment" => markup(section.comment)
694
+ }
695
+ secdata
696
+ end
697
+
698
+ @values
699
+ end
700
+
701
+ def attribute_values
702
+ h_name = CGI.escapeHTML(name)
703
+
704
+ if @context.is_fact?
705
+ @values["classmod"] = "Fact"
706
+ else
707
+ @values["classmod"] = "Plugin"
708
+ end
709
+ @values["title"] = "#{@values['classmod']}: #{h_name}"
710
+
711
+ c = @context
712
+ @values["full_name"] = h_name
713
+
714
+ files = []
715
+ @context.in_files.each do |f|
716
+ res = {}
717
+ full_path = CGI.escapeHTML(f.file_absolute_name)
718
+
719
+ res["full_path"] = full_path
720
+ res["full_path_url"] = aref_to(f.viewer.path) if f.document_self
721
+
722
+ if @options.webcvs
723
+ res["cvsurl"] = cvs_url( @options.webcvs, full_path )
724
+ end
725
+
726
+ files << res
727
+ end
728
+
729
+ @values['infiles'] = files
730
+ end
731
+
732
+ def <=>(other)
733
+ self.name <=> other.name
734
+ end
735
+
736
+ end
737
+
738
+ class HTMLPuppetResource
739
+ include MarkUp
740
+
741
+ attr_reader :context
742
+
743
+ @@seq = "R000000"
744
+
745
+ def initialize(context, html_class, options)
746
+ @context = context
747
+ @html_class = html_class
748
+ @options = options
749
+ @@seq = @@seq.succ
750
+ @seq = @@seq
751
+
752
+ context.viewer = self
753
+
754
+ AllReferences.add(name, self)
755
+ end
756
+
757
+ def as_href(from_path)
758
+ if @options.all_one_file
759
+ "#" + path
760
+ else
761
+ HTMLGenerator.gen_url(from_path, path)
762
+ end
763
+ end
764
+
765
+ def name
766
+ @context.name
767
+ end
768
+
769
+ def section
770
+ @context.section
771
+ end
772
+
773
+ def index_name
774
+ "#{@context.name}"
775
+ end
776
+
777
+ def params
778
+ @context.params
779
+ end
780
+
781
+ def parent_name
782
+ if @context.parent.parent
783
+ @context.parent.parent.full_name
784
+ else
785
+ nil
786
+ end
787
+ end
788
+
789
+ def aref
790
+ @seq
791
+ end
792
+
793
+ def path
794
+ if @options.all_one_file
795
+ aref
796
+ else
797
+ @html_class.path + "#" + aref
798
+ end
799
+ end
800
+
801
+ def description
802
+ markup(@context.comment)
803
+ end
804
+
805
+ def <=>(other)
806
+ @context <=> other.context
807
+ end
808
+
809
+ def document_self
810
+ @context.document_self
811
+ end
812
+
813
+ def find_symbol(symbol, method=nil)
814
+ res = @context.parent.find_symbol(symbol, method)
815
+ if res
816
+ res = res.viewer
817
+ end
818
+ res
819
+ end
820
+
821
+ end
822
+
823
+ class PuppetGeneratorInOne < HTMLGeneratorInOne
824
+ def gen_method_index
825
+ gen_an_index(HtmlMethod.all_methods, 'Defines')
826
+ end
827
+ end
828
+
829
+ end