-
Notifications
You must be signed in to change notification settings - Fork 1
/
makedocs.php
36 lines (26 loc) · 1.08 KB
/
makedocs.php
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
<?php
const PHPDOC_PHAR_URL = "https://github.com/phpDocumentor/phpDocumentor/releases/download/v2.9.1/phpDocumentor.phar";
const PHPDOC_PHAR_FILENAME = "phpdoc.phar";
if (!file_exists(PHPDOC_PHAR_FILENAME) || (time() - filemtime(PHPDOC_PHAR_FILENAME) > 86400)) {
echo "Downloading updated PHPDoc PHAR...";
file_put_contents(PHPDOC_PHAR_FILENAME, fopen(PHPDOC_PHAR_URL, 'r'));
echo " Complete.\n";
}
echo "Running PHPDoc Analysis...";
exec("php " . PHPDOC_PHAR_FILENAME . " -d src -t docs/ --template=\"xml\"");
echo " Complete\n";
echo "Removing previous documentation files...";
array_map('unlink', glob('docs/*.md'));
echo " Complete.\n";
echo "Creating Markdown files...";
$argv[1] = "docs/structure.xml";
$argv[2] = "docs";
$argv[3] = "--lt";
$argv[4] = "%c";
$argv[5] = "--index";
$argv[6] = "_Sidebar.md";
include "vendor/skayo/phpdoc-md/bin/phpdocmd";
echo " Complete.\n";
echo "Committing and pushing to Repository...";
echo exec("cd " . __DIR__ . "/docs && git add *.md && git commit -m \"Auto-Updated Documentation\" && git push");
echo " Complete.\n";