示例#1
0
def add_crm_venv() -> Do:
    handle = yield Ribo.setting(handle_crm)
    if handle:
        log.debug('adding chromatin venv')
        plugin = Rplugin.simple('chromatin')
        yield Ribo.modify_main(lambda a: a.set.chromatin_rplugin(Just(plugin)))
        yield Ribo.modify_main(
            lambda a: a.set.chromatin_venv(Just('chromatin')))
示例#2
0
文件: setup.py 项目: tek/chromatin.py
def bootstrap_rplugins_io() -> Do:
    vr = yield installable_plugins()
    dir = yield Ribo.setting(venv_dir)
    global_interpreter = yield Ribo.setting_raw(interpreter)
    ios = yield vr.traverse(
        lambda a: bootstrap_rplugin(a, dir, global_interpreter.to_maybe)
        (a.meta), NS)
    yield NS.pure(GatherIOs(ios, timeout=30))
示例#3
0
def health_statuses() -> Do:
    dir = yield Ribo.setting(venv_dir)
    all_venvs = yield Ribo.inspect_main(lambda a: a.venvs)
    log.debug(f'running health check on venvs: {all_venvs.join_comma}')
    installable = yield Ribo.zoom_main(
        all_venvs.traverse(lambda a: installable_rplugin_from_name(dir, a),
                           NS))
    gather_items = yield installable.traverse(
        lambda a: rplugin_healthy(a.rplugin)(a.meta), NS)
    return Gather(gather_items, 5)
示例#4
0
def read_conf() -> Do:
    plugin_conf = yield Ribo.setting(rplugins)
    specs = plugin_conf.traverse(Rplugin.from_config, Either)
    yield NS.from_either(specs)
示例#5
0
def activate_newly_installed() -> Do:
    new = yield Ribo.zoom_main(NS.inspect_either(lambda a: a.inactive))
    yield activate_multi(new)
    yield Ribo.zoom_main(activation_complete())
示例#6
0
def reboot_plugins(plugins: List[str]) -> Do:
    yield Ribo.zoom_main(deactivate_by_names(plugins))
    yield activate_by_names(plugins)
示例#7
0
def activate_by_names(plugins: List[str]) -> Do:
    getter = (lambda a: a.ready_rplugins) if plugins.empty else (
        lambda a: a.ready_by_name(plugins))
    rplugins = yield Ribo.zoom_main(NS.inspect_either(getter))
    yield (NS.error(resources.no_plugins_match_for_activation(plugins))
           if rplugins.empty else activate_multi(rplugins))
示例#8
0
def activate_multi(new_rplugins: List[Rplugin]) -> Do:
    active = yield Ribo.zoom_main(
        NS.inspect_either(lambda a: a.active_rplugins))
    active_rplugins = active.map(lambda a: a.rplugin)
    already_active, inactive = new_rplugins.split(active_rplugins.contains)
    yield inactive.traverse(activate_rplugin, NS).replace(already_active)
示例#9
0
def activate_rplugin(rplugin: Rplugin) -> Do:
    active_rplugin = yield NS.lift(activate_rplugin_io.match(rplugin))
    yield Ribo.zoom_main(activated(active_rplugin))
示例#10
0
文件: setup.py 项目: tek/chromatin.py
def installable_plugins() -> Do:
    plugins = yield Ribo.inspect_main(lambda a: a.rplugins)
    return plugins.flat_map(cons_installable_rplugin.match)
示例#11
0
文件: setup.py 项目: tek/chromatin.py
def initialize() -> Do:
    yield add_crm_venv()
    yield Ribo.zoom_main(read_conf())
示例#12
0
文件: setup.py 项目: tek/chromatin.py
def show_plugins() -> Do:
    dir = yield Ribo.setting(venv_dir)
    rplugins = yield Ribo.inspect_main(lambda a: a.rplugins)
    return Echo.info(resources.show_plugins(dir, rplugins))
示例#13
0
文件: setup.py 项目: tek/chromatin.py
def add_plugins(rplugins: List[Rplugin]) -> None:
    yield Ribo.zoom_main(NS.modify(lambda s: s.append.rplugins(rplugins)))
    yield Ribo.setting(autostart)
示例#14
0
def updateable_venvs(plugins: List[str]) -> Do:
    dir = yield Ribo.setting(venv_dir)
    yield Ribo.zoom_main(updateable(dir, plugins).nvim)