cargo-version-sync 0.0.1

Cargo subcommand for keeping the version numbers in sync with Cargo.toml
Documentation

cargo-version-sync

Crates.io Docs.rs Build Status

Cargo subcommand for keeping the version numbers in sync with Cargo.toml

Status

Exeperimental

Installation

$ cargo install cargo-version-sync

Usage

  1. Add fields to Cargo.toml for specifying files to rewrite the version numbers by cargo version-sync:
[[package.metadata.version-sync.replacements]]
file = "README.md"
patterns = [
  { search = "https://deps.rs/crate/tsukuyomi/[a-z0-9\\.-]+", replace = "https://deps.rs/crate/tsukuyomi/{{version}}" },
]
  1. Run cargo-version-sync to rewrite version numbers:
$ cargo version-sync [--verbose] [--dry-run]

Working with custom Git hooks

[dev-dependencies.cargo-husky]
version = "1"
default-features = false
features = ["user-hooks"]

in .cargo-husky/hooks/pre-commit:

#!/bin/bash

set -e

if cargo fmt --version >/dev/null 2>&1; then
    (set -x; cargo fmt -- --check)
fi

if cargo version-sync --version >/dev/null 2>&1; then
    (set -x; cargo version-sync --check)
fi

Working with cargo test

in tests/version_sync.rs:

extern crate cargo_version_sync;

#[test]
fn test_version_sync() {
    cargo_version_sync::assert_sync();
}

Alternatives

License

MIT license