Пример #1
0
    }
    // das nimmt vielleicht zu viele, weis nicht, alternativ würds auch ne statische methode zur extension tun
    foreach ($extension->getProperties() as $property) {
        $fields[] = $property->getName();
    }
    $json = array();
    foreach (array_unique($fields) as $field) {
        $json[$field] = '%(ask:' . $field . ')';
    }
    $command->comment(sprintf('Komodo-Command für %s:', $extension->getClassName()));
    $output->writeln(\Psc\TPL\TPL::miniTemplate('cli.bat compile:generic %F inFile %extension% %json%', array('extension' => $extension->getClassName(), 'json' => json_encode((object) $json))));
});
$createCommand('git:pre-push-hook', array($arg('someFile'), $arg('someFile2'), $arg('workingTree')), function ($input, $output, $command) {
    $workingTree = Dir::factoryTS($input->getArgument('workingTree'));
    $dir = new Dir(__DIR__ . DIRECTORY_SEPARATOR);
    $root = $dir->up();
    if ($workingTree->equals($root)) {
        $dist = $root->getFile('dist/psc-cms.phar.gz');
        $lastMessage = exec('git log -n 1 --format=%s');
        $updateComposer = 'composer update --prefer-dist --dev';
        $buildPhar = $root->getFile('bin/cli') . ' build-phar';
        $cd = 'cd ' . $root;
        $ammend = 'git commit -m"' . $lastMessage . '" --amend -o ' . $dist . ' composer.lock ';
        system($cd . ' && ' . $updateComposer . ' && ' . $buildPhar . ' && ' . $ammend);
        return 0;
    }
    throw new Exception($workingTree . ' is not registered as hook script');
});
$createCommand('composer:update', array(), function ($input, $output, $command) {
    system('cd ' . $command->getProject()->getSrc() . ' &&php ' . \Psc\PSC::getRoot()->getFile('composer.phar') . ' update');
});