deployer/bin/docgen

38 lines
1.1 KiB
Plaintext
Raw Normal View History

2020-09-30 09:25:41 +02:00
#!/usr/bin/env php
<?php
/* (c) Anton Medvedev <anton@medv.io>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Deployer;
use Deployer\Documentation\ApiGen;
use Deployer\Support\Changelog\Parser;
use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\Console\Style\SymfonyStyle;
require __DIR__ . '/../vendor/autoload.php';
chdir(realpath(__DIR__ . '/..'));
$input = new ArgvInput();
$output = new ConsoleOutput();
$app = new Application('DocGen', '1.0.0');
$io = new SymfonyStyle($input, $output);
2020-09-30 15:35:44 +02:00
$app->setDefaultCommand('api');
$app->register('api')->setCode(function () use ($io) {
2020-09-30 09:25:41 +02:00
$parser = new ApiGen();
$parser->parse(file_get_contents(__DIR__ . '/../src/functions.php'));
2020-09-30 15:35:44 +02:00
$md = $parser->markdown();
file_put_contents(__DIR__ . '/../docs/api.md', $md);
$io->block('API Reference documentation is updated.');
2020-09-30 09:25:41 +02:00
});
$app->run($input, $output);