cargo-version-sync
Cargo subcommand for keeping the version numbers in sync with Cargo.toml
Status
Experimental
Installation
$ cargo install cargo-version-sync
Usage
At first, add fields to Cargo.toml
for specifying files to rewrite the version numbers by cargo version-sync
:
[[]]
= "README.md"
= [
{ = "builtin", = "markdown" },
{ = "regex", = "https://deps.rs/crate/{{name}}/[a-z0-9\\.-]+", = "https://deps.rs/crate/{{name}}/{{version}}" },
]
[[]]
= "src/lib.rs"
= [
{ = "builtin", = "html-root-url" },
]
Then run the command cargo version-sync
to rewrite version numbers:
$ cargo version-sync
Integration test
cargo-version-sync
can also be used as a library used in integration tests.
First, add the dependency to the member of [dev-dependencies]
:
[]
= { = "0.0.2", = false }
Then, add a test case in your integration test as follows:
extern crate cargo_version_sync;
When there are some files that have not updated the version numbers, the integration test fails as follows:
$ cargo test
...
running 1 test
test test_version_sync ... FAILED
failures:
---- test_version_sync stdout ----
The version number(s) are not synced in the following files:
- README.md
...