Skip to content

ddev script for developer docs #812

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: live
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.DS_Store
.ddev
/generator/vendor
/generator/composer.phar
/app/vendor
Expand Down
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
56 changes: 56 additions & 0 deletions ddev-developer-docs.sh
Original file line number Diff line number Diff line change
@@ -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