diff --git a/.gitignore b/.gitignore index 900d2a84c..9784da828 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .DS_Store +.ddev /generator/vendor /generator/composer.phar /app/vendor diff --git a/README.md b/README.md index 774eda66a..862820a9c 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,26 @@ locally by adding this to your `local.php`: define('DISABLE_INCLUDE', true); ``` +## DDEV environment for Developer documentation + +DDEV container for the Matomo Developer Documentation site + +To start this on your local machine using ddev run the command below. + +```bash + bash ddev-developer-docs.sh +``` + +The local DDEV url for this container will be https://devdocs.ddev.site/ + +### Rebuilding + +If you want to completely clear the existing setup and start again the following command will reset everything + +```bash +ddev stop --unlist devdocs && rm -rf .ddev && bash ddev-developer-docs.sh +``` + ## Automatic documentation generation (API-Reference) ### The first time diff --git a/ddev-developer-docs.sh b/ddev-developer-docs.sh new file mode 100644 index 000000000..ea2afc9ea --- /dev/null +++ b/ddev-developer-docs.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +############################################################ +# Help # +############################################################ +Help() +{ + # Display Help + echo "DDEV setup script for Developer Documentation" + echo + echo "Syntax: scriptTemplate [-w|h]" + echo "options:" + echo "a Audit for security vulnerability advisories" + echo "h Print this Help." + echo +} + +Audit() +{ + ddev exec -d /var/www/html/app composer audit --locked 2> /dev/null +} + +while getopts ":b:ah" option; do + case $option in + a) # display security vulnerability advisories + Audit + exit;; + h) # display Help + Help + exit;; + esac +done + +# Setup ddev if it has not been done yet +if test -d .ddev; then + echo "DDEV already setup" +else + ddev config --project-name=devdocs --project-type=php --docroot="app/public" --php-version=8.2 \ + --webserver-type=apache-fpm --composer-version=2 --corepack-enable=false --xdebug-enabled=false +fi + +ddev start +ddev exec -d /var/www/html/app composer install +if test -d app/tmp/cache; then + echo "Cache directory already created" +else + ddev exec -d /var/www/html/app mkdir tmp/cache +fi + +if test -d app/tmp/templates; then + echo "Template directory already created" +else + ddev exec -d /var/www/html/app mkdir tmp/templates +fi + +Audit