From 5536361bcda29887ed86bb68e43d0b603cbc423f Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 23 Sep 2017 12:30:56 +0200 Subject: [PATCH 1/3] docs: sync README version numbers with crate version --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6a42faee0bf..42eecf66f92 100644 --- a/README.md +++ b/README.md @@ -472,7 +472,7 @@ For full usage, add `clap` as a dependency in your `Cargo.toml` () to use from c ```toml [dependencies] -clap = "~2.19.0" +clap = "~2.26" ``` (**note**: If you are concerned with supporting a minimum version of Rust that is *older* than the current stable Rust minus 2 stable releases, it's recommended to use the `~major.minor.patch` style versions in your `Cargo.toml` which will only update the patch version automatically. For more information see the [Compatibility Policy](#compatibility-policy)) @@ -495,7 +495,7 @@ To disable these, add this to your `Cargo.toml`: ```toml [dependencies.clap] -version = "2.19" +version = "2.26" default-features = false ``` @@ -503,7 +503,7 @@ You can also selectively enable only the features you'd like to include, by addi ```toml [dependencies.clap] -version = "2.19" +version = "2.26" default-features = false # Cherry-pick the features you'd like to use @@ -629,7 +629,7 @@ In order to keep from being surprised of breaking changes, it is **highly** reco ```toml [dependencies] -clap = "~2.19.0" +clap = "~2.26" ``` This will cause *only* the patch version to be updated upon a `cargo update` call, and therefore cannot break due to new features, or bumped minimum versions of Rust. From e09c248fc1a5ef1755c5363a5448289f8b6c8d09 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 23 Sep 2017 12:31:43 +0200 Subject: [PATCH 2/3] tests: ensure README version numbers are in sync --- .travis.yml | 6 ++++++ Cargo.toml | 1 + README.md | 2 +- tests/version-numbers.rs | 7 +++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 tests/version-numbers.rs diff --git a/.travis.yml b/.travis.yml index 6de58350e54..2852bfbe0e4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,12 @@ before_script: - | pip install git+git://github.com/kbknapp/travis-cargo.git --user && export PATH=$HOME/.local/bin:$PATH + - | + if [[ "$TRAVIS_RUST_VERSION" == "1.13.0" ]]; then + echo "Old Rust detected, removing version-sync dependency" + sed -i "/^version-sync =/d" Cargo.toml + rm "tests/version-numbers.rs" + fi script: - | travis-cargo test -- --verbose --no-default-features && diff --git a/Cargo.toml b/Cargo.toml index bcb684bb1fd..1850257c69e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,6 +34,7 @@ atty = { version = "0.2.2", optional = true } [dev-dependencies] regex = "0.2" lazy_static = "0.2" +version-sync = "0.3" [features] default = ["suggestions", "color", "wrap_help"] diff --git a/README.md b/README.md index 42eecf66f92..34b848fb06b 100644 --- a/README.md +++ b/README.md @@ -642,7 +642,7 @@ From @alexcrichton: Right now Cargo's version resolution is pretty naive, it's just a brute-force search of the solution space, returning the first resolvable graph. This also means that it currently won't terminate until it proves there is not possible resolvable graph. This leads to situations where workspaces with multiple binaries, for example, have two different dependencies such as: -```toml +```toml,no_sync # In one Cargo.toml [dependencies] diff --git a/tests/version-numbers.rs b/tests/version-numbers.rs new file mode 100644 index 00000000000..0ed38388a09 --- /dev/null +++ b/tests/version-numbers.rs @@ -0,0 +1,7 @@ +#[macro_use] +extern crate version_sync; + +#[test] +fn test_readme_deps() { + assert_markdown_deps_updated!("README.md"); +} From e67a061bcf567c6518d6c2f58852e01f02764b22 Mon Sep 17 00:00:00 2001 From: Martin Geisler Date: Sat, 23 Sep 2017 12:48:23 +0200 Subject: [PATCH 3/3] docs: add html_root_url attribute This doc attribute is used by rustdoc when generating documentation for other crates that depend on this crate. With the html_root_url, rustdoc will be able to generate correct links into this crate. See C-HTML-ROOT in the Rust API Guidelines for more information: https://rust-lang-nursery.github.io/api-guidelines/documentation.html#crate-sets-html_root_url-attribute-c-html-root A version-sync check was added to ensure that the URL is kept up to date when the crate version changes. --- src/lib.rs | 1 + tests/version-numbers.rs | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 468dd5967e8..cadee3afb99 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -511,6 +511,7 @@ //! this repository for more information. #![crate_type= "lib"] +#![doc(html_root_url = "https://docs.rs/clap/2.26.2")] #![deny( missing_docs, missing_debug_implementations, diff --git a/tests/version-numbers.rs b/tests/version-numbers.rs index 0ed38388a09..411eea548ea 100644 --- a/tests/version-numbers.rs +++ b/tests/version-numbers.rs @@ -5,3 +5,8 @@ extern crate version_sync; fn test_readme_deps() { assert_markdown_deps_updated!("README.md"); } + +#[test] +fn test_html_root_url() { + assert_html_root_url_updated!("src/lib.rs"); +}