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
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