PHP 的类似 Make 的构建工具。一个简单现代的任务运行器。

v0.1 2019-10-31 15:57 UTC

This package is auto-updated.

Last update: 2024-08-29 05:24:36 UTC


README

Pake 是一个简单的任务运行器。

Pake 是用 PHP 实现的类似 Make 的程序。
任务和依赖关系使用标准 PHP 语法指定。

Pakefile(pake 的 Makefile 版本)完全使用标准 PHP 语法定义。

安装

以下命令要求您全局安装 Composer。打开命令行,进入您的项目目录,并执行以下命令以下载最新稳定版本

composer require --dev roukmoute/pake

使用方法

示例

首先,您必须编写一个 Pakefile 文件,其中包含构建规则。
这里是一个简单的示例

<?php

use PhpCsFixer\Console\Application;
use Symfony\Component\Console\Input\ArrayInput;

task(
    'default',
    function () {
        return ['fix'];
    }
);

desc('PHP Coding Standards Fixer');
task(
    'fix',
    function () {
        $application = new Application();
        $application->setAutoExit(false);
        $application->run(new ArrayInput(['fix']));
    }
);

此 Pakefile 有两个任务

  • 名为 fix 的任务,在调用时将修复您的代码以遵循 PHP 中的标准
▶ php ./vendor/bin/pake fix
  • 名为 default 的任务。此任务本身不执行任何操作,但它恰好有一个依赖项,即 fix 任务。
    调用 default 任务将导致 Pake 同时调用 fix 任务。

在不带任何选项的情况下运行 pake 命令将导致它在 Pakefile 中运行 default 任务。

▶ php ./vendor/bin/pake
Loaded config default from ".php_cs.dist".
Using cache file ".php_cs.cache".

输入 --help 查看所有可用选项。