Beispiel #1
0
    }
}
echo PHP_EOL . color_echo('-> ', 'green') . 'Creating project folder' . PHP_EOL;
mkdir($project_name);
echo color_echo('-> ', 'green') . 'Downloading Composer' . PHP_EOL;
exec('curl -s https://getcomposer.org/installer | php -- --install-dir=' . $project_name, $output, $return_value);
if ($return_value != 0) {
    echo color_echo('Something wrong happened!', 'red') . PHP_EOL . implode(PHP_EOL, $output) . PHP_EOL;
    exit(1);
}
echo color_echo('-> ', 'green') . 'Adding minimal configuration files' . PHP_EOL;
file_put_contents($project_name . DIRECTORY_SEPARATOR . 'composer.json', get_composer_json_file());
file_put_contents($project_name . DIRECTORY_SEPARATOR . 'conf.json', get_conf_json());
echo color_echo('-> ', 'green') . 'Installing dependencies' . PHP_EOL;
exec('php ' . $project_name . '/composer.phar install --quiet --working-dir=' . $project_name);
echo PHP_EOL . color_echo('Installation successful!', 'green') . PHP_EOL;
echo get_help($project_name) . PHP_EOL;
function get_composer_json_file()
{
    return <<<'EOD'
{
    "config": {
        "vendor-dir": "_vendor"
    },
    "require":{
        "simonjodet/gumdrop":"1.*"
    },
    "scripts":{
        "post-update-cmd":"php _vendor/simonjodet/gumdrop/gumdrop.php install",
        "post-install-cmd":"php _vendor/simonjodet/gumdrop/gumdrop.php install"
    }
Beispiel #2
0
function install()
{
    /*{{{*/
    $user = trim(shell_exec('whoami'));
    $home = "/home/{$user}";
    $bashrc = "{$home}/.bashrc";
    if (file_exists($bashrc)) {
        $path = getenv('PATH');
        if (strpos($path, CRON_COMMAND) != false) {
            echo CRON_COMMAND . "\n";
        } else {
            $path = "export PATH={$path}:" . CRON_COMMAND;
            file_put_contents($bashrc, "{$path}", FILE_APPEND);
            $ret = system("source {$bashrc}");
            color_echo($ret . "\n", 'red');
        }
    } else {
        echo "{$bashrc} not exists\n";
    }
}