You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(PUP-12058) Add task to generate man (as markdown) reference
bundle exec rake references:man
This task generates an overview page that lists all of the puppet commands.
Next, we run the gen_manpages rake task that generates roff formatted man pages
in the man directory. Then we convert roff to markdown using pandoc. We
unfortunately can't generate markdown directly as legacy apps are hardcoded to
generate ronn, such as when running `puppet agent --help`.
The task requires the pandoc-ruby gem, so add it to the documentation bundler
group. Since the group is optional, check to see if the gem is present before
loading it, similar to how we handle ronn.
The task also requires the pandoc executable.
abort("Run `bundle config set with documentation` and `bundle update` to install the `pandoc-ruby` gem.")
117
+
end
118
+
119
+
begin
120
+
puts%x{pandoc --version}
121
+
rescueErrno::ENOENT=>e
122
+
abort("Please install the `pandoc` package.")
123
+
end
124
+
125
+
sha=%x{git rev-parse HEAD}.chomp
126
+
now=Time.now
127
+
128
+
# This is based on https://github.com/puppetlabs/puppet-docs/blob/1a13be3fc6981baa8a96ff832ab090abc986830e/lib/puppet_references/puppet/man.rb#L24-L108
129
+
core_apps=%w(
130
+
agent
131
+
apply
132
+
lookup
133
+
module
134
+
resource
135
+
)
136
+
occasional_apps=%w(
137
+
config
138
+
describe
139
+
device
140
+
doc
141
+
epp
142
+
generate
143
+
help
144
+
node
145
+
parser
146
+
plugin
147
+
script
148
+
ssl
149
+
)
150
+
weird_apps=%w(
151
+
catalog
152
+
facts
153
+
filebucket
154
+
report
155
+
)
156
+
157
+
variables={
158
+
sha: sha,
159
+
now: now,
160
+
title: 'Puppet Man Pages',
161
+
core_apps: core_apps,
162
+
occasional_apps: occasional_apps,
163
+
weird_apps: weird_apps
164
+
}
165
+
166
+
content=render_erb(MAN_OVERVIEW_ERB,variables)
167
+
File.write(MAN_OVERVIEW_MD,content)
168
+
puts"Generated #{MAN_OVERVIEW_MD}"
169
+
170
+
# Generate manpages in roff
171
+
Rake::Task[:gen_manpages].invoke
172
+
173
+
# Convert the roff formatted man pages to markdown, based on
> **NOTE:** This page was generated from the Puppet source code on <%=now%>
11
+
12
+
13
+
14
+
Puppet's command line tools consist of a single `puppet` binary with many subcommands. The following subcommands are available in this version of Puppet:
15
+
16
+
Core Tools
17
+
-----
18
+
19
+
These subcommands form the core of Puppet's tool set, and every user should understand what they do.
20
+
21
+
<%core_apps.eachdo |app| -%>
22
+
- [puppet <%=app%>](<%=app%>.md)
23
+
<%end-%>
24
+
25
+
26
+
> Note: The `puppet cert` command is available only in Puppet versions prior to 6.0. For 6.0 and later, use the [`puppetserver cert`command](https://puppet.com/docs/puppet/6/puppet_server_ca_cli.html).
27
+
28
+
Secondary subcommands
29
+
-----
30
+
31
+
Many or most users need to use these subcommands at some point, but they aren't needed for daily use the way the core tools are.
32
+
33
+
<%occasional_apps.eachdo |app| -%>
34
+
- [puppet <%=app%>](<%=app%>.md)
35
+
<%end-%>
36
+
37
+
38
+
Niche subcommands
39
+
-----
40
+
41
+
Most users can ignore these subcommands. They're only useful for certain niche workflows, and most of them are interfaces to Puppet's internal subsystems.
0 commit comments