Ejemplo n.º 1
0
    def run(self):
        if self.args.c:
            commands.check(app=self, input_str=":c {0}".format(self.args.c))
        if self.args.d:
            commands.delete(app=self, input_str=":d {0}".format(self.args.d))
        if self.args.clear:
            commands.clear(app=self)

        print str(self.list),
Ejemplo n.º 2
0
def run():
    """
    Main MooseDocs command.
    """

    # Options
    options = vars(command_line_options())

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

    # Create cache directory.
    # This needs to be done hear rather than in MooseDocs/__init__.py to avoid race condition
    # when multiple processes are loading the MooseDocs module.
    if not os.path.exists(MooseDocs.TEMP_DIR):
        os.makedirs(MooseDocs.TEMP_DIR)

    # Remove moose.svg files (these get generated via dot)
    LOG.debug('Removing *.moose.svg files from %s', os.getcwd())
    purge(['svg'])

    # Pull LFS image files
    try:
        subprocess.check_output(['git', 'lfs', 'pull'], cwd=MooseDocs.ROOT_DIR)
    except subprocess.CalledProcessError:
        LOG.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 = 0
        LOG.error('Deprecated command, please used "~/projects/moose/python/run_tests ' \
                  '-j8 --re=MooseDocs" instead.')
    elif cmd == 'check':
        retcode = commands.check(**options)
    elif cmd == 'generate':
        retcode = 0
        LOG.error(
            'Deprecated command, please used "check --generate" instead.')
    elif cmd == 'serve':
        retcode = 0
        LOG.error('Deprecated command, please used "build --serve" instead.')
    elif cmd == 'build':
        retcode = commands.build(**options)
    elif cmd == 'latex':
        retcode = commands.latex(**options)
    elif cmd == 'presentation':
        retcode = commands.presentation(**options)

    # Check retcode
    if retcode:
        return retcode

    # Display logging results
    warn, err = formatter.counts()
    print 'WARNINGS: {}  ERRORS: {}'.format(warn, err)
    return err > 0
Ejemplo n.º 3
0
def run():
    """
    Main MooseDocs command.
    """

    # Options
    options = vars(command_line_options())

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

    # Create cache directory.
    # This needs to be done hear rather than in MooseDocs/__init__.py to avoid race condition
    # when multiple processes are loading the MooseDocs module.
    if not os.path.exists(MooseDocs.TEMP_DIR):
        os.makedirs(MooseDocs.TEMP_DIR)

    # Remove moose.svg files (these get generated via dot)
    LOG.debug('Removing *.moose.svg files from %s', os.getcwd())
    purge(['svg'])

    # Execute command
    cmd = options.pop('command')
    if cmd == 'test':
        retcode = 0
        LOG.error('Deprecated command, please used "~/projects/moose/python/run_tests ' \
                  '-j8 --re=MooseDocs" instead.')
    elif cmd == 'check':
        retcode = commands.check(**options)
    elif cmd == 'generate':
        retcode = 0
        LOG.error('Deprecated command, please used "check --generate" instead.')
    elif cmd == 'serve':
        retcode = 0
        LOG.error('Deprecated command, please used "build --serve" instead.')
    elif cmd == 'build':
        retcode = commands.build(**options)
    elif cmd == 'latex':
        retcode = commands.latex(**options)
    elif cmd == 'presentation':
        retcode = commands.presentation(**options)

    # Check retcode
    if retcode:
        return retcode

    # Display logging results
    warn, err = formatter.counts()
    print 'WARNINGS: {}  ERRORS: {}'.format(warn, err)
    return err > 0
Ejemplo n.º 4
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