예제 #1
0
def get_html_directory():
    html_dir = settings.html_directory

    if not html_dir.exists():
        error_msg = NO_HTML_DIR_ERROR.format(html_dir.as_posix())

        exit_immediately(error_msg)

    if not html_dir.is_dir():
        exit_immediately(str(html_dir) + ' needs to be a directory')

    return settings.html_directory
예제 #2
0
def get_json_directory(for_writing):
    json_dir = settings.json_directory

    if not json_dir.exists():
        # I use posix paths here, since even on Windows folks will
        # probably be using some kinda Unix-y shell to run mkdir.
        if for_writing:
            error_msg = NO_JSON_DIR_ERROR_WRITE.format(json_dir.as_posix())
        else:
            error_msg = NO_JSON_DIR_ERROR_READ.format(json_dir.as_posix())

        exit_immediately(error_msg)

    if not json_dir.is_dir():
        exit_immediately(str(json_dir) + ' needs to be a directory')

    return settings.json_directory
예제 #3
0
# Most of the heavy lifting is done by the following modules:

from lib.populate import (populate_all, populate_incremental)

from lib.jekyll import (build_website)

try:
    import settings
except ModuleNotFoundError:
    # TODO: Add better instructions.
    exit_immediately('''
    We can't find settings.py.

    Please copy default_settings.py to settings.py
    and then edit the settings.py file to fit your use case.

    For testing, you can often leave the default settings,
    but you will still want to review them first.
    ''')

NO_JSON_DIR_ERROR_WRITE = '''
We cannot find a place to write JSON files.

Please run the below command:

mkdir {}'''

NO_JSON_DIR_ERROR_READ = '''
We cannot find a place to read JSON files.