Skip to content

Latest commit

 

History

History
45 lines (38 loc) · 1.53 KB

commands.md

File metadata and controls

45 lines (38 loc) · 1.53 KB

Adding custom commands

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.

Refresh script - ws drupal-refresh

command('drupal-refresh'): |
  #!bash(workspace:/)|@
  echo "Running drupal-refresh"
  ws composer install
  ws drush -y cr
  ws drush -y updb
  ws frontend install

Sanitise the DB - ws sanitise-db

command('sanitise-db'): |
  #!bash|=
  echo "Running sanitise-db"
  ws drush sql-sanitize --sanitize-password=password -y
  ws drush uublk 1
  ws drush uli

Database import - ws import-db @drush.alias path/to/db.sql

command('import-db <alias> <database>'):
  env:
    ALIAS: = input.argument('alias')
    DB_FILE: = input.argument('database')
  exec: |
    #!bash(workspace:/)|=
    ws drush ${ALIAS} "sqlc < $DB_FILE"