From 8202d7bf25f0c94fd77be29ad6ca047dde5117d9 Mon Sep 17 00:00:00 2001 From: Jake Shadle Date: Mon, 2 Dec 2019 18:43:52 +0100 Subject: [PATCH] Prepare release (#49) * Minor fixup --- CHANGELOG.md | 8 +++- Cargo.lock | 2 +- Cargo.toml | 2 +- .../spdx_cache.bin.zstd | Bin resources/template.toml | 37 ++++++++++++------ src/cargo-deny/init.rs | 14 ++++--- src/licenses.rs | 2 +- 7 files changed, 43 insertions(+), 22 deletions(-) rename spdx_cache.bin.zstd => resources/spdx_cache.bin.zstd (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1bf1f76..416e169a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.4.2] - 2019-12-02 +### Added +- [PR#48](https://github.com/EmbarkStudios/cargo-deny/pull/48) Added an `init` subcommand to generate a +cargo-deny template file with guiding comments. Thanks [@foresterre](https://github.com/foresterre)! + ## [0.4.1] - 2019-11-28 ### Fixed - [PR#46](https://github.com/EmbarkStudios/cargo-deny/pull/46) Fixed issue where `license-file` was not being @@ -80,7 +85,8 @@ Now each license has to be explicitly approved, either by listing them in `licen ### Added - Initial implementation release -[Unreleased]: https://github.com/EmbarkStudios/cargo-deny/compare/0.4.1...HEAD +[Unreleased]: https://github.com/EmbarkStudios/cargo-deny/compare/0.4.2...HEAD +[0.4.2]: https://github.com/EmbarkStudios/cargo-deny/compare/0.4.1...0.4.2 [0.4.1]: https://github.com/EmbarkStudios/cargo-deny/compare/0.4.0...0.4.1 [0.4.0]: https://github.com/EmbarkStudios/cargo-deny/compare/0.3.0...0.4.0 [0.3.0]: https://github.com/EmbarkStudios/cargo-deny/compare/0.3.0-beta...0.3.0 diff --git a/Cargo.lock b/Cargo.lock index ad02a636..2b7b763a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -109,7 +109,7 @@ dependencies = [ [[package]] name = "cargo-deny" -version = "0.4.1" +version = "0.4.2" dependencies = [ "ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)", "anyhow 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index ee032fb1..b82f2848 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "cargo-deny" description = "Cargo plugin to help you manage large dependency graphs" repository = "https://github.com/EmbarkStudios/cargo-deny" -version = "0.4.1" +version = "0.4.2" authors = ["Embark ", "Jake Shadle "] edition = "2018" license = "MIT OR Apache-2.0" diff --git a/spdx_cache.bin.zstd b/resources/spdx_cache.bin.zstd similarity index 100% rename from spdx_cache.bin.zstd rename to resources/spdx_cache.bin.zstd diff --git a/resources/template.toml b/resources/template.toml index 1de943c8..a4018cf2 100644 --- a/resources/template.toml +++ b/resources/template.toml @@ -3,23 +3,32 @@ # More documentation for the licenses section can be found here: # https://github.com/EmbarkStudios/cargo-deny#the-licenses-section -# Uncomment the following line to change the lint level for unlicensed crates [possible values: "deny", "allow" or "warn"]. +# Uncomment the following line to change the lint level for unlicensed crates +# [possible values: "deny", "allow" or "warn"]. #unlicensed = "deny" -# Uncomment the following line to explictly allow certain licenses [possible values: any SPDX 2.1 identifier]. +# Uncomment the following line to explictly allow certain licenses +# See https://spdx.org/licenses/ for list of possible licenses +# [possible values: any SPDX 3.7 short identifier (+ optional exception)]. #allow = [] -# Uncomment the following line to explictly disallow certain licenses [possible values: any SPDX 2.1 identifier]. +# Uncomment the following line to explictly disallow certain licenses +# See https://spdx.org/licenses/ for list of possible licenses +# [possible values: any SPDX 3.7 short identifier (+ optional exception)]. #deny = [] -# Uncomment the following line to change the lint level for licenses considered copyleft [possible values: "deny", "allow" or "warn"]. +# Uncomment the following line to change the lint level for licenses considered copyleft +# [possible values: "deny", "allow" or "warn"]. #copyleft = "warn" -# Uncomment the following line to approve or deny OSI-approved or FSF Free/Libre licenses [possible values: "both", "either", "osi-only", "fsf-only" or "neither"]. +# Uncomment the following line to approve or deny OSI-approved or FSF Free/Libre licenses +# [possible values: "both", "either", "osi-only", "fsf-only" or "neither"]. #allow-osi-fsf-free = "neither" -# Uncomment the following line to change the confidence threshold. [possible values: any between 0.0 and 1.0]. -# The higher the value, the more closely the license text must be to the canonical license text of a valid SPDX license file. +# Uncomment the following line to change the confidence threshold. The higher the value, +# the more closely the license text must be to the canonical license text of a valid +# SPDX license file. +# [possible values: any between 0.0 and 1.0]. #confidence-threshold = 0.8 [bans] @@ -27,11 +36,14 @@ # More documentation about the 'bans' section can be found here: # https://github.com/EmbarkStudios/cargo-deny#crate-bans-cargo-deny-check-ban -# Uncomment the following line to change what happens when multiple versions of the same crate are encountered [possible values: "deny", "warn" or "allow"]. +# Uncomment the following line to change what happens when multiple versions of the same +# crate are encountered +# [possible values: "deny", "warn" or "allow"]. #multiple-versions = "warn" -# Uncomment the following line to change the highlighting variant used to multiple versions of the same crate when creating -# a dotgraph of your crates dependencies [possible values: "lowest-version", "simplest-path" or "all"]. +# Uncomment the following line to change the highlighting variant used to multiple versions +# of the same crate when creating a dotgraph of your crates dependencies +# [possible values: "lowest-version", "simplest-path" or "all"]. #highlight = "all" # Uncomment the following line to allow specific crates. @@ -43,6 +55,7 @@ # Uncomment the following line to skip specific crates. #skip = [] -# Uncomment the following line to skip specific crates (including different versions of the same crate down the dependency -# tree). By default, the depth is infinite. If however desired, the depth can be ajusted. +# Uncomment the following line to skip specific crates (including different versions of the +# same crate down the dependency tree). By default, the depth is infinite, but you can also +# specify `depth = ` to limit it. #skip-tree = [] diff --git a/src/cargo-deny/init.rs b/src/cargo-deny/init.rs index 15ba86f4..b99a34da 100644 --- a/src/cargo-deny/init.rs +++ b/src/cargo-deny/init.rs @@ -25,17 +25,19 @@ pub fn cmd(args: Args, context_dir: PathBuf) -> Result<(), Error> { // make sure the file does not exist yet ensure!( std::fs::metadata(&cfg_file).is_err(), - "unable to initialize cargo deny config file ; the provided path already exists" + "unable to initialize cargo-deny config: '{}' already exists", + cfg_file.display(), ); + // make sure the path does not terminate in '..'; we need a file name. ensure!( - &cfg_file.file_name().is_some(), - "unable to create a config file with the given name ; the given file path is not valid" + cfg_file.file_name().is_some(), + "unable to create cargo-deny config: '{}' has an invalid filename", + cfg_file.display(), ); - log::info!("saving config file to: {}", &cfg_file.display()); - - std::fs::write(cfg_file, CONTENTS).context("unable to write config file")?; + std::fs::write(&cfg_file, CONTENTS).context("unable to write config file")?; + log::info!("saved config file to: {}", cfg_file.display()); Ok(()) } diff --git a/src/licenses.rs b/src/licenses.rs index 9369b809..3c35ae9a 100644 --- a/src/licenses.rs +++ b/src/licenses.rs @@ -12,7 +12,7 @@ use std::{ sync::Arc, }; -const LICENSE_CACHE: &[u8] = include_bytes!("../spdx_cache.bin.zstd"); +const LICENSE_CACHE: &[u8] = include_bytes!("../resources/spdx_cache.bin.zstd"); const fn lint_deny() -> LintLevel { LintLevel::Deny