There are two generated refefences:
- from openfact
- from opnvox-agent
From OpenFact we collect:
- CLI
- Core Facts
From OpenVox agent we fetch
- bundled types and providers
- bundled functions
CLI is rendered from man pages to markdown. Content is in the openvox repositoriy.
Additional content is added via a preamble: lib/puppet_references/facter/facter_cli_preamble.md
Core Facts are rendered using a script, which is part of the openfact repo (lib/docs/generate.rb)
Additional contnet is added via a preamble file: lib/puppet_references/facter/core_facts_preamble.md
OpenVox autogenerated documentation is rendered differently.
Rendering takes place in lib/puppet_references/puppet/man.rb Line 78 ff
Completely rendered using puppet doc command from openvox repo documentation
Type uses a preamble and a template: lib/puppet_references/puppet/type_preamble.md and lib/puppet_references/puppet/type_template.erb
TypeStrings is inhertited from Type.
Content is rendered by running puppet strings generate.
Additional content is added in lib/puppet_references/puppet/type_strings.rb
Functions use a preamble and a template: lib/puppet_references/puppet/functions_preamble.md and lib/puppet_references/puppet/functions_template.erb
- Rakefile
PuppetReferences.build_facter_references(ENV.fetch('VERSION', nil))
Building references
references = [
PuppetReferences::Facter::CoreFacts,
PuppetReferences::Facter::FacterCli
]Repo action
repo = PuppetReferences::Repo.new('openfact', FACTER_DIR)
real_commit = repo.checkout(commit)
repo.update_bundle- clone openfact repo into a local dir
- switches to provided version
- update all tags (fetch)
- runs bundle install
build_from_list_of_classes(references, real_commit)- executes ruby /lib/docs/generate.rb
- adds header data + preamble + data
- writes core_facts.md file
- runs bundle update in openfact
- runs bundle exec facter man
- uses PandDoc Ruby to convert man to markdown
- writs cli.md
PuppetReferences.build_puppet_references(ENV.fetch('VERSION', nil))
references = [
PuppetReferences::Puppet::Man,
PuppetReferences::Puppet::PuppetDoc,
PuppetReferences::Puppet::Type,
PuppetReferences::Puppet::TypeStrings,
PuppetReferences::Puppet::Functions,
]- Reads config - can be removed
- Clones repo
- switch to version
- run bundle install
- build_from_list_of_classes (build_all)
-
reads all files in openvox-agent/lib/puppet/application/*.rb
-
deletes face_base, indirection_base, cert applications 1.build index for all applications
-
has data with categories: core, occasional and weird
-
select from applications where data match
-
2 variables: header data and index_text
-
within index_text, add the markdown files mentioned in data, first core, then occasional, then weird)
-
write content to overview.md file
-
for each command run build_manpage
-
define a header
-
read command from openvox-agent/man/man/command.8
-
calls PandDoc.ruby to convert from man to markdown, adding gsub methods on converted content
-
write command file
- calls build_reference
- calls
puppet doccommand - calls clean_configuration_reference
- replaces fqdn with fixed string
- sets header data
- writes each reference.md file
typedoc script: /lib/puppet_references/quarantine/get_typedocs.rb typedoc template: /lib/puppet_references/puppet/type_template.erb typedoc preamble: lib/puppet_references/puppet/type_preamble.md
build_all:
get_type_json: execute typedoc script save json file
build_index (type_data.keys.sort):
- header_data (title & canonical)
- skip component and wiki
- read all md files from type_data
- add header (autogenerated) see lib/puppet_references/util.rb
- write file (puppet/types/overview.md)
build_unified_page:
set header (title, canonical, toc_levels, toc) sort attributes (namenvar first, ensure second) write type individual files
build page:
set header (title, canonical) sort attributes write type file
output dir: puppet/types_strings
same as type, but different get_type_json
PuppetReferences::Puppet::Strings.new read all filenames in lib/puppet/**/*.rb run bundle exec puppet strings generate --format json --out string.json filenames.join(' ') read strings.json file
iterate over content['resource_type'] build new structure and content lib/puppet_references/puppet/type_strings.rb THIS IS THE IMPORTANT file This has the knowledge on the output and renders the new md
template: functions_template.erb preamble: functions_preamble.md
uses PuppetReferences::Puppet::Strings.new sets header render template, add header write file