# Path: momo/utils.py
# MIN_PAGE_LINES = 50
# PY3 = sys.version_info[0] == 3
# def eval_path(path):
# def smart_print(*args, **kwargs):
# def utf8_decode(s):
# def utf8_encode(s):
# def run_cmd(cmd_str=None, cmd=None, cmd_args=None, stdout=sys.stdout,
#             stderr=sys.stderr, stdin=None):
# def open_default(path):
# def mkdir_p(path):
# def page_lines(lines):
# 
# Path: momo/plugins/base.py
# class Plugin(object):
#     def __init__(self):
#         self.settings = settings
# 
#     def setup(self):
#         """Initializae the plugin"""
#         raise NotImplementedError
# 
#     def run(self, extra_args=None):
#         """Run the plugin
# 
#         :param extra_args: a list of command-line arguments to pass to the
#             underlying plugin.
#         """
#         raise NotImplementedError


import os
import shutil
import yaml
import glob
from momo.utils import run_cmd, mkdir_p, utf8_encode, txt_type, eval_path
from momo.plugins.base import Plugin

    def setup(self):
        self.root = self.settings.bucket.root
        bucket_name = self.settings.bucket.name
        base_configs = self.settings.plugins.get(
            'mkdocs', {}).get(BASE_CONFIG_NAME, {})
        configs = self.settings.plugins.get(
            'mkdocs', {}).get(bucket_name, {})
        for k in base_configs:
            if k not in configs:
                configs[k] = base_configs[k]

        # mkdocs site_name defaults to bucket name
        self.mkdocs_configs['site_name'] = bucket_name

        for k in configs:
            if not k.startswith('momo_'):
                self.mkdocs_configs[k] = configs[k]
        for k in configs:
            if k.startswith('momo_'):
                self.momo_configs[k] = configs[k]

        self.mkdocs_root_dir = os.path.join(self.settings.settings_dir,
                                            'mkdocs')
        self.mkdocs_dir = os.path.join(self.mkdocs_root_dir,
                                       bucket_name)
        self.docs_dir = os.path.join(self.mkdocs_dir, 'docs')
        self.site_dir = os.path.join(self.mkdocs_dir, 'site')
        if os.path.exists(self.docs_dir):
            shutil.rmtree(self.docs_dir)

# Path: momo/utils.py
# MIN_PAGE_LINES = 50
# PY3 = sys.version_info[0] == 3
# def eval_path(path):
# def smart_print(*args, **kwargs):
# def utf8_decode(s):
# def utf8_encode(s):
# def run_cmd(cmd_str=None, cmd=None, cmd_args=None, stdout=sys.stdout,
#             stderr=sys.stderr, stdin=None):
# def open_default(path):
# def mkdir_p(path):
# def page_lines(lines):
# 
# Path: momo/plugins/base.py
# class Plugin(object):
#     def __init__(self):
#         self.settings = settings
# 
#     def setup(self):
#         """Initializae the plugin"""
#         raise NotImplementedError
# 
#     def run(self, extra_args=None):
#         """Run the plugin
# 
#         :param extra_args: a list of command-line arguments to pass to the
#             underlying plugin.
#         """
#         raise NotImplementedError


# Path: momo/plugins/mkdocs.py
import os
import shutil
import yaml
import glob
from momo.utils import run_cmd, mkdir_p, utf8_encode, txt_type, eval_path
from momo.plugins.base import Plugin


    def setup(self):
        self.root = self.settings.bucket.root
        bucket_name = self.settings.bucket.name
        base_configs = self.settings.plugins.get(
            'mkdocs', {}).get(BASE_CONFIG_NAME, {})
        configs = self.settings.plugins.get(
            'mkdocs', {}).get(bucket_name, {})
        for k in base_configs:
            if k not in configs:
                configs[k] = base_configs[k]

        # mkdocs site_name defaults to bucket name
        self.mkdocs_configs['site_name'] = bucket_name

        for k in configs:
            if not k.startswith('momo_'):
                self.mkdocs_configs[k] = configs[k]
        for k in configs:
            if k.startswith('momo_'):
                self.momo_configs[k] = configs[k]

        self.mkdocs_root_dir = os.path.join(self.settings.settings_dir,
                                            'mkdocs')
        self.mkdocs_dir = os.path.join(self.mkdocs_root_dir,
                                       bucket_name)
        self.docs_dir = os.path.join(self.mkdocs_dir, 'docs')
        self.site_dir = os.path.join(self.mkdocs_dir, 'site')
        if os.path.exists(self.docs_dir):
            shutil.rmtree(self.docs_dir)

        mkdir_p(self.docs_dir)