if self.output_type == 'json':
self.output_modules_json(module_infos)
+ elif self.output_type == 'html':
+ self.output_modules_html(module_infos)
# -------------------------------------------------------------------------
def output_modules_json(self, module_infos):
self.print_out(json.dumps(output_list, indent=indent, sort_keys=True))
+ # -------------------------------------------------------------------------
+ def output_modules_html(self, module_infos):
+
+ self.print_out('<table>')
+ self.print_out(' <colgroup span="9"></colgroup>')
+ self.print_out(' <thead>')
+ self.print_out(' <tr>')
+ self.print_out(' <th rowspan="2">Name</th>')
+ self.print_out(' <th rowspan="2">Vollständiger Name</th>')
+ self.print_out(' <th rowspan="2">Repository</th>')
+ self.print_out(' <th rowspan="2">Homepage bei Puppet Forge</th>')
+ self.print_out(' <th colspan="4">Version</th>')
+ self.print_out(' <th rowspan="2">Letzter Check</th>')
+ self.print_out(' </tr><tr>')
+ self.print_out(' <th>Puppet Forge</th>')
+ self.print_out(' <th>Development</th>')
+ self.print_out(' <th>Test</th>')
+ self.print_out(' <th>Production</th>')
+ self.print_out(' </tr>')
+ self.print_out(' </thead>')
+ self.print_out(' <tbody>')
+
+ nr_modules = 0
+
+ for module_info in module_infos:
+ nr_modules += 1
+ output_data = self.get_output_data(module_info)
+ if not output_data['forge_version']:
+ output_data['forge_version'] = '~'
+ if not output_data['forge_homepage_url']:
+ output_data['forge_homepage_url'] = '~'
+ if not output_data['repo']:
+ output_data['repo'] = '~'
+ tpl = ' <tr>\n'
+ tpl += ' <th>{name}</th>\n'
+ tpl += ' <td>{full_name}</td>\n'
+ tpl += ' <td>{repo}</td>\n'
+ tpl += ' <td>{forge_homepage_url}</td>\n'
+ tpl += ' <td>{forge_version}</td>\n'
+ tpl += ' <td>{version_development}</td>\n'
+ tpl += ' <td>{version_test}</td>\n'
+ tpl += ' <td>{version_production}</td>\n'
+ tpl += ' <td>{date_checked}</td>\n'
+ tpl += ' </tr>'
+ if self.verbose > 2:
+ LOG.debug("Row template:\n{}".format(tpl))
+ self.print_out(tpl.format(**output_data))
+
+ self.print_out(" </tbody>")
+ self.print_out("</table>")
+
+ plural_e = 'e'
+ if nr_modules == 1:
+ plural_e = ''
+ msg = "<br/>Insgesamt <b>{nr} Modul{e}</b> gefunden.".format(nr=nr_modules, e=plural_e)
+ self.print_out(msg)
+
# -------------------------------------------------------------------------
def get_output_data(self, module_info):
'version_test': module_info.local_version_output('test'),
'version_production': module_info.local_version_output('production'),
}
+ if self.verbose > 2:
+ LOG.debug("Output data:\n{}".format(pp(output_data)))
return output_data
# -------------------------------------------------------------------------