forked from gushphp/gush
-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate_docu
executable file
·84 lines (69 loc) · 2.15 KB
/
generate_docu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/usr/bin/env php
<?php
/**
* This file is part of Gush.
*
* (c) Luis Cordova <cordoval@gmail.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\BufferedOutput;
require_once __DIR__.'/vendor/autoload.php';
$adapterFactory = new Gush\Factory\AdapterFactory();
$adapters = [
'github' => 'Gush\Adapter\GitHubFactory',
'github_enterprise' => 'Gush\Adapter\GitHubEnterpriseFactory',
'bitbucket' => 'Gush\Adapter\BitbucketFactory',
'gitlab' => 'Gush\Adapter\GitLabFactory',
];
foreach ($adapters as $adapterName => $factoryClass) {
if (!class_exists($factoryClass)) {
continue;
}
$adapterFactory->registerAdapter(
$adapterName,
[$factoryClass, 'createAdapter'],
[$factoryClass, 'createAdapterConfigurator']
);
}
$issueTrackers = [
'github' => 'Gush\Adapter\GitHubFactory',
'github_enterprise' => 'Gush\Adapter\GitHubEnterpriseFactory',
'bitbucket' => 'Gush\Adapter\BitbucketFactory',
'gitlab' => 'Gush\Adapter\GitLabFactory',
'jira' => 'Gush\Adapter\JiraFactory',
'jira_enterprise' => 'Gush\Adapter\JiraEnterpriseFactory',
];
foreach ($issueTrackers as $trackerName => $factoryClass) {
if (!class_exists($factoryClass)) {
continue;
}
$adapterFactory->registerIssueTracker(
$trackerName,
[$factoryClass, 'createIssueTracker'],
[$factoryClass, 'createIssueTrackerConfigurator']
);
}
$app = new Gush\Application($adapterFactory);
$app->setAutoExit(false);
foreach ($app->getCommands() as $command) {
$output = new BufferedOutput();
$input = new StringInput(sprintf('%s --help --format md', $command->getName()));
$app->run($input, $output);
$header = <<<EOT
---
layout: docu-page
full_title: "Gush: Rapid workflow for project maintainers and contributors"
---
{% block content %}
EOT;
$footer = <<<EOT
{% endblock content %}
EOT;
file_put_contents(
'web/'.$command->getName().'.md',
sprintf("%s\n%s\n%s", $header, $output->fetch(), $footer)
);
}