Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
alddesign committed Apr 7, 2023
1 parent ac5146a commit 96eae3f
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
make-api-doc/cache
make-api-doc/*out.txt
make-api-doc/*.dump

66 changes: 66 additions & 0 deletions make-api-doc/make-api-doc.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<#
This script builds the api-doc html page by using phpdocumentor 3
#>

# CONFIG -------------------------------------------------------------------------------------------------------
cd $PSScriptRoot;

#Source directory of crudkit
$srcDir = "..\src";

#Config files for phpdoc (needs to be an absolute path)
$userConfig = $PSScriptRoot + "\phpdoc.user.config.xml";
$devConfig = $PSScriptRoot + "\phpdoc.dev.config.xml";

#phpdoc log log (stdout and errout)
$userErrOut = ".\phpdoc-user-errout.txt";
$userStdOut = ".\phpdoc-user-stdout.txt";
$devErrOut = ".\phpdoc-dev-errout.txt";
$devStdOut = ".\phpdoc-dev-stdout.txt";

#Path to the the output directores (note that these need to be the same as in the config files)
$userDir = "..\api-doc\user";
$devDir = "..\api-doc\dev";

#PREPARE -------------------------------------------------------------------------------------------------------

Remove-Item -LiteralPath $userDir -Recurse -Force -ErrorAction SilentlyContinue;
Remove-Item -LiteralPath $devDir -Recurse -Force -ErrorAction SilentlyContinue;
$userDocOk = $false;
$devDockOk = $false;

#BUILD USER DOC -------------------------------------------------------------------------------------------------------
#phpDocumentor.phar (v3.3.1) is not included in this git repo, because its big and ppl. dont need to download that.
#Get it from github: https://github.com/phpDocumentor/phpDocumentor
php phpDocumentor.phar --config $userConfig > $userStdOut 2> $userErrOut;

if(Test-Path -LiteralPath ($userDir + '\index.html'))
{
#teplate.color from phpdoc does not work, so fuck you:
$css = ":root{--primary-color-hue: 202; --primary-color-saturation: 68%;} .phpdocumentor-table-of-contents__entry::before{background: none !important; background-color: hsl(202,68%,60%) !important;} ";
Out-File -LiteralPath ($userDir + "\css\base.css") -InputObject $css -Append -Encoding utf8 -ErrorAction SilentlyContinue;

$userDocOk = $true;
Write-Host "api-doc [user] successfully created!" -ForegroundColor Green;
}
else
{
Write-Host "error while creating api-doc [user]. check phpdoc logs." -ForegroundColor Red;
}


#BUILD DEV DOC -------------------------------------------------------------------------------------------------------
php phpDocumentor.phar --config $devConfig > $devStdOut 2> $devErrOut;

if(Test-Path -LiteralPath ($devDir + '\index.html'))
{
$css = ":root{--primary-color-hue: 320; --primary-color-saturation: 68%;} .phpdocumentor-table-of-contents__entry::before{background: none !important; background-color: hsl(320,68%,60%) !important;} ";
Out-File -LiteralPath ($devDir + "\css\base.css") -InputObject $css -Append -Encoding utf8 -ErrorAction SilentlyContinue;

$devDockOk = $true;
Write-Host "api-doc [dev] successfully created!" -ForegroundColor Green;
}
else
{
Write-Host "error while creating api-doc [dev]. check phpdoc logs." -ForegroundColor Red;
}
Binary file added make-api-doc/phpDocumentor.phar
Binary file not shown.
31 changes: 31 additions & 0 deletions make-api-doc/phpdoc.dev.config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- DEV -->
<phpdocumentor configVersion="3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.phpdoc.org" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd">
<title>CRUDKit api-doc [Developer]</title>
<paths>
<output>../api-doc/dev</output>
<cache>./cache/dev</cache>
</paths>
<version number="1.0.0">
<api format="php">
<default-package-name>CRUDKit</default-package-name>
<visibility>internal</visibility> <!-- also includes Classes and Methods marked with @internal -->
<include-source>true</include-source>
<source dsn="../src">
<path>./</path>
</source>
<ignore>
<path>examples/</path>
<path>views/</path>
<path>config/</path>
<path>Classes/XmlSerializer.php</path>
</ignore>
</api>
</version>
<!-- Following shit doesnt work, might do in the future: -->
<setting name="template.color" value="red"/>
<template name="default">
<parameter name="color" value="red"/>
</template>
</phpdocumentor>
<!-- DEV -->
37 changes: 37 additions & 0 deletions make-api-doc/phpdoc.user.config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!-- USER -->
<phpdocumentor configVersion="3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.phpdoc.org" xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/phpDocumentor/phpDocumentor/master/data/xsd/phpdoc.xsd">
<title>CRUDKit api-doc [User]</title>
<paths>
<output>../api-doc/user</output>
<cache>./cache/user</cache>
</paths>
<version number="1.0.0">
<api format="php">
<default-package-name>CRUDKit</default-package-name>
<source dsn="../src">
<path>./</path>
</source>
<ignore>
<path>examples/</path>
<path>views/</path>
<path>config/</path>
<path>Classes/SQLColumn.php</path>
<path>Classes/SQLManyToOneColumn.php</path>
<path>Classes/SQLOneToManyColumn.php</path>
<path>Classes/EnumType.php</path>
<path>Classes/ExceptionHandler.php</path>
<path>Classes/Filter.php</path>
<path>Classes/XmlSerializer.php</path>
<path>Classes/Section.php</path>
<path>Controllers/CrudkitController.php</path>
</ignore>
</api>
</version>
<!-- Following shit doesnt work, might do in the future: -->
<setting name="template.color" value="red"/>
<template name="default">
<parameter name="color" value="red"/>
</template>
</phpdocumentor>
<!-- USER -->
5 changes: 5 additions & 0 deletions make-api-doc/readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Files in this directory are only used for building the api doc.

Note for me:
phpDocumentor.phar (v3.3.1) is not included in this git repo, because its big and ppl. dont need to download that.
Get it from github: https://github.com/phpDocumentor/phpDocumentor

0 comments on commit 96eae3f

Please sign in to comment.