18 个不稳定版本 (3 个破坏性更新)
| 0.5.9 | 2020年9月11日 | 
|---|---|
| 0.5.8 | 2020年8月12日 | 
| 0.4.4 | 2020年8月11日 | 
| 0.3.1 | 2020年8月8日 | 
| 0.2.1 | 2020年8月8日 | 
#591 在 Cargo 插件
每月50次 下载
27KB
519 行
Rust 包版本管理器 (CVM)
包版本管理器 (CVM) 帮助在 git 分支之间维护包版本,可以被 CI 工作流程使用以确保 rust 包版本是最新的。
CVM 会检查当前的 Cargo.toml 文件中的 package 和 workspace.members,遍历工作空间中的所有包,检查工作空间的 src/ 目录是否发生变化,然后检查版本是否与目标分支相比有所更改,默认为目标 master 分支。
如果版本与目标分支相比没有递增,并且源文件已经发生变化,那么 CVM 将会向终端打印警告或引发恐慌。
先决条件
- Rust 工具链
- Git ^2.22.0
安装
cargo install cargo-cvm
入门
cargo cvm --help
cargo-cvm-cvm 
USAGE:
    cargo-cvm cvm [FLAGS] [OPTIONS]
FLAGS:
    -x, --check      Panic if the versions are out-of-date
    -c, --commit     git commit updated version(s), otherwise will only add the files to git. Can only be used with
                     --fix or --force flags
    -f, --fix        Automatically fix the version if it is outdated. By default, this will bump the minor version,
                     unless otherwise specified by the --semver option
    -F, --force      Force a version bump. Can use be used with --semver option to determine version type
    -h, --help       Prints help information
    -V, --version    Prints version information
    -w, --warn       Warn if the versions are out-of-date
OPTIONS:
    -b, --branch <branch>      Which branch to compare to the current. Will attempt to find the version in the target
                               branch and check if the version has been bumped or not.
    -r, --remote <remote>      Determine which remote to use for the target branch. Defaults to `origin`.
    -s, --semver <semver>      Type of Semantic Versioning; i.e. `minor`, `major`, or `patch`. Defaults to `minor`
    -k, --ssh-key <ssh-key>    Provide the path to your ssh private key for authenticating against remote git hosts.
                               Defaults to $HOME/.ssh/id_rsa
版本检查
cargo cvm --check
此命令如果工作空间的版本过时,将会引发 panic!。
增加版本
cargo cvm --fix --semver [major, minor, patch]
此命令根据提供的语义版本类型(例如 major、minor 或 patch)增加包的语义版本。默认情况下,版本更新使用 minor。
当在已经是最新的包版本上运行 cargo cvm -f 时,它不会有任何影响。
注意:如果您在一个包含多个过时成员的工作空间中运行此命令,它将在所有包上应用相同的语义版本类型,这可能是不正确的。
如果您想要增加多个不是相同语义版本类型的版本,例如次要版本,那么在包目录内运行此命令是最好的。
强制版本增加
cargo cvm --force --semver [major, minor, patch]
cargo cvm -F 将强制更新版本,即使工作空间有最新的版本。
警告过时版本
cargo cvm --warn
类似于 cargo cvm -x,这个命令会在版本过时时打印错误,但在这个情况下,当crate过时时,命令不会 panic!。
比较目标分支
cargo cvm --branch <target-branch>
默认情况下,CVM比较的是master分支。但是,使用--branch或-b标志,您可以指定要比较版本的目标分支。
依赖项
~12–22MB
~373K SLoC