andreas-weber/php-runner

用于简化复杂依赖任务实现的库。

1.2.0 2015-05-08 16:17 UTC

This package is not auto-updated.

Last update: 2024-09-14 15:52:54 UTC


README

Build Status

用于简化复杂依赖任务实现的库。

功能

  • 封装逻辑到不同的任务中,而不是编写乱糟糟的代码。
  • 通过链式任务运行器来描述任务之间的依赖关系。
  • 将有效载荷传递给任务运行器。有效载荷在任务之间传递。
  • 通过实现 unless() 方法,在运行时跳过单个任务。
  • 在每个任务上使用 setUp() 和 tearDown() 来准备和清理任务执行。
  • 在任务中调用 retry() 来使用任务运行器的重试处理。
  • 在任务中调用 skip() 来跳过任务处理。
  • 在任务中调用 fail() 来使整个任务运行失败。
  • 使用事件在任务运行期间挂钩自定义逻辑。

事件

此库具有内部事件系统,您可以在执行期间使用自定义钩子来响应。以下事件可用

  • runner.start
  • runner.success
  • runner.failure
  • runner.task.start
  • runner.task.success
  • runner.task.failure
  • runner.task.retry
  • runner.task.skip
  • runner.task.unless

需求

检查提供的 composer.json 文件。

安装

只需将 andreas-weber/php-runner 添加到项目的 Composer composer.json 文件中作为依赖项。

示例

开发者

环境

启动

vagrant up

进入虚拟机

vagrant ssh

运行测试

cd /vagrant
vendor/bin/phpunit src/Test/

构建目标

vagrant@andreas-weber:/vagrant$ ant
Buildfile: /vagrant/build.xml

help:
     [echo]
     [echo] The following commands are available:
     [echo]
     [echo] |   +++ Build +++
     [echo] |-- build                (Run the build)
     [echo] |   |-- dependencies     (Install dependencies)
     [echo] |   |-- tests            (Lint all files and run tests)
     [echo] |   |-- metrics          (Generate quality metrics)
     [echo] |-- cleanup              (Cleanup the build directory)
     [echo] |
     [echo] |   +++ Composer +++
     [echo] |-- composer             -> composer-download, composer-install
     [echo] |-- composer-download    (Downloads composer.phar to project)
     [echo] |-- composer-install     (Install all dependencies)
     [echo] |
     [echo] |   +++ Testing +++
     [echo] |-- phpunit              -> phpunit-full
     [echo] |-- phpunit-tests        (Run unit tests)
     [echo] |-- phpunit-full         (Run unit tests and generate code coverage report / logs)
     [echo] |
     [echo] |   +++ Metrics +++
     [echo] |-- coverage             (Show code coverage metric)
     [echo] |-- phploc               (Show lines of code metric)
     [echo] |-- qa                   (Run quality assurance tools)
     [echo] |-- |-- phpcpd           (Show copy paste metric)
     [echo] |-- |-- phpcs            (Show code sniffer metric)
     [echo] |-- |-- phpmd            (Show mess detector metric)
     [echo] |
     [echo] |   +++ Metric Reports +++
     [echo] |-- phploc-report        (Generate lines of code metric report)
     [echo] |-- phpcpd-report        (Generate copy paste metric report)
     [echo] |-- phpcs-report         (Generate code sniffer metric report)
     [echo] |-- phpmd-report         (Generate mess detector metric report)
     [echo] |
     [echo] |   +++ Tools +++
     [echo] |-- lint                 (Lint all php files)
     [echo]

思考

非常欢迎拉取请求。用爱构建。希望你会喜欢.. :-)