Ejemplo n.º 1
0
def build(config, live_server=False, dump_json=False, dirty=False):
    """
    Perform a full site build.
    """
    if not dirty:
        log.info("Cleaning site directory")
        utils.clean_directory(config['site_dir'])
    else:
        # Warn user about problems that may occur with --dirty option
        log.warning("A 'dirty' build is being performed, this will likely lead to inaccurate navigation and other"
                    " links within your site. This option is designed for site development purposes only.")

    if not live_server:
        log.info("Building documentation to directory: %s", config['site_dir'])
        if dirty and site_directory_contains_stale_files(config['site_dir']):
            log.info("The directory contains stale files. Use --clean to remove them.")

    if dump_json:
        build_pages(config, dump_json=True, dirty=dirty)
        return

    # Reversed as we want to take the media files from the builtin theme
    # and then from the custom theme_dir so that the custom versions take
    # precedence.
    for theme_dir in reversed(config['theme_dir']):
        log.debug("Copying static assets from theme: %s", theme_dir)
        utils.copy_media_files(
            theme_dir, config['site_dir'], exclude=['*.py', '*.pyc', '*.html'], dirty=dirty
        )

    log.debug("Copying static assets from the docs dir.")
    utils.copy_media_files(config['docs_dir'], config['site_dir'], dirty=dirty)

    log.debug("Building markdown pages.")
    build_pages(config, dirty=dirty)
Ejemplo n.º 2
0
def build(config, live_server=False, dump_json=False, clean_site_dir=False):
    """
    Perform a full site build.
    """
    if clean_site_dir:
        print("Cleaning site directory")
        utils.clean_directory(config['site_dir'])
    if not live_server:
        print("Building documentation to directory: %s" % config['site_dir'])
        if not clean_site_dir and site_directory_contains_stale_files(
                config['site_dir']):
            print(
                "Directory %s contains stale files. Use --clean to remove them."
                % config['site_dir'])

    if dump_json:
        build_pages(config, dump_json=True)
        return

    # Reversed as we want to take the media files from the builtin theme
    # and then from the custom theme_dir so the custom versions take take
    # precedence.
    for theme_dir in reversed(config['theme_dir']):
        log.debug("Copying static assets from theme: %s", theme_dir)
        utils.copy_media_files(theme_dir, config['site_dir'])

    log.debug("Copying static assets from the docs dir.")
    utils.copy_media_files(config['docs_dir'], config['site_dir'])

    log.debug("Building markdown pages.")
    build_pages(config)
Ejemplo n.º 3
0
def build(config):
    """
    Perform a full site build.
    """
    utils.copy_media_files(config['theme_dir'], config['site_dir'])
    utils.copy_media_files(config['docs_dir'], config['site_dir'])
    build_pages(config)
Ejemplo n.º 4
0
def build(config, live_server=False, dump_json=False, clean_site_dir=False):
    """
    Perform a full site build.
    """
    if clean_site_dir:
        print("Cleaning site directory")
        utils.clean_directory(config['site_dir'])
    if not live_server:
        print("Building documentation to directory: %s" % config['site_dir'])
        if not clean_site_dir and site_directory_contains_stale_files(config['site_dir']):
            print("Directory %s contains stale files. Use --clean to remove them." % config['site_dir'])

    if dump_json:
        build_pages(config, dump_json=True)
        return

    # Reversed as we want to take the media files from the builtin theme
    # and then from the custom theme_dir so the custom versions take take
    # precedence.
    for theme_dir in reversed(config['theme_dir']):
        log.debug("Copying static assets from theme: %s", theme_dir)
        utils.copy_media_files(theme_dir, config['site_dir'])

    log.debug("Copying static assets from the docs dir.")
    utils.copy_media_files(config['docs_dir'], config['site_dir'])

    log.debug("Building markdown pages.")
    build_pages(config)
Ejemplo n.º 5
0
def build(config, live_server=False, dump_json=False, dirty=False):
    """
    Perform a full site build.
    """
    if not dirty:
        log.info("Cleaning site directory")
        utils.clean_directory(config['site_dir'])
    else:
        # Warn user about problems that may occur with --dirty option
        log.warning("A 'dirty' build is being performed, this will likely lead to inaccurate navigation and other"
                    " links within your site. This option is designed for site development purposes only.")

    if not live_server:
        log.info("Building documentation to directory: %s", config['site_dir'])
        if dirty and site_directory_contains_stale_files(config['site_dir']):
            log.info("The directory contains stale files. Use --clean to remove them.")

    if dump_json:
        build_pages(config, dump_json=True, dirty=dirty)
        return

    # Reversed as we want to take the media files from the builtin theme
    # and then from the custom theme_dir so that the custom versions take
    # precedence.
    for theme_dir in reversed(config['theme_dir']):
        log.debug("Copying static assets from theme: %s", theme_dir)
        utils.copy_media_files(
            theme_dir, config['site_dir'], exclude=['*.py', '*.pyc', '*.html'], dirty=dirty
        )

    log.debug("Copying static assets from the docs dir.")
    utils.copy_media_files(config['docs_dir'], config['site_dir'], dirty=dirty)

    log.debug("Building markdown pages.")
    build_pages(config, dirty=dirty)
Ejemplo n.º 6
0
def build(config):
    """
    Perform a full site build.
    """
    utils.copy_media_files(config['theme_dir'], config['site_dir'])
    utils.copy_media_files(config['docs_dir'], config['site_dir'])
    build_pages(config)
Ejemplo n.º 7
0
def build(config, live_server=False):
    """
    Perform a full site build.
    """
    if not live_server:
        print "Building documentation to directory: %s" % config['site_dir']
    utils.copy_media_files(config['theme_dir'], config['site_dir'])
    utils.copy_media_files(config['docs_dir'], config['site_dir'])
    build_pages(config)
Ejemplo n.º 8
0
def build(config, live_server=False):
    """
    Perform a full site build.
    """
    if not live_server:
        print("Building documentation to directory: %s" % config['site_dir'])
    utils.copy_media_files(config['theme_dir'], config['site_dir'])
    utils.copy_media_files(config['docs_dir'], config['site_dir'])
    build_pages(config)
Ejemplo n.º 9
0
def build(config, live_server=False, dump_json=False):
    """
    Perform a full site build.
    """
    if not live_server:
        print("Building documentation to directory: %s" % config['site_dir'])
    if dump_json:
        build_pages(config, dump_json=True)
    else:
        for theme_dir in config['theme_dir']:
            utils.copy_media_files(theme_dir, config['site_dir'])
        utils.copy_media_files(config['docs_dir'], config['site_dir'])
        build_pages(config)
Ejemplo n.º 10
0
def build(config, live_server=False, dump_json=False):
    """
    Perform a full site build.
    """
    if not live_server:
        print("Building documentation to directory: %s" % config['site_dir'])
    if dump_json:
        build_pages(config, dump_json=True)
    else:
        for theme_dir in config['theme_dir']:
            utils.copy_media_files(theme_dir, config['site_dir'])
        utils.copy_media_files(config['docs_dir'], config['site_dir'])
        build_pages(config)
Ejemplo n.º 11
0
Archivo: build.py Proyecto: ruur/mkdocs
def build(config, live_server=False, dump_json=False, clean_site_dir=False):
    """
    Perform a full site build.
    """
    if clean_site_dir:
        print("Cleaning site directory")
        utils.clean_directory(config['site_dir'])
    if not live_server:
        print("Building documentation to directory: %s" % config['site_dir'])
        if not clean_site_dir and site_directory_contains_stale_files(config['site_dir']):
            print("Directory %s contains stale files. Use --clean to remove them." % config['site_dir'])

    if dump_json:
        build_pages(config, dump_json=True)
    else:
        for theme_dir in config['theme_dir']:
            utils.copy_media_files(theme_dir, config['site_dir'])
        utils.copy_media_files(config['docs_dir'], config['site_dir'])
        build_pages(config)
Ejemplo n.º 12
0
def build(config, live_server=False, dump_json=False, clean_site_dir=False):
    """
    Perform a full site build.
    """
    if clean_site_dir:
        print("Cleaning site directory")
        utils.clean_directory(config["site_dir"])
    if not live_server:
        print("Building documentation to directory: %s" % config["site_dir"])
        if not clean_site_dir and site_directory_contains_stale_files(config["site_dir"]):
            print("Directory %s contains stale files. Use --clean to remove them." % config["site_dir"])

    if dump_json:
        build_pages(config, dump_json=True)
    else:
        # Reversed as we want to take the media files from the builtin theme
        # and then from the custom theme_dir so the custom versions take take
        # precedence.
        for theme_dir in reversed(config["theme_dir"]):
            utils.copy_media_files(theme_dir, config["site_dir"])
        utils.copy_media_files(config["docs_dir"], config["site_dir"])
        build_pages(config)