def doit(line): """ Run *doit* with `task_creators` from all interactive variables (IPython's global namespace). Examples: >>> %doit --help ## Show help for options and arguments. >>> def task_foo(): return {'actions': ['echo hi IPython'], 'verbosity': 2} >>> %doit list ## List any tasks discovered. foo >>> %doit ## Run any tasks. . foo hi IPython """ # Override db-files location inside ipython-profile dir, # which is certainly writable. prof_dir = ip.profile_dir.location opt_vals = {'dep_file': os.path.join(prof_dir, 'db', '.doit.db')} commander = DoitMain(ModuleTaskLoader(ip.user_module), extra_config={'GLOBAL': opt_vals}) commander.BIN_NAME = 'doit' commander.run(line.split())
def test_help_plugin_name(self, capsys): plugin = {'XXX': 'tests.sample_plugin:MyCmd'} main = DoitMain(extra_config={'COMMAND':plugin}) main.BIN_NAME = 'doit' returned = main.run(["help"]) assert returned == 0 out, err = capsys.readouterr() assert "doit XXX " in out assert "test extending doit commands" in out, out
def test_help_plugin_name(self, capsys): plugin = {'XXX': 'tests.sample_plugin:MyCmd'} main = DoitMain(extra_config={'COMMAND': plugin}) main.BIN_NAME = 'doit' returned = main.run(["help"]) assert returned == 0 out, err = capsys.readouterr() assert "doit XXX " in out assert "test extending doit commands" in out, out
def _doit_prepare(self, builder, task): miner.dodo.builder = builder # create build directory for storing doit database if not os.path.exists(builder.build_dir): os.makedirs(builder.build_dir) opt_vals = {'dep_file': os.path.join(builder.build_dir, '.doit.db')} commander = DoitMain(ModuleTaskLoader(miner.dodo), extra_config={'GLOBAL': opt_vals}) commander.BIN_NAME = 'doit' logging.info('Preparing LEDE build system...') commander.run(['--verbosity', '2', task])
def cmd_main(args, extra_config=None, bin_name='doit'): if extra_config: extra_config = {'GLOBAL': extra_config} main = DoitMain(extra_config=extra_config) main.BIN_NAME = bin_name return main.run(args)