Beispiel #1
0
/**
 *@always
 */
function task_entity_init_constructor()
{
    lmb_require('limb/constructor/src/lmbProjectConstructor.class.php');
    $override_files = taskman_propor('OVERRIDE', false);
    $project_constructor = new lmbProjectConstructor(taskman_prop('PROJECT_DIR'), $override_files);
    taskman_propset('CONSTRUCTOR', $project_constructor);
    taskman_sysmsg("Constructor initialized...\n");
}
Beispiel #2
0
function propor($name, $def)
{
    return \taskman_propor($name, $def);
}
Beispiel #3
0
<?php

$limb_dir = dirname(__FILE__);
require_once $limb_dir . '/taskman/taskman.inc.php';
taskman_process_argv($argv);
lmb_cli_init_limb($limb_dir);
taskman_propsetor('LIMB_DIR', $limb_dir . '/../');
taskman_propsetor('TASKS_MASKS', 'limb/*/cli/*.tasks.php' . PATH_SEPARATOR . 'src/*/cli/*.tasks.php');
if (null === taskman_propor('PROJECT_DIR', null)) {
    taskman_propsetor('PROJECT_DIR', lmb_get_project_dir());
}
lmb_cli_init_project(taskman_prop('PROJECT_DIR'));
lmb_cli_init_tasks();
taskman_run();
function lmb_get_project_dir()
{
    if (!($project_dir = get_cfg_var('limb.project_dir'))) {
        $project_dir = lmb_cli_ask_for_option('Project directory', lmb_cli_find_project_dir(getcwd()));
    } else {
        echo "Project directory loaded from PHP config: {$project_dir}\n";
    }
    return $project_dir;
}
function lmb_cli_find_project_dir($current_dir)
{
    if (file_exists($current_dir . '/setup.php')) {
        ob_start();
        register_shutdown_function('lmb_cli_check_limb_instance');
        lmb_require($current_dir . '/setup.php');
        ob_end_clean();
        lmb_cli_check_limb_instance($disable = true);
Beispiel #4
0
/**
 *@desc Init db config by given DSN param
 *@example project.php init_db_config -D DSN=sqlite:///www/skel/db/database.sqlite
 */
function task_project_db_init_config()
{
    lmb_package_require('dbal');
    $config_file = taskman_prop('PROJECT_DIR') . '/settings/db.conf.php';
    if (file_exists($config_file)) {
        return;
    }
    taskman_msg("Database config does not exists...\n");
    if (!($dsn_str = taskman_propor('DSN', ''))) {
        $dsn_str = lmb_cli_ask_for_option('Dsn (example: mysqli://root:test@localhost/limb_app?charset=utf8)');
    }
    lmb_require('limb/dbal/src/lmbDbDSN.class.php');
    $dsn = new lmbDbDSN($dsn_str);
    $config_text = "<?php\n\n \$conf = array('dsn' => '{$dsn_str}');";
    file_put_contents($config_file, $config_text);
    taskman_msg("DB config ({$config_file}) writed...Done\n");
}