sitkoru/yii2-updater

Sitko.ru Yii2项目的更新器

dev-master 2017-08-28 10:36 UTC

This package is auto-updated.

Last update: 2024-08-29 04:08:28 UTC


README

添加

"sitkoru/yii2-updater": "dev-master"

到您的composer.json的require部分

在控制台应用配置中启用模块

    'modules'=>[
    ...
        'updater'   => [
            'class'           => \sitkoru\updater\Module::className(), //module class name
            'path'            => dirname(dirname(__DIR__)), //path to app
            'versionFilePath' => 'version.php', //path to file to store version. Include this file in your app.
            'currentVersion'  => defined('APP_VERSION') ? APP_VERSION : 0.0, //current version. If empty, updater will try to get it from versionFile
            'versionConstant' => 'APP_VERSION', //constant name to store version
            'releasePrefix'   => "origin/release-", //prefix to identify release branches in git
            'assetsCommands'  => [ //commands for publish assets
                "./yii asset/compress app/config/main.assets.php app/config/bundles.php" //for example
            ],
            'customCommands'  => [ //commands for custom operations, like starting daemons or something else
                "nodejs bin/chat.js" //for example
            ]
        ],
    ...
    ]

您可以在Module.php中看到其他选项

运行

./yii updater/release

并按照说明进行操作 =)

注意

更新器覆盖了yii的migrate函数,以标记带有应用版本的迁移。一些建议

  1. 不要在开发模式下使用 =)

  2. 不要在生产环境中使用 ./yii migrate

  3. 如果您需要手动应用迁移,请使用 ./yii updater/migrations/up 0 1.1(将1.1替换为实际版本)