Skip to content

Latest commit

 

History

History
171 lines (146 loc) · 9.11 KB

commands.rst

File metadata and controls

171 lines (146 loc) · 9.11 KB

Commands

To list all available tasks, please run:

docker-composer exec web ./vendor/bin/run

See bellow current list of available commands:

Available commands:
  completion                        Dump the shell completion script
  config                            Dumps the current or given configuration.
  help                              Display help for a command
  list                              List commands
 docker
  docker:refresh-configuration      [dk-rc] Update docker-compose.yml file based on project's configurations.
 drupal
  drupal:config-import              Run the Drupal config import.
  drupal:disable-cache              Disable aggregation and clear cache.
  drupal:drush-setup                Write Drush configuration file at "${drupal.root}/drush/drush.yml".
  drupal:permissions-setup          Setup Drupal permissions.
  drupal:settings-setup             Setup Drupal settings.php file in compliance with Toolkit conventions.
  drupal:site-install               [drupal:si|dsi] Install target site.
  drupal:site-post-install          Run Drupal post-install commands.
  drupal:site-pre-install           Run Drupal pre-install commands.
  drupal:symlink-project            Symlink project as module, theme or profile in the proper directory.
  drupal:upgrade-status             [tdus] Check project compatibility for Drupal 9/10 upgrade.
 toolkit
  toolkit:build-assets              [tba|tk-assets] Build theme assets (Css and Js).
  toolkit:build-dev                 [tk-bdev] Build site for local development.
  toolkit:build-dev-reset           Build site for local development from scratch with a clean git.
  toolkit:build-dist                [tk-bdist] Build the distribution package.
  toolkit:check-phpcs-requirements  Make sure that the config file exists and configuration is correct.
  toolkit:check-version             Check the Toolkit version.
  toolkit:code-review               This command will execute all the testing tools.
  toolkit:complock-check            Check if 'composer.lock' exists on the project root folder.
  toolkit:component-check           Check composer.json for components that are not whitelisted/blacklisted.
  toolkit:create-dump               Export the local snapshot.
  toolkit:download-dump             Download ASDA snapshot.
  toolkit:fix-permissions           Run script to fix permissions (experimental).
  toolkit:hooks-delete-all          Remove all existing hooks, this will ignore active hooks list.
  toolkit:hooks-disable             Disable the git hooks.
  toolkit:hooks-enable              Enable the git hooks defined in the configuration or in given option.
  toolkit:hooks-list                List available hooks and its status.
  toolkit:hooks-run                 Run a specific hook.
  toolkit:import-config             [DEPRECATED] Run the Drupal config import.
  toolkit:install-clean             [tk-iclean] Install a clean website.
  toolkit:install-clone             [tk-iclone] Install a clone website.
  toolkit:install-dependencies      Install packages present in the opts.yml file under extra_pkgs section.
  toolkit:install-dump              Import the production snapshot.
  toolkit:lint-js                   [tljs|tk-js] Run lint JS.
  toolkit:lint-php                  [tlp|tk-php] Run lint PHP.
  toolkit:lint-yaml                 [tly|tk-yaml] Run lint YAML.
  toolkit:opts-review               Check project's .opts.yml file for forbidden commands.
  toolkit:requirements              Check the Toolkit Requirements.
  toolkit:run-blackfire             [tbf|tk-bfire] Run Blackfire.
  toolkit:run-deploy                Run deployment sequence.
  toolkit:run-phpcbf                [tk-phpcbf] Run PHP code autofixing.
  toolkit:setup-behat               Setup the Behat file.
  toolkit:setup-blackfire-behat     Copy the needed resources to run Behat with Blackfire.
  toolkit:setup-eslint              Setup the ESLint configurations and dependencies.
  toolkit:setup-phpcs               Setup PHP code sniffer.
  toolkit:setup-phpunit             Setup the PHPUnit file.
  toolkit:test-behat                [tb|tk-behat] Run Behat tests.
  toolkit:test-phpcs                [tk-phpcs] Run PHP code sniffer.
  toolkit:test-phpmd                [tk-phpmd] Run PHPMD.
  toolkit:test-phpstan              [tk-phpstan] Run PHPStan.
  toolkit:test-phpunit              [tp|tk-phpunit] Run PHPUnit tests.
  toolkit:vendor-list               Check 'Vendor' packages being monitored.

Creating custom commands

To provide custom commands, make sure that your classes are loaded, for example using PSR-4 namespacing set the autoload in the composer.json file.

{
  "autoload": {
    "psr-4": {
      "My\\Project\\": "./src/"
    }
  }
}

Create your command class under src/TaskRunner/Commands that will extend the abstract Toolkit command, like:

<?php

namespace My\Project\TaskRunner\Commands;

use EcEuropa\Toolkit\TaskRunner\AbstractCommands;

class ExampleCommands extends AbstractCommands {
  /**
   * @command example:first-command
   */
  public function commandOne() { }
}

Creating configuration commands

Configuration commands are created in the configuration file runner.yml, like shown below:

commands:
  drupal:setup-test:
    - { task: process, source: behat.yml.dist, destination: behat.yml }

  drupal:setup-test2:
    aliases: test
    description: 'Setup the behat file'
    help: 'Some help text'
    hidden: false
    usage: '--simulate'
    tasks:
      - { task: process, source: behat.yml.dist, destination: behat.yml }

The configuration commands are a mapping to the Robo Tasks, the list of available tasks is:

Task Robo Task
mkdir FilesystemStack
touch FilesystemStack
copy FilesystemStack
copyDir FilesystemStack
chmod FilesystemStack
chgrp FilesystemStack
chown FilesystemStack
remove FilesystemStack
rename FilesystemStack
symlink FilesystemStack
mirror FilesystemStack
process Process
append Write with append()
run Executes a Runner task
exec Exec
drush Executes a Drush command
replace-block ReplaceBlock