示例#1
0
def moosedocs():

  # Options
  options = vars(command_line_options())

  # Initialize logging
  formatter = init_logging(options.pop('verbose'))
  log = logging.getLogger('MooseDocs')

  # Remove moose.svg files (these get generated via dot)
  log.info('Removing *.moose.svg files from {}'.format(os.getcwd()))
  purge(['svg'])

  # Execute command
  cmd = options.pop('command')
  if cmd == 'check':
    commands.generate(stubs=False, pages_stubs=False, **options)
  elif cmd == 'generate':
    commands.generate(**options)
  elif cmd == 'serve':
    commands.serve(**options)
  elif cmd == 'build':
    commands.build(**options)
  elif cmd == 'latex':
    commands.latex(**options)

  # Display logging results
  print 'WARNINGS: {}  ERRORS: {}'.format(formatter.COUNTS['WARNING'], formatter.COUNTS['ERROR'])
  return formatter.COUNTS['ERROR'] > 0
示例#2
0
def moosedocs():

    # Options
    options = command_line_options()

    # Initialize logging
    formatter = init_logging(options.verbose)
    log = logging.getLogger('MooseDocs')

    # Remove moose.svg files (these get generated via dot)
    log.info('Removing *.moose.svg files from {}'.format(os.getcwd()))
    purge(['svg'])

    # Execute command
    if options.command == 'check':
        commands.generate(config_file=options.config_file, stubs=False, pages_stubs=False)
    elif options.command == 'generate':
        commands.generate(config_file=options.config_file, stubs=options.stubs, pages_stubs=options.pages_stubs)
    elif options.command == 'serve':
        commands.serve(config_file=options.config_file, strict=options.strict, livereload=options.livereload, clean=options.clean, theme=options.theme, pages=options.pages, page_keys=options.page_keys)
    elif options.command == 'build':
        commands.build(config_file=options.config_file, theme=options.theme, pages=options.pages, page_keys=options.page_keys)

    # Display logging results
    print 'WARNINGS: {}  ERRORS: {}'.format(formatter.COUNTS['WARNING'], formatter.COUNTS['ERROR'])
    return formatter.COUNTS['ERROR'] > 0
示例#3
0
def moosedocs():

    # Options
    options = vars(command_line_options())

    # Initialize logging
    formatter = init_logging(options.pop('verbose'))
    log = logging.getLogger('MooseDocs')

    # Remove moose.svg files (these get generated via dot)
    log.info('Removing *.moose.svg files from {}'.format(os.getcwd()))
    purge(['svg'])

    # Execute command
    cmd = options.pop('command')
    if cmd == 'check':
        commands.generate(stubs=False, pages_stubs=False, **options)
    elif cmd == 'generate':
        commands.generate(**options)
    elif cmd == 'serve':
        commands.serve(**options)
    elif cmd == 'build':
        commands.build(**options)
    elif cmd == 'latex':
        commands.latex(**options)

    # Display logging results
    print 'WARNINGS: {}  ERRORS: {}'.format(formatter.COUNTS['WARNING'],
                                            formatter.COUNTS['ERROR'])
    return formatter.COUNTS['ERROR'] > 0
示例#4
0
def moosedocs():

    # Options
    options = command_line_options()

    # Initialize logging
    formatter = init_logging(options.verbose)

    # Execute command
    if options.command == 'generate':
        commands.generate(config_file=options.moosedocs_config_file,
                          purge=options.purge)
    elif options.command == 'serve':
        commands.serve(config_file=options.mkdocs_config_file,
                       strict=options.strict,
                       livereload=options.livereload,
                       clean=options.clean,
                       theme=options.theme,
                       pages=options.pages)
    elif options.command == 'build':
        commands.build(config_file=options.mkdocs_config_file,
                       theme=options.theme,
                       pages=options.pages)

    # Display logging results
    print 'WARNINGS: {}  ERRORS: {}'.format(formatter.COUNTS['WARNING'],
                                            formatter.COUNTS['ERROR'])
    return formatter.COUNTS['ERROR'] > 0
示例#5
0
文件: __init__.py 项目: garvct/Moose
def moosedocs():

    # Options
    options = command_line_options()

    # Initialize logging
    formatter = init_logging(options.verbose)
    log = logging.getLogger('MooseDocs')

    # Remove moose.svg files (these get generated via dot)
    log.info('Removing *.moose.svg files from {}'.format(os.getcwd()))
    purge(['svg'])

    # Execute command
    if options.command == 'check':
        commands.generate(config_file=options.config_file, stubs=False, pages_stubs=False)
    elif options.command == 'generate':
        commands.generate(config_file=options.config_file, stubs=options.stubs, pages_stubs=options.pages_stubs)
    elif options.command == 'serve':
        commands.serve(config_file=options.config_file, strict=options.strict, livereload=options.livereload, clean=options.clean, theme=options.theme, pages=options.pages, page_keys=options.page_keys)
    elif options.command == 'build':
        commands.build(config_file=options.config_file, theme=options.theme, pages=options.pages, page_keys=options.page_keys)

    # Display logging results
    print 'WARNINGS: {}  ERRORS: {}'.format(formatter.COUNTS['WARNING'], formatter.COUNTS['ERROR'])
    return formatter.COUNTS['ERROR'] > 0
示例#6
0
def moosedocs():

    # Options
    options = vars(command_line_options())

    # Initialize logging
    formatter = init_logging(options.pop('verbose'))
    log = logging.getLogger('MooseDocs')

    # Remove moose.svg files (these get generated via dot)
    log.debug('Removing *.moose.svg files from {}'.format(os.getcwd()))
    purge(['svg'])

    # Pull LFS image files
    try:
        subprocess.check_output(['git', 'lfs', 'pull'])
    except subprocess.CalledProcessError:
        print "ERROR: Unable to run 'git lfs', it is likely not installed but required for the MOOSE documentation system."
        sys.exit(1)

    # Execute command
    cmd = options.pop('command')
    if cmd == 'test':
        retcode = commands.test(**options)
    elif cmd == 'check':
        retcode = commands.check(**options)
    elif cmd == 'generate':
        retcode = commands.generate(**options)
    elif cmd == 'serve':
        retcode = commands.serve(**options)
    elif cmd == 'build':
        retcode = commands.build(**options)
    elif cmd == 'latex':
        retcode = commands.latex(**options)

    # Check retcode
    if retcode is not None:
        return retcode

    # Display logging results
    warn, err = formatter.counts()
    print 'WARNINGS: {}  ERRORS: {}'.format(warn, err)
    return err > 0