@@ -151,6 +151,33 @@ def legacy_applications
151151 end . sort
152152 end
153153
154+ def generate_summary ( appname )
155+ if is_face_app? ( appname )
156+ begin
157+ face = Puppet ::Face [ appname , :current ]
158+ # Add deprecation message to summary if the face is deprecated
159+ summary = face . deprecated? ? face . summary + ' ' + _ ( "(Deprecated)" ) : face . summary
160+ [ appname , summary , ' ' ]
161+ rescue StandardError , LoadError
162+ error_message = _ ( "!%{sub_command}! Subcommand unavailable due to error." ) % { sub_command : appname }
163+ error_message += ' ' + _ ( "Check error logs." )
164+ [ error_message , '' , ' ' ]
165+ end
166+ else
167+ begin
168+ summary = Puppet ::Application [ appname ] . summary
169+ if summary . empty?
170+ summary = horribly_extract_summary_from ( appname )
171+ end
172+ [ appname , summary , ' ' ]
173+ rescue StandardError , LoadError
174+ error_message = _ ( "!%{sub_command}! Subcommand unavailable due to error." ) % { sub_command : appname }
175+ error_message += ' ' + _ ( "Check error logs." )
176+ [ error_message , '' , ' ' ]
177+ end
178+ end
179+ end
180+
154181 # Return a list of all applications (both legacy and Face applications), along with a summary
155182 # of their functionality.
156183 # @return [Array] An Array of Arrays. The outer array contains one entry per application; each
@@ -162,45 +189,38 @@ def all_application_summaries
162189
163190 if appname == COMMON || appname == SPECIALIZED || appname == BLANK
164191 result << appname
165- elsif is_face_app? ( appname )
166- begin
167- face = Puppet ::Face [ appname , :current ]
168- # Add deprecation message to summary if the face is deprecated
169- summary = face . deprecated? ? face . summary + ' ' + _ ( "(Deprecated)" ) : face . summary
170- result << [ appname , summary , ' ' ]
171- rescue StandardError , LoadError
172- error_message = _ ( "!%{sub_command}! Subcommand unavailable due to error." ) % { sub_command : appname }
173- error_message += ' ' + _ ( "Check error logs." )
174- result << [ error_message , '' , ' ' ]
175- end
176192 else
177- begin
178- summary = Puppet ::Application [ appname ] . summary
179- if summary . empty?
180- summary = horribly_extract_summary_from ( appname )
181- end
182- result << [ appname , summary , ' ' ]
183- rescue StandardError , LoadError
184- error_message = _ ( "!%{sub_command}! Subcommand unavailable due to error." ) % { sub_command : appname }
185- error_message += ' ' + _ ( "Check error logs." )
186- result << [ error_message , '' , ' ' ]
187- end
193+ result << generate_summary ( appname )
188194 end
189195 end
190196 end
191197
192198 COMMON = 'Common:'
193199 SPECIALIZED = 'Specialized:'
194200 BLANK = "\n "
201+ COMMON_APPS = %w[ apply agent config help lookup module resource ]
195202 def available_application_names_special_sort
196203 full_list = Puppet ::Application . available_application_names
197- a_list = full_list & %w[ apply agent config help lookup module resource ]
204+ a_list = full_list & COMMON_APPS
198205 a_list = a_list . sort
199206 also_ran = full_list - a_list
200207 also_ran = also_ran . sort
201208 [ [ COMMON ] , a_list , [ BLANK ] , [ SPECIALIZED ] , also_ran ] . flatten ( 1 )
202209 end
203210
211+ def common_app_summaries
212+ COMMON_APPS . map do |appname |
213+ generate_summary ( appname )
214+ end
215+ end
216+
217+ def specialized_app_summaries
218+ specialized_apps = Puppet ::Application . available_application_names - COMMON_APPS
219+ specialized_apps . filter_map do |appname |
220+ generate_summary ( appname ) unless exclude_from_docs? ( appname )
221+ end
222+ end
223+
204224 def horribly_extract_summary_from ( appname )
205225 help = Puppet ::Application [ appname ] . help . split ( "\n " )
206226 # Now we find the line with our summary, extract it, and return it. This
0 commit comments