Adding commands can help with productivity and to standardise tasks.
Information on writing commands can be found here
There are also a number of default commands available that may already provide the functionality you require.
If not, here are some example that might be a good starting point.
Note: If someone clones the project repository as a different name than what's in workspace.yml for
workspace('projectname')
, docker-compose commands will fail due to using the directory name by default.
The way around this is to ensure you include the COMPOSE_PROJECT_NAME
environment variable any time
you use docker-compose
from within a custom command.
command('drupal-refresh'): |
#!bash(workspace:/)|@
echo "Running drupal-refresh"
ws composer install
ws drush -y cr
ws drush -y updb
ws frontend install
command('sanitise-db'): |
#!bash|=
echo "Running sanitise-db"
ws drush sql-sanitize --sanitize-password=password -y
ws drush uublk 1
ws drush uli
command('import-db <alias> <database>'):
env:
ALIAS: = input.argument('alias')
DB_FILE: = input.argument('database')
exec: |
#!bash(workspace:/)|=
ws drush ${ALIAS} "sqlc < $DB_FILE"