Example #1
0
def add_spec(spec: str) -> Do:
    yield NS.lift(present_venv(name))
    yield NS.lift(variable_set_prefixed('interpreter', '/usr/bin/python3.7'))
    yield NS.lift(variable_set_prefixed('debug_pythonpath', True))
    yield request('cram', spec, name=name)
    data = yield NS.inspect(lambda a: a.data)
    return k(data.venvs).must(contain(name)) & k(data.active).must(contain(target))
Example #2
0
def hs_spec() -> Do:
    yield NS.lift(variable_set_prefixed('autostart', True))
    yield request('cram',
                  f'hs:nvim-hs-ghcid',
                  name='nvim-hs-ghcid',
                  track=False)
    yield NS.lift(wait_for_command('GhcidStart', timeout=1))
    return k(1) == 1
Example #3
0
def python_path_spec() -> Do:
    dir = fixture_path('rplugin', 'path_spec')
    extra_path_pkg = fixture_path('rplugin', 'extra_path_pkg')
    yield NS.lift(variable_set_prefixed('autostart', True))
    yield request('cram',
                  f'dir:{dir}',
                  name='path_spec',
                  pythonpath=[extra_path_pkg])
    result = yield NS.lift(call_once_defined('PathSpecTest', timeout=10))
    return k(result) == 13
Example #4
0
def deactivate_rplugin(active_rplugin: ActiveRplugin) -> Do:
    rplugin = active_rplugin.rplugin
    meta = active_rplugin.meta
    cname = camelcaseify(rplugin.name)
    rpc_triggers_fun = f'{cname}RpcTriggers'
    triggers = yield NS.lift(nvim_call_json(rpc_triggers_fun))
    yield NS.modify(lambda a: a.deactivate_rplugin(meta))
    yield NS.lift(stop_rplugin(rplugin.name, meta.channel, triggers))
    log.debug(f'deactivated {active_rplugin}')
    yield NS.pure(None)
Example #5
0
def extension_spec() -> Do:
    dir = fixture_path('rplugin', name)
    extension_path = fixture_path('rplugin', ext_name)
    yield NS.lift(variable_set_prefixed('autostart', True))
    yield NS.lift(variable_set(f'{name}_components', List(f'{ext_name}.ext')))
    yield request('cram',
                  f'dir:{dir}',
                  name='extension_spec',
                  extensions=[extension_path])
    result1 = yield NS.lift(call_once_defined('XTest', timeout=1))
    result2 = yield NS.lift(call_once_defined('XExtTest', timeout=1))
    return (k(result1) == 13) & (k(result2) == 23)
Example #6
0
def install_plugins_procs(names: List[str], update: Boolean) -> Do:
    action = 'updating' if update else 'installing'
    log.debug(f'{action} rplugins: {names}')
    rplugins = yield installable_rplugins_from_names(names)
    procs = yield NS.lift(
        rplugins.traverse(lambda a: install_rplugin_subproc(a)(a.meta),
                          NvimIO))
    return GatherSubprocesses(procs, timeout=600)
Example #7
0
 def dir(self, rplugin: DirVenvRplugin) -> Do:
     venv = yield NS.lift(venv_from_rplugin(self.rplugin))
     args = List('-c', f'import {self.rplugin.name}')
     path = join_pythonpath(self.rplugin.pythonpath.cons(rplugin.dir))
     return GatherSubprocess(
         Subprocess(str(venv.meta.python_executable),
                    args,
                    self.rplugin.name,
                    timeout=1,
                    env=dict(PYTHONPATH=path)))
Example #8
0
def one_spec() -> Do:
    yield NS.lift(present_venv(name))
    yield update_data(
        rplugins=List(rplugin),
        venvs=List(name),
        active=List(active_rplugin),
        ready=List(name),
    )
    yield request('update', 'flagellum')
    log_buffer = yield NS.inspect(lambda a: a.data.log_buffer)
    return k(log_buffer).must(
        contain(Echo.info(resources.updated_plugin(rplugin.name))))
Example #9
0
 def dist(self, rplugin: DistVenvRplugin) -> Do:
     venv = yield NS.lift(venv_from_rplugin(self.rplugin))
     return GatherIO(
         venv_package_installed(venv).map(lambda status:
                                          (self.rplugin.name, status)))
Example #10
0
def activation_complete() -> Do:
    rplugins = yield NS.inspect_either(lambda a: a.uninitialized_rplugins)
    tracked = rplugins.filter(lambda a: a.rplugin.track)
    failed = yield NS.lift(initialize_plugins(tracked))
    yield NS.modify(lambda a: a.initialization_complete(failed))
Example #11
0
def ensure_setting(setting: Setting[A], value: A) -> Do:
    yield NS.lift(setting.ensure(value))
Example #12
0
def activate_rplugin(rplugin: Rplugin) -> Do:
    active_rplugin = yield NS.lift(activate_rplugin_io.match(rplugin))
    yield Ribo.zoom_main(activated(active_rplugin))
Example #13
0
def updated(result: List[str]) -> Do:
    venvs = result.filter_not(lambda a: a == 'chromatin')
    reboot = yield NS.lift(autoreboot.value_or_default())
    if reboot:
        yield reboot_plugins(venvs)
Example #14
0
def stage_1() -> NS[None, None]:
    return NS.lift(variable_set('cil', 2))
Example #15
0
def dir_venv_spec() -> Do:
    flag_dir = fixture_path('rplugin', 'flagellum')
    yield NS.lift(variable_set_prefixed('autostart', True))
    yield request('cram', f'dir:{flag_dir}', name='flagellum')
    yield NS.lift(wait_for_command('FlagTest', timeout=1))
    yield NS.lift(await_k(log_entry, 'flagellum initialized'))
Example #16
0
def hs_dir_spec() -> Do:
    flag_dir = fixture_path('rplugin', 'flagellum.hs')
    yield NS.lift(variable_set_prefixed('autostart', True))
    yield request('cram', f'hs_dir:{flag_dir}', name='flagellum')
    yield NS.lift(wait_for_function('FlagTest', timeout=1))
    return k(1) == 1
Example #17
0
def installable_rplugins_from_names(names: List[str]) -> Do:
    dir = yield NS.lift(venv_dir.value)
    yield names.traverse(lambda a: installable_rplugin_from_name(dir, a), NS)
Example #18
0
def hackage_spec() -> Do:
    yield NS.lift(variable_set_prefixed('autostart', True))
    yield request('cram', f'hackage:proteome', name='proteome')
    yield NS.lift(wait_for_function('ProAdd', timeout=1))
    return k(1) == 1
Example #19
0
def activated(active_rplugin: ActiveRplugin) -> Do:
    log.debug(f'activated {active_rplugin}')
    spec = active_rplugin.rplugin
    yield NS.lift(runtime(f'chromatin/{spec.name}/*'))
    yield NS.modify(lambda a: a.host_started(active_rplugin.meta))
Example #20
0
def arg_test(num: int) -> Do:
    value_e = yield NS.lift(variable_prefixed_str('value'))
    value = value_e | 'failure'
    ribo_log.info(f'{value} {num}')
Example #21
0
def stage_2() -> NS[None, None]:
    return NS.lift(variable_set('flag', 2))
Example #22
0
def conf_test() -> Do:
    value_e = yield NS.lift(variable_prefixed_str('value'))
    value = value_e | 'failure'
    ribo_log.info(value)
Example #23
0
def quit() -> NS[None, None]:
    return NS.lift(variable_set('quit', 1))
Example #24
0
def one_spec() -> Do:
    yield NS.lift(present_venv(name))
    yield request('init')
    data = yield NS.inspect(lambda a: a.data)
    return k(data.venvs).must(contain(name)) & k(data.active).must(
        contain(active_rplugin))