ixnode/bash-version-manager
Composer 安装命令:
composer require ixnode/bash-version-manager
包简介
Bash Version Manager
README 文档
README
This tool helps you to maintain the versions in the current path. It increments the patch, minor or major version and replaces them in the corresponding files.
Create new VERSION file
The VERSION file is used as the source for the version number. A missing file can be created
automatically.
❯ bin/version-manager --current [2022-01-16 16:51:41] (error) → Version file "~/ixno/bash-version-manager/VERSION" not found. Do you want to create a version file "VERSION" with version "0.1.0"? y [2022-01-16 16:51:43] (error) → Version file "~/ixno/bash-version-manager/VERSION" successfully created.
Optional: Create .env file
Currently, the variable VERSION_APP can be replaced in the .env file:
❯ cat <<EOT >> .env # Version of this app VERSION_APP=$(cat VERSION) # Version of this app VERSION_APP_LATEST=latest EOT
Show current version
If you want to see the current version, use the following command.
❯ bin/version-manager --current Current version: 0.1.0 Next major version: 1.0.0 (Use bin/version-manager --major) Next minor version: 0.2.0 (Use bin/version-manager --minor) Next patch version: 0.1.1 (Use bin/version-manager --patch)
Switch patch version
To change the patch version use the flag --patch.
❯ bin/version-manager --patch Current version: 0.1.0 New version: 0.1.1 Do you want to set the new version "0.1.1" (y/n)? y [2022-01-16 16:57:46] (info) → Set version "0.1.1" to "~/ixno/bash-version-manager/VERSION" [2022-01-16 16:57:46] (success) → Done. [2022-01-16 16:57:46] (info) → Set version "0.1.1" to "~/ixno/bash-version-manager/.env" [2022-01-16 16:57:46] (success) → Done.
Switch minor version
To change the minor version use the flag --minor.
❯ bin/version-manager --minor Current version: 0.1.0 New version: 0.2.0 Do you want to set the new version "0.2.0" (y/n)? y [2022-01-16 16:58:32] (info) → Set version "0.2.0" to "~/ixno/bash-version-manager/VERSION" [2022-01-16 16:58:32] (success) → Done. [2022-01-16 16:58:32] (info) → Set version "0.2.0" to "~/ixno/bash-version-manager/.env" [2022-01-16 16:58:32] (success) → Done.
Switch major version
To change the major version use the flag --major.
❯ bin/version-manager --major Current version: 0.1.0 New version: 1.0.0 Do you want to set the new version "1.0.0" (y/n)? y [2022-01-16 16:59:06] (info) → Set version "1.0.0" to "~/ixno/bash-version-manager/VERSION" [2022-01-16 16:59:06] (success) → Done. [2022-01-16 16:59:06] (info) → Set version "1.0.0" to "~/ixno/bash-version-manager/.env" [2022-01-16 16:59:06] (success) → Done.
Switch to given version
A custom version (e.g. 1.2.3) for changing versions can be specified as a parameter.
❯ bin/version-manager 1.2.3 Current version: 0.1.0 New version: 1.2.3 Do you want to set the new version "1.2.3" (y/n)? y [2022-01-16 18:11:41] (info) → Set version "1.2.3" to "/home/bjoern/Development/ixno/bash-version-manager/VERSION" [2022-01-16 18:11:41] (success) → Done. [2022-01-16 18:11:41] (info) → Set version "1.2.3" to "/home/bjoern/Development/ixno/bash-version-manager/.env" [2022-01-16 18:11:41] (success) → Done.
Use another working directory
Usually the tool uses the current working directory. This can be changed.
❯ bin/version-manager --working-dir test --current
Current version: 0.2.1
Next major version: 1.0.0 (Use bin/version-manager --major)
Next minor version: 0.3.0 (Use bin/version-manager --minor)
Next patch version: 0.2.2 (Use bin/version-manager --patch)
Show help
Shows the parameters and arguments of the tool.
❯ bin/version-manager --help version-manager 0.1.0 (2022-01-16) - Björn Hempel <bjoern@hempel.li> Usage: version-manager [...options] [version] -c, --current Shows the current version. -X, --major Will increase the major version (x.0.0). -m, --minor Will increase the minor version (0.x.0). -p, --patch Will increase the patch version (0.0.x). -w, --working-dir Sets the current working-dir (default: "~/ixno/bash-version-manager") -s, --show-hints Shows some hints. -h, --help Shows this help. -V, --version Shows the version number.
Show git hints
Shows some useful commands for committing to the Git repository.
❯ bin/version-manager --show-hints Now you can do the following: → Edit your CHANGELOG.md file ❯ vi CHANGELOG.md → Usually version changes are set in the main or master branch ❯ git checkout main && git pull → Commit your changes to your repo ❯ git add CHANGELOG.md && git commit -m "Add version $(cat VERSION)" && git push → Tag your version ❯ git tag -a "$(cat VERSION)" -m "Version $(cat VERSION)" && git push origin "$(cat VERSION)"
Use with PHP Composer
composer require --dev ixnode/bash-version-manager
vendor/bin/version-manager --version
version-manager 0.1.2 (2022-12-18) - Björn Hempel <bjoern@hempel.li>
Version class usage
use Ixnode\BashVersionManager\Version;
$versionArray = (new Version())->getAll();
Execute tests
If you want to make changes, the test mode helps to check the current changes. Test mode uses the files in the test folder:
.env(source file).env.major(comparison file with major change).env.minor(comparison file with minor change).env.patch(comparison file with patch change)VERSION(source file)VERSION.major(comparison file with major change)VERSION.minor(comparison file with minor change)VERSION.patch(comparison file with patch change)
bin/version-manager --test
[2022-01-16 16:50:57] (info) → The sha1 keys match (major). [2022-01-16 16:50:57] (info) → The sha1 keys match (major). [2022-01-16 16:50:57] (info) → The sha1 keys match (minor). [2022-01-16 16:50:57] (info) → The sha1 keys match (minor). [2022-01-16 16:50:57] (info) → The sha1 keys match (patch). [2022-01-16 16:50:57] (info) → The sha1 keys match (patch). [2022-01-16 16:50:57] (success) → All tests were completed successfully.
License
This tool is licensed under the MIT License - see the LICENSE.md file for details
ixnode/bash-version-manager 适用场景与选型建议
ixnode/bash-version-manager 是一款 基于 Shell 开发的 Composer 扩展包,目前已累计 1.04k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 12 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「manager」 「version」 「semver」 「versioning」 「semantic」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ixnode/bash-version-manager 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ixnode/bash-version-manager 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ixnode/bash-version-manager 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Semantic Versioning Parser and Comparator
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
Versioning behaviour for eloquent models
Converts SemVer version (like Composer packages) into integer version with operators. Helps managing versions: store, compare, sort and retrive by conditions.
A decent, standards-compliant, Semantic Versioning (SemVer) parser and library
Display a version number
统计信息
- 总下载量: 1.04k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 20
- 依赖项目数: 19
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-18