定制 enuage/version-updater 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

enuage/version-updater

Composer 安装命令:

composer require enuage/version-updater

包简介

The tool for version updating

关键字:

README 文档

README

Packagist Packagist

Requirements

  • PHP >= 7.1.3
  • Symfony is optional

Installation

Applications that don't use Symfony at all

Step 1: Download the library

Open a command console, enter your project directory and execute:

$ composer require enuage/version-updater

Step 2: Use the command for version updating from vendor/bin

$ php vendor/bin/version-updater [options] [--] [<version>]

Applications that use Symfony Flex

Open a command console, enter your project directory and execute:

$ composer require enuage/version-updater

Applications that don't use Symfony Flex

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require version-updater

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the Bundle

Then, enable the bundle by adding it to the list of registered bundles in the app/AppKernel.php file of your project:

<?php
// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new Enuage\VersionUpdaterBundle\VersionUpdaterBundle(),
        );
        // ...
    }
    // ...
}

Usage

Option 1: Updating files via command line

Step 1: Define files and regular expression for version updating

Use \V for define the version in regular expression. It will be replaced with the SemVer regular expression

New in version 1.2.0: you can easily define property of the json file which should be updated - just add file path and path to the property delimited by slash under json configuration in following format: path-to/file: property/path

New in version 1.3.0: you can easily define property of the yaml file which should be updated - just add file path and path to the property delimited by slash under yaml configuration in following format: path-to/file: property/path

New in version 1.5.4: custom commit and tag (release) messages

Example:

files:
  - '.env': '/^(API_VERSION=)\V/m'
  - 'README.md': '/^(Version:\s)\V/m'
json:
  - composer: version                 # File: <project>/composer.json
  - doc/api: info/version             # File <project>/doc/api.json
yaml:
  - doc/api: info/version             # File <project>/doc/api.yaml
git:
  enabled: true # Optional parameter. You can disable Git operations without removing its configuration
  source: true # The latest tag will be got from Git history
  push: true # Push tag to repository after its creation
  prefix: v # Tag prefix. Empty by default
  message:
    commit: 'Your custom commit message (\V)' # If you want, you can use \V to define the place for version string
    release: 'Your custom release message'

Step 2: Use the command for version updating

$ php bin/console enuage:version:update [options] [--] [<version>]

Available options

  • --major: Increase only major version
  • --minor: Increase only minor version
  • --patch: Increase only patch version
  • --alpha: Increase or define the alpha version
  • --beta: Increase or define the beta version
  • --rc: Increase or define the release candidate version
  • --down: Decrease defined version. It's also applicable to prerelease versions
  • --release: Remove all prerelease versions
  • --date <none|PHP date format>: Add date metadata to the version. By default date format is equal to c
  • --meta <data>: Add metadata to the version
  • --config-file <string>: Path to configurations file or to directory with .enuage configuration file
  • --colors <boolean>: Enable/disable colors in output. Default - true
  • --show-current <string|boolean>: Show current version from file or from all available sources. Currently supported sources:
    • composer
    • Git repository (if enabled)
  • --exclude-git: Disable updating Git repository
  • --print-version-only: Hide all messages and print only new version when script job will be finished. Messages can be displayed again with increased verbosity level (-v)

Option 2: Updating version via service

Example:

use Enuage\VersionUpdaterBundle\DTO\VersionOptions;
use Symfony\Component\DependencyInjection\Container;
// use Enuage\VersionUpdaterBundle\Service\VersionService;

$version = '0.1.0-alpha.2';

$service = $container->get('enuage.version.service');
// $service = VersionService(); // If you don't use Symfony
$options = new VersionOptions();

$options->increasePreRelease();

$service->update($version, $options); // Result: "0.1.0-alpha.3"

Available methods

  • addDateMeta(format = null): Enable date meta in provided format or 'c' by default
  • addMeta(value = null): Add custom meta to the tag
  • increaseMajor(): Enable major version increase
  • decreaseMajor(): Disable major version increase
  • increaseMinor(): Enable minor version increase
  • decreaseMinor(): Disable minor version increase
  • increasePatch(): Enable patch version increase
  • decreasePatch(): Disable patch version increase
  • updateAlpha(): Enable pre-release version alpha modifications
  • updateBeta(): Enable pre-release version beta modifications
  • updateReleaseCandidate(): Enable pre-release version rc modifications
  • increasePreRelease(): Increase pre-release version (e.g: 0.1.0-alpha.2 -> 0.1.0-alpha.3)
  • decreasePreRelease(): Decrease pre-release version (e.g: 0.1.0-alpha.2 -> 0.1.0-alpha.1)
  • setVersion(): Set custom version value
  • downgrade(): Downgrade the version, including pre-release
  • release(): Disable all pre-release postfixes

enuage/version-updater 适用场景与选型建议

enuage/version-updater 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 31 次下载、GitHub Stars 达 1, 最近一次更新时间为 2018 年 12 月 02 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「enuage」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 enuage/version-updater 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 enuage/version-updater 我们能提供哪些服务?
定制开发 / 二次开发

基于 enuage/version-updater 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 31
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2018-12-02