def Run(self, args): if args.devsite_dir: walker_util.DevSiteGenerator(self.cli, args.devsite_dir).Walk( args.hidden, args.restrict) if args.help_text_dir: walker_util.HelpTextGenerator(self.cli, args.help_text_dir).Walk( args.hidden, args.restrict) if args.html_dir: walker_util.HtmlGenerator(self.cli, args.html_dir).Walk( args.hidden, args.restrict) tree = walker_util.CommandTreeGenerator(self.cli).Walk( args.hidden, args.restrict) with open(os.path.join(args.html_dir, '_menu_.html'), 'w') as out: WriteHtmlMenu(tree, out) for file_name in _HELP_HTML_DATA_FILES: with open(os.path.join(args.html_dir, file_name), 'wb') as out: file_contents = pkg_resources.GetResource( 'googlecloudsdk.api_lib.meta.help_html_data.', file_name) out.write(file_contents) if args.manpage_dir: walker_util.ManPageGenerator(self.cli, args.manpage_dir).Walk( args.hidden, args.restrict) if args.update_help_text_dir: changes = help_util.HelpTextUpdater(self.cli, args.update_help_text_dir, test=args.test).Update() if changes and args.test: raise HelpTextOutOfDateError( 'Help text files must be updated.')
def Run(self, args): if args.devsite_dir: walker_util.DevSiteGenerator(self._cli_power_users_only, args.devsite_dir).Walk( args.hidden, args.restrict) if args.help_text_dir: walker_util.HelpTextGenerator( self._cli_power_users_only, args.help_text_dir).Walk(args.hidden, args.restrict) if args.html_dir: walker_util.HtmlGenerator( self._cli_power_users_only, args.html_dir).Walk(args.hidden, args.restrict) tree = walker_util.CommandTreeGenerator( self._cli_power_users_only).Walk(args.hidden, args.restrict) with io.open(os.path.join(args.html_dir, '_menu_.html'), 'wt') as out: WriteHtmlMenu(tree, out) for file_name in _HELP_HTML_DATA_FILES: with io.open(os.path.join(args.html_dir, file_name), 'wb') as out: file_contents = pkg_resources.GetResource( 'googlecloudsdk.api_lib.meta.help_html_data.', file_name) out.write(file_contents) if args.manpage_dir: walker_util.ManPageGenerator( self._cli_power_users_only, args.manpage_dir).Walk(args.hidden, args.restrict) if args.update_help_text_dir: # The help text golden files are always ascii. console_attr.ResetConsoleAttr(encoding='ascii') changes = help_util.HelpTextUpdater( self._cli_power_users_only, args.update_help_text_dir, test=args.test).Update(args.restrict) if changes and args.test: raise HelpTextOutOfDateError('Help text files must be updated.')
def Run(self, args): if args.devsite_dir: walker_util.DevSiteGenerator(self.cli, args.devsite_dir).Walk( args.hidden, args.restrict) if args.html_dir: walker_util.HtmlGenerator(self.cli, args.html_dir).Walk( args.hidden, args.restrict) tree = walker_util.CommandTreeGenerator(self.cli).Walk( args.hidden, args.restrict) with open(os.path.join(args.html_dir, '_menu_.html'), 'w') as out: WriteHtmlMenu(tree, out) for file_name in _HELP_HTML_DATA_FILES: with open(os.path.join(args.html_dir, file_name), 'wb') as out: file_contents = pkg_resources.GetResource( 'googlecloudsdk.api_lib.meta.help_html_data.', file_name) out.write(file_contents) if args.manpage_dir: walker_util.ManPageGenerator(self.cli, args.manpage_dir).Walk( args.hidden, args.restrict)
def testHtmlGenerator(self): """Tests the generated directory file names and sizes.""" html_directory = os.path.join(self.temp_path, 'html') walker_util.HtmlGenerator(self.cli, html_directory).Walk() self.AssertDirectoryIsGolden( html_directory, __file__, 'walker_util', 'html.dir')