Skip to content

Commit

Permalink
Merge pull request #1053 from mgeisler/version-sync
Browse files Browse the repository at this point in the history
Keep README version numbers in sync with crate version
  • Loading branch information
kbknapp committed Sep 30, 2017
2 parents 6e94899 + e67a061 commit f28d7b4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand All @@ -495,15 +495,15 @@ To disable these, add this to your `Cargo.toml`:

```toml
[dependencies.clap]
version = "2.19"
version = "2.26"
default-features = false
```

You can also selectively enable only the features you'd like to include, by adding:

```toml
[dependencies.clap]
version = "2.19"
version = "2.26"
default-features = false

# Cherry-pick the features you'd like to use
Expand Down Expand Up @@ -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.
Expand All @@ -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]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
12 changes: 12 additions & 0 deletions tests/version-numbers.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#[macro_use]
extern crate version_sync;

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

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

0 comments on commit f28d7b4

Please sign in to comment.