smalot/drupal-console-build

向Drupal Console暴露新命令,以使用配置文件运行构建。

v0.2 2017-02-23 09:46 UTC

This package is not auto-updated.

Last update: 2024-09-14 20:45:52 UTC


README

Drupal Console暴露新命令,以使用配置文件运行构建。

Latest Stable Version Latest Unstable Version License composer.lock

Total Downloads Monthly Downloads Daily Downloads

设置

将此库包含到您的Drupal项目中

composer require "smalot/drupal-console-build:*"

必须在您的settings.yml文件中添加。

services:
  console.deploy_run:
    class: Smalot\Drupal\Console\Build\Command\RunCommand
    arguments: []
    tags:
      - { name: drupal.command }

  console.deploy_list:
    class: Smalot\Drupal\Console\Build\Command\ListCommand
    arguments: []
    tags:
      - { name: drupal.command }

示例配置文件

文件:.build.yml应位于与.git/相同的文件夹级别。

# List stages enabled
stages:
    - compile
    - cache
    - features

# Commands section
compile_css:
    stage: compile
    script:
        - echo "Compile SASS file into CSS"
        - compass build
    allow_failure: true

cache_rebuild:
    stage: cache
    script:
        - echo "Cache Rebuild"
        - cd web && drush cache-rebuild

features_revert:
    stage: features
    script:
        - echo "Features revert all"
        - cd web && drush fra -y
    except:
        - master

设置

stages允许将命令分组并在处理过程中对它们进行排序。如果指定了stages条目,则没有指定stage属性的命令将不会运行。

onlyexcept都接受正则表达式模式(必须用反斜杠/包围)。您不能同时指定onlyexcept

command:
    only:
        - "/^fix-.*$/i"

allow_failure将报告有错误的命令,但不会停止后续命令。否则,整个构建将在第一条命令行错误时停止。

用法

运行所有任务

drupal build:run

运行一个阶段的全部任务

drupal build:run --stage=cache

运行特定的任务

drupal build:run compile_css cache_rebuild