From 9673f7298cd7f1feb99065a15ca4005c8ebf6b01 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 14 Dec 2014 20:43:38 -0800 Subject: [PATCH] Warn if none of documentation, homepage or repository are provided It's really hard to find out any information about a project if it doesn't have any of these. As a bonus I added a shebang to .travis.install.deps.sh so the README instructions actually work. Closes #998 --- .travis.install.deps.sh | 2 ++ src/cargo/ops/cargo_package.rs | 2 +- tests/test_cargo_package.rs | 8 +++++--- tests/test_cargo_registry.rs | 2 ++ 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.travis.install.deps.sh b/.travis.install.deps.sh index 90c25a7da..2c3b35d4e 100755 --- a/.travis.install.deps.sh +++ b/.travis.install.deps.sh @@ -1,3 +1,5 @@ +#!/bin/bash + set -x set -e diff --git a/src/cargo/ops/cargo_package.rs b/src/cargo/ops/cargo_package.rs index 0e6336aad..174f72f2e 100644 --- a/src/cargo/ops/cargo_package.rs +++ b/src/cargo/ops/cargo_package.rs @@ -83,7 +83,7 @@ fn check_metadata(pkg: &Package, shell: &mut MultiShell) -> CargoResult<()> { )* }} } - lacking!(description, license || license_file) + lacking!(description, license || license_file, documentation || homepage || repository) if !missing.is_empty() { let mut things = missing.slice_to(missing.len() - 1).connect(", "); diff --git a/tests/test_cargo_package.rs b/tests/test_cargo_package.rs index c3f2eccad..87c1b3efa 100644 --- a/tests/test_cargo_package.rs +++ b/tests/test_cargo_package.rs @@ -81,7 +81,8 @@ test!(metadata_warning { compiling = COMPILING, dir = p.url()).as_slice()) .with_stderr("\ -warning: manifest has no description, license or license-file. See \ +warning: manifest has no description, license, license-file, documentation, \ +homepage or repository. See \ http://doc.crates.io/manifest.html#package-metadata for more info.")); let p = project("one") @@ -106,10 +107,10 @@ http://doc.crates.io/manifest.html#package-metadata for more info.")); compiling = COMPILING, dir = p.url()).as_slice()) .with_stderr("\ -warning: manifest has no description. See \ +warning: manifest has no description, documentation, homepage or repository. See \ http://doc.crates.io/manifest.html#package-metadata for more info.")); - let p = project("both") + let p = project("all") .file("Cargo.toml", format!(r#" [project] name = "foo" @@ -117,6 +118,7 @@ http://doc.crates.io/manifest.html#package-metadata for more info.")); authors = [] license = "MIT" description = "foo" + repository = "bar" "#)) .file("src/main.rs", r#" fn main() {} diff --git a/tests/test_cargo_registry.rs b/tests/test_cargo_registry.rs index 601587a0b..bd3dcbb8d 100644 --- a/tests/test_cargo_registry.rs +++ b/tests/test_cargo_registry.rs @@ -179,6 +179,7 @@ test!(package_with_path_deps { authors = [] license = "MIT" description = "foo" + repository = "bar" [dependencies.notyet] version = "0.0.1" @@ -491,6 +492,7 @@ test!(bad_license_file { authors = [] license-file = "foo" description = "bar" + repository = "baz" "#) .file("src/main.rs", r#" fn main() {}