|
#!/usr/bin/env bash |
|
# -------------------------------------------------------------# |
|
# Generate the documentation from /docs/ # |
|
# Generate LOC # |
|
# -------------------------------------------------------------# |
|
# Sergio Vaccaro <sergio,[email protected]> |
|
|
|
# Note: add the following to your project |
|
# composer require --dev "yiisoft/yii2-apidoc": "dev-master#96e1651" |
|
# composer require --dev "phploc/phploc": "4.0.1" |
|
|
|
|
|
# Generate docs |
|
# ============= |
|
echo "Generating documentation and API references" |
|
echo "-------------------------------------------" |
|
# Note: this script is an overkill because it is a workaround to |
|
# this bug: https://github.com/yiisoft/yii2-apidoc/issues/131 |
|
PROJECT_PATH=/var/www/vhosts/istat/contactcentre |
|
DOCS_PATH="${PROJECT_PATH}/local/docs" |
|
|
|
cd $PROJECT_PATH |
|
|
|
# Free the wrong cache and index |
|
rm -fr local/docs/cache |
|
rm -f local/docs/index.html |
|
|
|
# Generate the api docs without yii and save the index.html |
|
php -d memory_limit=256M vendor/bin/apidoc api . $DOCS_PATH --exclude="docs,environments,local,vendor" --guide=. --pageTitle="Contact Centre Class Reference" --interactive=0 |
|
mv local/docs/index.html local/docs/api-index.html |
|
|
|
# Generate the api docs with yii and save the index.html |
|
php -d memory_limit=256M vendor/bin/apidoc api vendor/yiisoft/yii2,vendor/yiisoft/yii2-debug,vendor/yiisoft/yii2-authclient,. $DOCS_PATH --exclude="docs,environments,local,vendor" --guide=. --pageTitle="Contact Centre Class Reference" --interactive=0 |
|
mv local/docs/index.html local/docs/yii-index.html |
|
|
|
# Symlink the wanted index.html |
|
ln -s api-index.html local/docs/index.html |
|
|
|
# Generate the guide |
|
php -d memory_limit=256M vendor/bin/apidoc guide docs $DOCS_PATH --apiDocs=. --pageTitle="Contact Centre Software Guide" --interactive=0 |
|
|
|
echo "Documentation available at /docs/" |
|
echo |
|
|
|
|
|
# Generate LOC |
|
# ============ |
|
echo "Generating LOCs" |
|
echo "---------------" |
|
# LOC file |
|
LOCFILE="local/docs/loc.txt" |
|
|
|
vendor/bin/phploc --exclude=vendor --exclude=local . > "$LOCFILE" |
|
|
|
echo "LOC analysis report at ${LOCFILE}" |
|
echo |