All Projects → mgeisler → version-sync

mgeisler / version-sync

Licence: MIT license
Keep version numbers in sync with Cargo.toml

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to version-sync

Fig
A minimalist Go configuration library
Stars: ✭ 142 (+118.46%)
Mutual labels:  toml
Config
📝 Go config manage(load,get,set). support JSON, YAML, TOML, INI, HCL, ENV and Flags. Multi file load, data override merge, parse ENV var. Go应用配置加载管理,支持多种格式,多文件加载,远程文件加载,支持数据合并,解析环境变量名
Stars: ✭ 225 (+246.15%)
Mutual labels:  toml
minver
What are the minimum dependencies for your package?
Stars: ✭ 18 (-72.31%)
Mutual labels:  versioning
Toml
A PHP parser for TOML
Stars: ✭ 152 (+133.85%)
Mutual labels:  toml
Awesome Cms
📚 A collection of open and closed source Content Management Systems (CMS) for your perusal.
Stars: ✭ 2,498 (+3743.08%)
Mutual labels:  toml
Joshuto
ranger-like terminal file manager written in Rust
Stars: ✭ 224 (+244.62%)
Mutual labels:  toml
Taplo
A TOML toolkit written in Rust
Stars: ✭ 136 (+109.23%)
Mutual labels:  toml
speckle-blender
speckle.systems/tag/blender/
Stars: ✭ 38 (-41.54%)
Mutual labels:  versioning
Tomlc99
TOML C library
Stars: ✭ 216 (+232.31%)
Mutual labels:  toml
tomlrb
A Racc based TOML parser
Stars: ✭ 63 (-3.08%)
Mutual labels:  toml
Simple Settings
A simple way to manage your project settings.
Stars: ✭ 165 (+153.85%)
Mutual labels:  toml
Python Benedict
dict subclass with keylist/keypath support, I/O shortcuts (base64, csv, json, pickle, plist, query-string, toml, xml, yaml) and many utilities. 📘
Stars: ✭ 204 (+213.85%)
Mutual labels:  toml
Cli
A simple, fast, and fun package for building command line apps in Go
Stars: ✭ 16,995 (+26046.15%)
Mutual labels:  toml
Tinytoml
A header only C++11 library for parsing TOML
Stars: ✭ 153 (+135.38%)
Mutual labels:  toml
serdepp
c++ serialize and deserialize adaptor library like rust serde.rs
Stars: ✭ 70 (+7.69%)
Mutual labels:  toml
Rq
Record Query - A tool for doing record analysis and transformation
Stars: ✭ 1,808 (+2681.54%)
Mutual labels:  toml
Konf
A type-safe cascading configuration library for Kotlin/Java/Android, supporting most configuration formats
Stars: ✭ 225 (+246.15%)
Mutual labels:  toml
dssg
A static site generator with a different approach
Stars: ✭ 15 (-76.92%)
Mutual labels:  toml
git-version-bumper
Bump your git tag to the next version, easily. 👊
Stars: ✭ 92 (+41.54%)
Mutual labels:  versioning
tomlcheck
A syntax checker for TOML files
Stars: ✭ 28 (-56.92%)
Mutual labels:  toml

Keep your Version Numbers in Sync with Cargo.toml

Rust projects typically reference the crate version number in several places, such as the README.md file. The version-sync crate makes it easy to add an integration test that checks that README.md is updated when the crate version changes.

Usage

Add this to your Cargo.toml:

[dev-dependencies]
version-sync = "0.9"

Then create a tests/version-numbers.rs file with:

#[test]
fn test_readme_deps() {
    version_sync::assert_markdown_deps_updated!("README.md");
}

#[test]
fn test_html_root_url() {
    version_sync::assert_html_root_url_updated!("src/lib.rs");
}

This integration test will ensure that the dependencies mentioned in your README.md file are kept in sync with your crate version and that your html_root_url points to the correct documentation on docs.rs. If everything is well, the test passes:

$ cargo test
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/version_numbers-504f17c82f1defea

running 2 tests
test test_readme_deps ... ok
test test_html_root_url ... ok

test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured

If the README or html_root_url is out of sync with the crate version, the tests fail. In this example, the crate is called your-crate and the version number in Cargo.toml has been changed to 0.2.0 while the README.md and html_root_url still use 0.1.2. The tests now fail and the problematic TOML code and attribute are shown:

$ cargo test
    Finished debug [unoptimized + debuginfo] target(s) in 0.0 secs
     Running target/debug/deps/version_numbers-f399bac3e468d035

running 2 tests
test test_readme_deps ... FAILED
test test_html_root_url ... FAILED

failures:

---- test_readme_deps stdout ----
	Checking code blocks in README.md...
README.md (line 20) ... expected minor version 2, found 1 in
    [dev-dependencies]
    your-crate = "0.1"

thread 'test_readme_deps' panicked at 'dependency errors in README.md', tests/version-numbers.rs:6
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- test_html_root_url stdout ----
	Checking doc attributes in src/lib.rs...
src/lib.rs ... expected minor version 2, found 1 in
    #![doc(html_root_url = "https://docs.rs/your-crate/0.1.2")]

thread 'test_html_root_url' panicked at 'html_root_url errors in src/lib.rs', tests/version-numbers.rs:11


failures:
    test_html_root_url
    test_readme_deps

test result: FAILED. 0 passed; 2 failed; 0 ignored; 0 measured

error: test failed

Excluding TOML Code

You can add no_sync to the language line in a code block to exclude it from the checks done by assert_markdown_deps_updated!:

```toml,no_sync
[dependencies]
your_crate = "0.1.2"
```

Release History

This is a changelog describing the most important changes per release.

Version 0.9.4 — 2021-12-14

  • #114: Move from deprecated the semver-parser crate to semver.
  • #115: Expand assert_markdown_deps_updated! to also check version numbers such as =1.2.3, >1.2.3, and >=1.2.3.
  • #119: Add new assert_only_contains_regex! macro which can ensure that all version numbers in a file are updated.

Version 0.9.3 — 2021-09-20

  • #108: Make all dependencies optional. Thanks @rlee287!
  • #109: Forbid the use of unsafe code.
  • #110: Add simple check_contains_version function.

Version 0.9.2 — 2021-02-13

  • #94: Update pulldown-cmark to 0.8.
  • #95: Fix non_fmt_panic lint error in latest nightly.
  • #100: Setup weekly build to catch errors on nightly Rust.
  • #101: Forbid warnings when building in CI.

Version 0.9.1 — 2020-07-07

  • #91: Pull in fewer dependencies. This optimizes the build time by 1-2 seconds.
  • #92: Normalize \r\n to \n to ensure ^ and $ always match line boundaries.

Version 0.9.0 — 2020-03-30

Drop support for Rust 1.31.0 since our dependencies keep releasing new patch versions that push up the minimum required Rust version. These updates mean that version-sync 0.8.1 no longer compiles with Rust 1.31.0 because cargo sync will pull in too new versions of the direct and transitive dependencies. This happens even if there are no changes in version-sync.

The constant build failures in our CI makes it infeasible to keep version-sync compatible with any particular version of Rust. We will therefore track the latest stable version of Rust from now on.

At the time of writing, the code compiles with Rust 1.36, but this will likely become outdated soon.

Issues closed:

  • #83: version-sync fails to parse TOML blocks when inside blockquotes
  • #84: Release update to crates.io with syn 1.0

Version 0.8.1 — 2019-04-03

Dependencies were relaxed to make it easier to upgrade version-sync.

Version 0.8.0 — 2019-03-28

We now use Rust 2018, which means we require Rust version 1.31.0 or later. The assert_html_root_url_updated! macro will again report accurate line numbers based on span information from the syn crate.

Version 0.7.0 — 2019-01-14

Special characters are now correctly escaped in the {name} and {version} placeholders in assert_contains_regex!.

Dependencies were updated and version-sync now requires Rust version 1.27.2 or later.

Version 0.6.0 — 2018-11-22

You can use assert_contains_regex! to grep files for the current version number. The search is done with a regular expression where {version} is replaced with the current version number.

Git dependencies are now always accepted, which means that blocks like

```toml
[dependencies]
your_crate = { git = "..." }
```

will work without you having to add no_sync.

Issues closed:

  • #17: Allow to check non-markdown sources
  • #39: Version 0.5 requires Rust version 1.21.0
  • #42: Handle Git dependencies

Version 0.5.0 — 2017-11-19

Dependencies were updated and version-sync now requires Rust version 1.21 or later.

Error messages from assert_html_root_url_updated! now again include line numbers (based on a heuristic until the syn crate can provide the information).

Version 0.4.0 — 2017-11-01

This release replaces the dependency on the abandoned syntex_syntax with with a dependency on the much lighter syn crate. This improves compilation speed. Unfortunately, the syn crate does not provide information about line numbers, so error messages are are no longer as good. We might be able to work around that in a later version.

Version 0.3.1 — 2017-09-26

This release fixes a small problem with the handling of pre-release identifiers.

Issues closed:

  • #19: Pre-release identifiers were ignored.

Version 0.3.0 — 2017-09-23

When checking dependencies in READMEs, TOML blocks can now be excluded from the check by adding no_sync to the language line:

```toml,no_sync
[dependencies]
your_crate = "0.1"
```

This TOML block will not be checked. This is similar to no_run for Rust code blocks.

Version 0.2.0 — 2017-09-20

Added assert_html_root_url_updated! which will check that the html_root_url attribute points to the correct version of the crate documentation on docs.rs.

Version 0.1.3 — 2017-09-18

First public release with support for finding outdated version numbers in dependencies and dev-dependencies.

Versions 0.1.0 to 0.1.2 were released under the name check-versions.

License

Version-sync can be distributed according to the MIT license. Contributions will be accepted under the same license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].