├── .gitignore ├── .travis.yml ├── Cargo.toml ├── LICENSE-MIT ├── README.md ├── tests └── test_cli.rs ├── src ├── main.rs └── lib.rs ├── LICENSE-APACHE └── Cargo.lock /.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | **/*.rs.bk 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | dist: xenial 2 | cache: cargo 3 | before_cache: 4 | - find ./target/debug -type f -maxdepth 1 -delete 5 | - rm -fr ./target/debug/{deps,.fingerprint}/{*_review_*,*test*} 6 | - rm -f ./target/.rustc_info.json 7 | 8 | env: 9 | - CARGO_INCREMENTAL=0 10 | 11 | language: rust 12 | rust: stable 13 | script: 14 | - cargo test 15 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cargo-review-deps" 3 | version = "1.1.0-pre.1" 4 | authors = ["Aleksey Kladov "] 5 | description = "A cargo subcommand for reviewing the source code of crates.io dependencies" 6 | repository = "https://github.com/ferrous-systems/cargo-review-deps" 7 | license = "MIT OR Apache-2.0" 8 | 9 | [dependencies] 10 | failure = "0.1.3" 11 | semver = "0.9.0" 12 | tempdir = "0.3.7" 13 | cargo_metadata = "0.6.2" 14 | copy_dir = "0.1.2" 15 | clap = "2.32.0" 16 | 17 | [dev-dependencies] 18 | assert_cli = "0.6.3" 19 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any 2 | person obtaining a copy of this software and associated 3 | documentation files (the "Software"), to deal in the 4 | Software without restriction, including without 5 | limitation the rights to use, copy, modify, merge, 6 | publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software 8 | is furnished to do so, subject to the following 9 | conditions: 10 | 11 | The above copyright notice and this permission notice 12 | shall be included in all copies or substantial portions 13 | of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 16 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 17 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 18 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 19 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 20 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 22 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 23 | DEALINGS IN THE SOFTWARE. 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.com/ferrous-systems/cargo-review-deps.svg?branch=master)](https://travis-ci.com/ferrous-systems/cargo-review-deps) 2 | 3 | # cargo-review-deps 4 | 5 | A cargo subcommand for reviewing the source code of crates.io dependencies. 6 | 7 | ## Installation: 8 | 9 | ``` 10 | cargo install cargo-review-deps 11 | ``` 12 | 13 | ## Usage 14 | 15 | ### update-diff 16 | 17 | To see what exactly changes if you run `cargo-update`, use 18 | 19 | ``` 20 | $ cargo review-deps update-diff -- --package foo 21 | ``` 22 | 23 | This will run (without actually updating the lockfile) `cargo update --package foo` 24 | and show `diff --color -r` of all added/removed/updated dependencies. 25 | 26 | If you want to use a custom diff tool or need to do a more thorough 27 | investigation, use `--destination` option to checkout sources of dependencies 28 | locally. 29 | 30 | ### diff 31 | 32 | To quickly see the `diff -r` of two package versions, use 33 | 34 | ``` 35 | $ cargo review-deps diff rand:0.6.0 rand:0.6.1 36 | ``` 37 | 38 | Similarly to `update-diff`, you can use `--destination` option for customized 39 | diffing. 40 | 41 | ``` 42 | $ cargo review-deps diff rand:0.6.0 rand:0.6.1 --destinations diff 43 | ``` 44 | 45 | The `diff/random:0.6.0` and `diff/random:0.6.1` directories would 46 | contain the sources of the respective versions. 47 | 48 | Note that `cargo-review-deps` does not rely on version control information: it 49 | uses exactly that version of source code, that will be used by Cargo to build 50 | your project. 51 | 52 | 53 | ### current 54 | 55 | To see the sources of all transitive dependencies, use 56 | 57 | ``` 58 | $ cargo review-deps current --destination dir/to/dump/sources/to 59 | ``` 60 | 61 | This will download sources of all of the dependencies to the specified 62 | directory. 63 | 64 | ## Similar projects: 65 | 66 | [cargo-audit](https://github.com/RustSec/cargo-audit) checks your project for 67 | dependencies with security vulnerabilities reported to the RustSec Advisory 68 | Database. 69 | 70 | ## Commercial Support 71 | 72 | This project is developed by [Ferrous Systems GmbH](https://ferrous-systems.com). Interested in commercial support, custom functionality, or sponsoring this open source work? Send us [an email here](mailto:commercial@ferrous-systems.com). 73 | 74 | ## License 75 | 76 | `MIT OR Apache-2.0` 77 | -------------------------------------------------------------------------------- /tests/test_cli.rs: -------------------------------------------------------------------------------- 1 | extern crate assert_cli; 2 | extern crate tempdir; 3 | 4 | use std::{env, fs, path::PathBuf, process::Command}; 5 | 6 | use assert_cli::Assert; 7 | 8 | fn cmd_diff() -> Assert { 9 | base_cmd().with_args(&["diff"]) 10 | } 11 | 12 | fn cmd_current() -> Assert { 13 | base_cmd().with_args(&["current"]) 14 | } 15 | 16 | fn cmd_update_diff() -> Assert { 17 | base_cmd().with_args(&["update-diff"]) 18 | } 19 | 20 | #[test] 21 | fn diff_shows_diff() { 22 | match std::process::Command::new("diff") 23 | .args(&["--color=auto", "-", "-"]) 24 | .status() 25 | { 26 | Ok(s) if s.success() => (), 27 | _ => { 28 | eprintln!("skipping the test, no recent `diff` command"); 29 | return; 30 | } 31 | } 32 | 33 | cmd_diff() 34 | .with_args(&["rand:0.6.0", "rand:0.6.1"]) 35 | .stdout() 36 | .contains("< version = \"0.6.0\"") 37 | .unwrap(); 38 | } 39 | 40 | #[test] 41 | fn diff_reports_error_for_invalid_package_id() { 42 | cmd_diff() 43 | .with_args(&["rand:0.6.0", "rand-0.6.1"]) 44 | .fails_with(101) 45 | .stderr() 46 | .contains("error: invalid package specification: \"rand-0.6.1\"; expected \"name:x.y.z\"") 47 | .unwrap(); 48 | } 49 | 50 | #[test] 51 | fn diff_copies_sources_to_dest() { 52 | let dir = tempdir::TempDir::new("diff-tests").unwrap(); 53 | cmd_diff() 54 | .with_args(&["rand:0.6.0", "rand:0.6.1", "--destination"]) 55 | .with_args(&[dir.path()]) 56 | .stdout() 57 | .is("") 58 | .unwrap(); 59 | assert!(dir.path().join("rand:0.6.0").exists()); 60 | assert!(dir.path().join("rand:0.6.1").exists()); 61 | } 62 | 63 | #[test] 64 | fn current_reports_deps() -> std::io::Result<()> { 65 | let project_dir = tempdir::TempDir::new("temp-project")?; 66 | let dest = project_dir.path().join("dest"); 67 | 68 | fs::write( 69 | project_dir.path().join("Cargo.toml"), 70 | r#" 71 | [package] 72 | name = "test-pkg" 73 | version = "0.0.0" 74 | 75 | [dependencies] 76 | thread_local = "=0.3.6" 77 | 78 | [lib] 79 | path = "./Cargo.toml" 80 | "#, 81 | )?; 82 | cmd_current() 83 | .current_dir(project_dir.path()) 84 | .with_args(&["--destination"]) 85 | .with_args(&[&dest.as_path()]) 86 | .stderr() 87 | .contains("Skipping package `test-pkg`") 88 | .unwrap(); 89 | assert!(dest.join("thread_local:0.3.6").exists()); 90 | Ok(()) 91 | } 92 | 93 | #[test] 94 | fn update_diff_dumps_changed_crates() -> std::io::Result<()> { 95 | let project_dir = tempdir::TempDir::new("temp-project")?; 96 | let dest = project_dir.path().join("dest"); 97 | 98 | fs::write( 99 | project_dir.path().join("Cargo.toml"), 100 | r#" 101 | [package] 102 | name = "test-pkg" 103 | version = "0.0.0" 104 | 105 | [dependencies] 106 | thread_local = "0.3" 107 | 108 | [lib] 109 | path = "./Cargo.toml" 110 | "#, 111 | )?; 112 | let run_cargo = |args: &[&str]| -> std::io::Result<()> { 113 | let status = Command::new("cargo") 114 | .current_dir(project_dir.path()) 115 | .args(args) 116 | .status()?; 117 | assert!(status.success()); 118 | Ok(()) 119 | }; 120 | 121 | run_cargo(&["generate-lockfile"])?; 122 | run_cargo(&["update", "--package", "thread_local", "--precise", "0.3.3"])?; 123 | let lockfile = fs::read_to_string(project_dir.path().join("Cargo.lock"))?; 124 | cmd_update_diff() 125 | .current_dir(project_dir.path()) 126 | .with_args(&["--destination"]) 127 | .with_args(&[&dest.as_path()]) 128 | .with_args(&["--", "--package", "thread_local", "--precise", "0.3.4"]) 129 | .stderr() 130 | .contains("thread_local v0.3.3 -> v0.3.4") 131 | .unwrap(); 132 | assert_eq!( 133 | lockfile, 134 | fs::read_to_string(project_dir.path().join("Cargo.lock"))?, 135 | ); 136 | assert!(dest.join("before/thread_local:0.3").exists()); 137 | assert!(dest.join("after/thread_local:0.3").exists()); 138 | Ok(()) 139 | } 140 | 141 | // Adapted from 142 | // https://github.com/rust-lang/cargo/blob/485670b3983b52289a2f353d589c57fae2f60f82/tests/testsuite/support/mod.rs#L507 143 | fn target_dir() -> PathBuf { 144 | env::current_exe() 145 | .ok() 146 | .map(|mut path| { 147 | path.pop(); 148 | if path.ends_with("deps") { 149 | path.pop(); 150 | } 151 | path 152 | }) 153 | .unwrap() 154 | } 155 | 156 | fn cargo_review_deps_exe() -> PathBuf { 157 | target_dir().join(format!("cargo-review-deps{}", env::consts::EXE_SUFFIX)) 158 | } 159 | 160 | fn base_cmd() -> Assert { 161 | Assert::command(&[&cargo_review_deps_exe()]).with_args(&["review-deps"]) 162 | } 163 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate cargo_review_deps; 2 | extern crate clap; 3 | 4 | use std::{ffi::OsStr, path::PathBuf}; 5 | 6 | use cargo_review_deps::{Current, Diff, PackageId, Result, UpdateDiff}; 7 | use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; 8 | 9 | fn main() { 10 | let exit_code = main_inner(); 11 | std::process::exit(exit_code); 12 | } 13 | 14 | fn main_inner() -> i32 { 15 | let matches = App::new("cargo-review-deps") 16 | .bin_name("cargo") 17 | .version("1.0") 18 | .settings(&[AppSettings::GlobalVersion, AppSettings::SubcommandRequired]) 19 | .subcommand( 20 | SubCommand::with_name("review-deps") 21 | .author("Aleksey Kladov ") 22 | .about("Helps you to review source code of your crates.io dependencies") 23 | .setting(AppSettings::SubcommandRequired) 24 | .subcommand( 25 | SubCommand::with_name("diff") 26 | .about("Show the diff between two crate versions") 27 | .after_help("By default, diff -r command is used for diffing. \ 28 | If you want to use a custom diff tool, specify the --destination \ 29 | argument and run the diff command manually.") 30 | .arg( 31 | Arg::with_name("FIRST_PACKAGE_ID") 32 | .required(true) 33 | .index(1) 34 | .help("First crate to diff, in the form of name:version, for example rand:0.6.0"), 35 | ) 36 | .arg( 37 | Arg::with_name("SECOND_PACKAGE_ID") 38 | .required(true) 39 | .index(2) 40 | .help("Second crate to diff, for example rand:0.6.1"), 41 | ) 42 | .arg( 43 | Arg::with_name("destination") 44 | .short("d") 45 | .long("destination") 46 | .takes_value(true) 47 | .value_name("DIR") 48 | .help("Checkout sources of the two versions to the specified directory") 49 | ), 50 | ) 51 | .subcommand( 52 | SubCommand::with_name("current") 53 | .about("Show the diff for dependencies after cargo update") 54 | .after_help("By default, diff -r command is used for diffing. \ 55 | If you want to use a custom diff tool, specify the --destination \ 56 | argument and run the diff command manually.") 57 | .arg( 58 | Arg::with_name("destination") 59 | .short("d") 60 | .long("destination") 61 | .takes_value(true) 62 | .value_name("DIR") 63 | .required(true) 64 | .help("Checkout sources of the two versions to the specified directory") 65 | ), 66 | ) 67 | .subcommand( 68 | SubCommand::with_name("update-diff") 69 | .about("Download the source code of dependencies which would be changed by `cargo update` to the specified directory") 70 | .after_help("By default, `diff -r` is the command is used for diffing. \ 71 | If you want to use a custom diff tool, specify the --destination \ 72 | argument and run the diff command manually.") 73 | .arg( 74 | Arg::with_name("destination") 75 | .short("d") 76 | .long("destination") 77 | .takes_value(true) 78 | .value_name("DIR") 79 | .help("Checkout sources of dependencies to the specified directory") 80 | ) 81 | .arg( 82 | Arg::with_name("args") 83 | .last(true) 84 | .multiple(true) 85 | ) 86 | ), 87 | ).get_matches(); 88 | 89 | let matches = matches.subcommand_matches("review-deps").unwrap(); // Cargo always calls us using `cargo review-deps ...` as `argv` 90 | let (cmd, matches) = match matches.subcommand() { 91 | (cmd, Some(matches)) => (cmd, matches), 92 | (_, None) => unreachable!("AppSettings::SubcommandRequired is set"), 93 | }; 94 | 95 | let res = match cmd { 96 | "diff" => exec_diff(&matches), 97 | "current" => exec_current(&matches), 98 | "update-diff" => exec_update_diff(&matches), 99 | _ => unreachable!("no such cmd: {:?}", cmd), 100 | }; 101 | 102 | if let Err(err) = res { 103 | eprintln!("error: {}", err); 104 | return 101; 105 | } 106 | 0 107 | } 108 | 109 | fn value_of_pkg_id(matches: &ArgMatches, arg_name: &str) -> Result { 110 | let value = matches.value_of(arg_name).expect("arg is required"); 111 | value.parse() 112 | } 113 | 114 | fn exec_diff(matches: &ArgMatches) -> Result<()> { 115 | let first = value_of_pkg_id(&matches, "FIRST_PACKAGE_ID")?; 116 | let second = value_of_pkg_id(&matches, "SECOND_PACKAGE_ID")?; 117 | let dest = matches.value_of("destination").map(PathBuf::from); 118 | Diff { 119 | first, 120 | second, 121 | dest, 122 | } 123 | .run() 124 | } 125 | 126 | fn exec_current(matches: &ArgMatches) -> Result<()> { 127 | let dest = matches.value_of("destination").unwrap().into(); 128 | Current { dest }.run() 129 | } 130 | 131 | fn exec_update_diff(matches: &ArgMatches) -> Result<()> { 132 | let dest = matches.value_of("destination").map(PathBuf::from); 133 | let args = matches 134 | .values_of_os("args") 135 | .unwrap_or_default() 136 | .map(OsStr::to_owned) 137 | .collect(); 138 | UpdateDiff { dest, args }.run() 139 | } 140 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | #[macro_use] 2 | extern crate failure; 3 | extern crate cargo_metadata; 4 | extern crate copy_dir; 5 | extern crate semver; 6 | extern crate tempdir; 7 | 8 | use std::{ 9 | collections::HashMap, 10 | ffi::OsString, 11 | fmt, fs, 12 | path::{Path, PathBuf}, 13 | process::{Command, Stdio}, 14 | str::FromStr, 15 | }; 16 | 17 | use copy_dir::copy_dir; 18 | use semver::Version; 19 | use tempdir::TempDir; 20 | 21 | pub use failure::Error; 22 | pub type Result = ::std::result::Result; 23 | 24 | /// Mirrors `PackageId` from Cargo. `PackageId` is an unambiguous reference to a 25 | /// package version. 26 | /// 27 | /// Future work: support git dependencies and alternative registries. 28 | #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] 29 | pub struct PackageId { 30 | name: String, 31 | version: Version, 32 | } 33 | 34 | impl fmt::Display for PackageId { 35 | fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { 36 | self.name.fmt(fmt)?; 37 | fmt.write_str(":")?; 38 | self.version.fmt(fmt) 39 | } 40 | } 41 | 42 | impl FromStr for PackageId { 43 | type Err = Error; 44 | fn from_str(s: &str) -> Result { 45 | let colon_idx = s.find(':').ok_or_else(|| { 46 | format_err!( 47 | "invalid package specification: {:?}; expected \"name:x.y.z\"", 48 | s 49 | ) 50 | })?; 51 | let name = s[..colon_idx].to_string(); 52 | let version: Version = s[colon_idx + 1..].parse()?; 53 | Ok(PackageId { name, version }) 54 | } 55 | } 56 | 57 | #[derive(Debug)] 58 | pub struct Diff { 59 | pub first: PackageId, 60 | pub second: PackageId, 61 | pub dest: Option, 62 | } 63 | 64 | impl Diff { 65 | pub fn run(self) -> Result<()> { 66 | let first_src = fetch(&self.first)?; 67 | let second_src = fetch(&self.second)?; 68 | if let Some(dir) = self.dest { 69 | fs::create_dir_all(&dir)?; 70 | copy_dir(&first_src, &dir.join(self.first.to_string()))?; 71 | copy_dir(&second_src, &dir.join(self.second.to_string()))?; 72 | } else { 73 | run_diff_cmd(&first_src, &second_src)?; 74 | } 75 | Ok(()) 76 | } 77 | } 78 | 79 | pub fn run_diff_cmd(a: &Path, b: &Path) -> Result<()> { 80 | let mut diff_cmd = Command::new("diff"); 81 | let diff_status = diff_cmd 82 | .args(&["--color=auto", "-r"]) 83 | .arg(a) 84 | .arg(b) 85 | .stdout(Stdio::inherit()) 86 | .stderr(Stdio::inherit()) 87 | .status(); 88 | if diff_status.is_err() { 89 | if !has_diff_cmd() { 90 | bail!("looks like you don't have a suitable diff command installed.\n\ 91 | Try using --destination flag to run a custom diff tool or to compare sources manually.") 92 | } 93 | } 94 | diff_status?; 95 | Ok(()) 96 | } 97 | 98 | #[derive(Debug)] 99 | pub struct Current { 100 | pub dest: PathBuf, 101 | } 102 | 103 | impl Current { 104 | pub fn run(self) -> Result<()> { 105 | let metadata = Metadata { 106 | manifest_path: None, 107 | } 108 | .run()?; 109 | 110 | fs::create_dir_all(&self.dest)?; 111 | for pkg in crates_io_packages(&metadata) { 112 | let src = pkg_dir(&pkg)?; 113 | let dst = self.dest.join(format!("{}:{}", pkg.name, pkg.version)); 114 | copy_dir(&src, &dst)?; 115 | } 116 | Ok(()) 117 | } 118 | } 119 | 120 | #[derive(Debug)] 121 | pub struct UpdateDiff { 122 | pub dest: Option, 123 | pub args: Vec, 124 | } 125 | 126 | impl UpdateDiff { 127 | pub fn run(self) -> Result<()> { 128 | let before_metadata = Metadata { 129 | manifest_path: None, 130 | } 131 | .run()?; 132 | let workspace_root = Path::new(&before_metadata.workspace_root); 133 | let lockfile = workspace_root.join("Cargo.lock"); 134 | let mut lockfile_guard = LockfileGuard::new(lockfile)?; 135 | 136 | let status = Command::new("cargo") 137 | .arg("update") 138 | .args(&self.args) 139 | .stdout(Stdio::inherit()) 140 | .stderr(Stdio::inherit()) 141 | .status()?; 142 | 143 | if !status.success() { 144 | bail!("running cargo update failed"); 145 | } 146 | let after_metadata = Metadata { 147 | manifest_path: None, 148 | } 149 | .run()?; 150 | let tmpdir; 151 | let dest = match self.dest.as_ref() { 152 | Some(it) => it.as_path(), 153 | None => { 154 | tmpdir = TempDir::new("cargo-diff-fetches")?; 155 | tmpdir.path() 156 | } 157 | }; 158 | let before_dir = dest.join("before"); 159 | let after_dir = dest.join("after"); 160 | fs::create_dir_all(&before_dir)?; 161 | fs::create_dir_all(&after_dir)?; 162 | for pdiff in metadata_diff(&before_metadata, &after_metadata)? { 163 | pdiff.dump_to(&dest)?; 164 | } 165 | 166 | if self.dest.is_none() { 167 | run_diff_cmd(&before_dir, &after_dir)? 168 | } 169 | lockfile_guard.restore_lockfile()?; 170 | Ok(()) 171 | } 172 | } 173 | 174 | #[derive(Debug)] 175 | struct PackageDiff { 176 | name: String, 177 | before: Option, 178 | after: Option, 179 | } 180 | 181 | impl PackageDiff { 182 | fn dump_to(&self, dest: &Path) -> Result<()> { 183 | if let Some(src) = self.before.as_ref() { 184 | let dst = dest.join("before").join(&self.name); 185 | copy_dir(&src, &dst)?; 186 | } 187 | if let Some(src) = self.after.as_ref() { 188 | let dst = dest.join("after").join(&self.name); 189 | copy_dir(&src, &dst)?; 190 | } 191 | Ok(()) 192 | } 193 | } 194 | 195 | fn metadata_diff( 196 | before: &cargo_metadata::Metadata, 197 | after: &cargo_metadata::Metadata, 198 | ) -> Result> { 199 | let before = extract_packages(before)?; 200 | let after = extract_packages(after)?; 201 | let mut res = Vec::new(); 202 | for (name, before_path) in before.iter() { 203 | if !after.contains_key(name) { 204 | res.push(PackageDiff { 205 | name: name.clone(), 206 | before: Some(before_path.clone()), 207 | after: None, 208 | }) 209 | } 210 | } 211 | for (name, after_path) in after.iter() { 212 | if !before.contains_key(name) { 213 | res.push(PackageDiff { 214 | name: name.clone(), 215 | before: None, 216 | after: Some(after_path.clone()), 217 | }) 218 | } 219 | } 220 | for (name, before_path) in before.iter() { 221 | if let Some(after_path) = after.get(name) { 222 | if before_path == after_path { 223 | continue; 224 | } 225 | res.push(PackageDiff { 226 | name: name.clone(), 227 | before: Some(before_path.clone()), 228 | after: Some(after_path.clone()), 229 | }); 230 | } 231 | } 232 | 233 | Ok(res) 234 | } 235 | 236 | fn extract_packages(meta: &cargo_metadata::Metadata) -> Result> { 237 | let mut res = HashMap::new(); 238 | for pkg in crates_io_packages(meta) { 239 | let version = Version::parse(&pkg.version)?; 240 | let semver_compatible_version = if version.major == 0 { 241 | format!("0.{}", version.minor) 242 | } else { 243 | format!("{}", version.major) 244 | }; 245 | let name = format!("{}:{}", pkg.name, semver_compatible_version); 246 | res.insert(name, pkg_dir(pkg)?); 247 | } 248 | Ok(res) 249 | } 250 | 251 | fn crates_io_packages<'a>( 252 | meta: &'a cargo_metadata::Metadata, 253 | ) -> impl Iterator { 254 | meta.packages.iter().filter(|pkg| { 255 | // Ideally we should look at the `source`, but that is private. 256 | let is_cratesio_dep = pkg.id.contains("crates.io-index"); 257 | if !is_cratesio_dep { 258 | eprintln!( 259 | "Skipping package `{}`: not a crates.io dependency", 260 | pkg.name 261 | ); 262 | } 263 | is_cratesio_dep 264 | }) 265 | } 266 | 267 | /// We run real `cargo update` which writes to the lockfile. This struct makes sure (in 268 | /// Drop), that we restore it propertly afterwards. 269 | #[derive(Debug)] 270 | struct LockfileGuard { 271 | lockfile_path: PathBuf, 272 | lockfile_copy_path: PathBuf, 273 | lockfile_contents: String, 274 | restored: bool, 275 | } 276 | 277 | impl LockfileGuard { 278 | fn new(path: impl Into) -> Result { 279 | let lockfile_path = path.into(); 280 | let lockfile_copy_path = lockfile_path.with_extension(".lock.back"); 281 | let lockfile_contents = fs::read_to_string(&lockfile_path)?; 282 | fs::write(&lockfile_copy_path, &lockfile_contents)?; 283 | let res = LockfileGuard { 284 | lockfile_path, 285 | lockfile_copy_path, 286 | lockfile_contents, 287 | restored: false, 288 | }; 289 | Ok(res) 290 | } 291 | 292 | fn restore_lockfile(&mut self) -> Result<()> { 293 | self.restored = true; 294 | fs::write(&self.lockfile_path, &self.lockfile_contents)?; 295 | fs::remove_file(self.lockfile_copy_path.as_path())?; 296 | Ok(()) 297 | } 298 | } 299 | 300 | impl Drop for LockfileGuard { 301 | fn drop(&mut self) { 302 | if !self.restored { 303 | let _ = self.restore_lockfile(); 304 | } 305 | } 306 | } 307 | 308 | struct Metadata<'a> { 309 | manifest_path: Option<&'a Path>, 310 | } 311 | 312 | impl<'a> Metadata<'a> { 313 | fn run(self) -> Result { 314 | let metadata = cargo_metadata::metadata_deps( 315 | self.manifest_path, 316 | true, // include dependencies 317 | ) 318 | .map_err(|err| format_err!("cargo metadata failed: {}", err))?; // error_chain is not sync :-( 319 | Ok(metadata) 320 | } 321 | } 322 | 323 | fn has_diff_cmd() -> bool { 324 | match Command::new("diff").arg("--version").status() { 325 | Err(_) => false, 326 | Ok(status) => status.success(), 327 | } 328 | } 329 | 330 | /// Shells out to Cargo to download `pkg_id` from crates io. 331 | /// Returns the directory with the downloaded package; 332 | fn fetch(pkg_id: &PackageId) -> Result { 333 | let dir = TempDir::new("cargo-diff-fetches")?; 334 | let temp_manifest = dir.path().join("Cargo.toml"); 335 | fs::write(&temp_manifest, format_cargo_toml(pkg_id))?; 336 | let metadata = Metadata { 337 | manifest_path: Some(temp_manifest.as_path()), 338 | } 339 | .run()?; 340 | 341 | let package = metadata 342 | .packages 343 | .iter() 344 | .find(|it| it.name == pkg_id.name && it.version == pkg_id.version.to_string()) 345 | .ok_or_else(|| format_err!("unexpected error: can't find package {:?}", pkg_id))?; 346 | pkg_dir(&package) 347 | } 348 | 349 | fn pkg_dir(pkg: &cargo_metadata::Package) -> Result { 350 | let res = PathBuf::from(&pkg.manifest_path) 351 | .parent() 352 | .ok_or_else(|| { 353 | format_err!( 354 | "unexpected error: bad manifest path {:?}", 355 | pkg.manifest_path 356 | ) 357 | })? 358 | .to_path_buf(); 359 | Ok(res) 360 | } 361 | 362 | /// Conjures up a Cargo.toml with `pkg_id` as a dependency. 363 | fn format_cargo_toml(pkg_id: &PackageId) -> String { 364 | format!( 365 | r#" 366 | [package] 367 | name = "cargo-diff-temp-pkg" 368 | version = "0.0.0" 369 | 370 | [lib] 371 | path = "./Cargo.toml" 372 | 373 | [dependencies] 374 | {} = "={}" 375 | "#, 376 | pkg_id.name, pkg_id.version 377 | ) 378 | } 379 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "ansi_term" 3 | version = "0.11.0" 4 | source = "registry+https://github.com/rust-lang/crates.io-index" 5 | dependencies = [ 6 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "assert_cli" 11 | version = "0.6.3" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | dependencies = [ 14 | "colored 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)", 15 | "difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)", 16 | "environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 17 | "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 18 | "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 19 | "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", 20 | ] 21 | 22 | [[package]] 23 | name = "atty" 24 | version = "0.2.11" 25 | source = "registry+https://github.com/rust-lang/crates.io-index" 26 | dependencies = [ 27 | "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", 28 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 29 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 30 | ] 31 | 32 | [[package]] 33 | name = "backtrace" 34 | version = "0.3.9" 35 | source = "registry+https://github.com/rust-lang/crates.io-index" 36 | dependencies = [ 37 | "backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)", 38 | "cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 39 | "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", 40 | "rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", 41 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 42 | ] 43 | 44 | [[package]] 45 | name = "backtrace-sys" 46 | version = "0.1.24" 47 | source = "registry+https://github.com/rust-lang/crates.io-index" 48 | dependencies = [ 49 | "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", 50 | "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", 51 | ] 52 | 53 | [[package]] 54 | name = "bitflags" 55 | version = "1.0.4" 56 | source = "registry+https://github.com/rust-lang/crates.io-index" 57 | 58 | [[package]] 59 | name = "cargo-review-deps" 60 | version = "1.1.0-pre.1" 61 | dependencies = [ 62 | "assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)", 63 | "cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", 64 | "clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)", 65 | "copy_dir 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 66 | "failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 67 | "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 68 | "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", 69 | ] 70 | 71 | [[package]] 72 | name = "cargo_metadata" 73 | version = "0.6.2" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | dependencies = [ 76 | "error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", 77 | "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", 78 | "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", 79 | "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", 80 | "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)", 81 | ] 82 | 83 | [[package]] 84 | name = "cc" 85 | version = "1.0.25" 86 | source = "registry+https://github.com/rust-lang/crates.io-index" 87 | 88 | [[package]] 89 | name = "cfg-if" 90 | version = "0.1.6" 91 | source = "registry+https://github.com/rust-lang/crates.io-index" 92 | 93 | [[package]] 94 | name = "clap" 95 | version = "2.32.0" 96 | source = "registry+https://github.com/rust-lang/crates.io-index" 97 | dependencies = [ 98 | "ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)", 99 | "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 100 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 101 | "strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 102 | "textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)", 103 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 104 | "vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", 105 | ] 106 | 107 | [[package]] 108 | name = "colored" 109 | version = "1.6.1" 110 | source = "registry+https://github.com/rust-lang/crates.io-index" 111 | dependencies = [ 112 | "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", 113 | ] 114 | 115 | [[package]] 116 | name = "copy_dir" 117 | version = "0.1.2" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | dependencies = [ 120 | "walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 121 | ] 122 | 123 | [[package]] 124 | name = "difference" 125 | version = "2.0.0" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | 128 | [[package]] 129 | name = "environment" 130 | version = "0.1.1" 131 | source = "registry+https://github.com/rust-lang/crates.io-index" 132 | 133 | [[package]] 134 | name = "error-chain" 135 | version = "0.12.0" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | dependencies = [ 138 | "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 139 | ] 140 | 141 | [[package]] 142 | name = "failure" 143 | version = "0.1.3" 144 | source = "registry+https://github.com/rust-lang/crates.io-index" 145 | dependencies = [ 146 | "backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", 147 | "failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", 148 | ] 149 | 150 | [[package]] 151 | name = "failure_derive" 152 | version = "0.1.3" 153 | source = "registry+https://github.com/rust-lang/crates.io-index" 154 | dependencies = [ 155 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 156 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 157 | "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", 158 | "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", 159 | ] 160 | 161 | [[package]] 162 | name = "fuchsia-zircon" 163 | version = "0.3.3" 164 | source = "registry+https://github.com/rust-lang/crates.io-index" 165 | dependencies = [ 166 | "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", 167 | "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 168 | ] 169 | 170 | [[package]] 171 | name = "fuchsia-zircon-sys" 172 | version = "0.3.3" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | 175 | [[package]] 176 | name = "itoa" 177 | version = "0.4.3" 178 | source = "registry+https://github.com/rust-lang/crates.io-index" 179 | 180 | [[package]] 181 | name = "kernel32-sys" 182 | version = "0.2.2" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | dependencies = [ 185 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 186 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 187 | ] 188 | 189 | [[package]] 190 | name = "lazy_static" 191 | version = "1.2.0" 192 | source = "registry+https://github.com/rust-lang/crates.io-index" 193 | 194 | [[package]] 195 | name = "libc" 196 | version = "0.2.44" 197 | source = "registry+https://github.com/rust-lang/crates.io-index" 198 | 199 | [[package]] 200 | name = "proc-macro2" 201 | version = "0.4.24" 202 | source = "registry+https://github.com/rust-lang/crates.io-index" 203 | dependencies = [ 204 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 205 | ] 206 | 207 | [[package]] 208 | name = "quote" 209 | version = "0.6.10" 210 | source = "registry+https://github.com/rust-lang/crates.io-index" 211 | dependencies = [ 212 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 213 | ] 214 | 215 | [[package]] 216 | name = "rand" 217 | version = "0.4.3" 218 | source = "registry+https://github.com/rust-lang/crates.io-index" 219 | dependencies = [ 220 | "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", 221 | "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", 222 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 223 | ] 224 | 225 | [[package]] 226 | name = "redox_syscall" 227 | version = "0.1.43" 228 | source = "registry+https://github.com/rust-lang/crates.io-index" 229 | 230 | [[package]] 231 | name = "redox_termios" 232 | version = "0.1.1" 233 | source = "registry+https://github.com/rust-lang/crates.io-index" 234 | dependencies = [ 235 | "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", 236 | ] 237 | 238 | [[package]] 239 | name = "remove_dir_all" 240 | version = "0.5.1" 241 | source = "registry+https://github.com/rust-lang/crates.io-index" 242 | dependencies = [ 243 | "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", 244 | ] 245 | 246 | [[package]] 247 | name = "rustc-demangle" 248 | version = "0.1.9" 249 | source = "registry+https://github.com/rust-lang/crates.io-index" 250 | 251 | [[package]] 252 | name = "ryu" 253 | version = "0.2.7" 254 | source = "registry+https://github.com/rust-lang/crates.io-index" 255 | 256 | [[package]] 257 | name = "semver" 258 | version = "0.9.0" 259 | source = "registry+https://github.com/rust-lang/crates.io-index" 260 | dependencies = [ 261 | "semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", 262 | "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", 263 | ] 264 | 265 | [[package]] 266 | name = "semver-parser" 267 | version = "0.7.0" 268 | source = "registry+https://github.com/rust-lang/crates.io-index" 269 | 270 | [[package]] 271 | name = "serde" 272 | version = "1.0.80" 273 | source = "registry+https://github.com/rust-lang/crates.io-index" 274 | 275 | [[package]] 276 | name = "serde_derive" 277 | version = "1.0.80" 278 | source = "registry+https://github.com/rust-lang/crates.io-index" 279 | dependencies = [ 280 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 281 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 282 | "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", 283 | ] 284 | 285 | [[package]] 286 | name = "serde_json" 287 | version = "1.0.33" 288 | source = "registry+https://github.com/rust-lang/crates.io-index" 289 | dependencies = [ 290 | "itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", 291 | "ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", 292 | "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)", 293 | ] 294 | 295 | [[package]] 296 | name = "strsim" 297 | version = "0.7.0" 298 | source = "registry+https://github.com/rust-lang/crates.io-index" 299 | 300 | [[package]] 301 | name = "syn" 302 | version = "0.15.22" 303 | source = "registry+https://github.com/rust-lang/crates.io-index" 304 | dependencies = [ 305 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 306 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 307 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 308 | ] 309 | 310 | [[package]] 311 | name = "synstructure" 312 | version = "0.10.1" 313 | source = "registry+https://github.com/rust-lang/crates.io-index" 314 | dependencies = [ 315 | "proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)", 316 | "quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", 317 | "syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)", 318 | "unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 319 | ] 320 | 321 | [[package]] 322 | name = "tempdir" 323 | version = "0.3.7" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | dependencies = [ 326 | "rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)", 327 | "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", 328 | ] 329 | 330 | [[package]] 331 | name = "termion" 332 | version = "1.5.1" 333 | source = "registry+https://github.com/rust-lang/crates.io-index" 334 | dependencies = [ 335 | "libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)", 336 | "redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", 337 | "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 338 | ] 339 | 340 | [[package]] 341 | name = "textwrap" 342 | version = "0.10.0" 343 | source = "registry+https://github.com/rust-lang/crates.io-index" 344 | dependencies = [ 345 | "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 346 | ] 347 | 348 | [[package]] 349 | name = "unicode-width" 350 | version = "0.1.5" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | 353 | [[package]] 354 | name = "unicode-xid" 355 | version = "0.1.0" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | 358 | [[package]] 359 | name = "vec_map" 360 | version = "0.8.1" 361 | source = "registry+https://github.com/rust-lang/crates.io-index" 362 | 363 | [[package]] 364 | name = "walkdir" 365 | version = "0.1.8" 366 | source = "registry+https://github.com/rust-lang/crates.io-index" 367 | dependencies = [ 368 | "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 369 | "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", 370 | ] 371 | 372 | [[package]] 373 | name = "winapi" 374 | version = "0.2.8" 375 | source = "registry+https://github.com/rust-lang/crates.io-index" 376 | 377 | [[package]] 378 | name = "winapi" 379 | version = "0.3.6" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | dependencies = [ 382 | "winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 383 | "winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", 384 | ] 385 | 386 | [[package]] 387 | name = "winapi-build" 388 | version = "0.1.1" 389 | source = "registry+https://github.com/rust-lang/crates.io-index" 390 | 391 | [[package]] 392 | name = "winapi-i686-pc-windows-gnu" 393 | version = "0.4.0" 394 | source = "registry+https://github.com/rust-lang/crates.io-index" 395 | 396 | [[package]] 397 | name = "winapi-x86_64-pc-windows-gnu" 398 | version = "0.4.0" 399 | source = "registry+https://github.com/rust-lang/crates.io-index" 400 | 401 | [metadata] 402 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" 403 | "checksum assert_cli 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a29ab7c0ed62970beb0534d637a8688842506d0ff9157de83286dacd065c8149" 404 | "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" 405 | "checksum backtrace 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "89a47830402e9981c5c41223151efcced65a0510c13097c769cede7efb34782a" 406 | "checksum backtrace-sys 0.1.24 (registry+https://github.com/rust-lang/crates.io-index)" = "c66d56ac8dabd07f6aacdaf633f4b8262f5b3601a810a0dcddffd5c22c69daa0" 407 | "checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12" 408 | "checksum cargo_metadata 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7d8dfe3adeb30f7938e6c1dd5327f29235d8ada3e898aeb08c343005ec2915a2" 409 | "checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" 410 | "checksum cfg-if 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4" 411 | "checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e" 412 | "checksum colored 1.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dc0a60679001b62fb628c4da80e574b9645ab4646056d7c9018885efffe45533" 413 | "checksum copy_dir 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6e4281031634644843bd2f5aa9c48cf98fc48d6b083bd90bb11becf10deaf8b0" 414 | "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198" 415 | "checksum environment 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1f4b14e20978669064c33b4c1e0fb4083412e40fe56cbea2eae80fd7591503ee" 416 | "checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02" 417 | "checksum failure 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "6dd377bcc1b1b7ce911967e3ec24fa19c3224394ec05b54aa7b083d498341ac7" 418 | "checksum failure_derive 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "64c2d913fe8ed3b6c6518eedf4538255b989945c14c2a7d5cbff62a5e2120596" 419 | "checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" 420 | "checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" 421 | "checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" 422 | "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" 423 | "checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1" 424 | "checksum libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)" = "10923947f84a519a45c8fefb7dd1b3e8c08747993381adee176d7a82b4195311" 425 | "checksum proc-macro2 0.4.24 (registry+https://github.com/rust-lang/crates.io-index)" = "77619697826f31a02ae974457af0b29b723e5619e113e9397b8b82c6bd253f09" 426 | "checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c" 427 | "checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd" 428 | "checksum redox_syscall 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "679da7508e9a6390aeaf7fbd02a800fdc64b73fe2204dd2c8ae66d22d9d5ad5d" 429 | "checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76" 430 | "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" 431 | "checksum rustc-demangle 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "bcfe5b13211b4d78e5c2cadfebd7769197d95c639c35a50057eb4c05de811395" 432 | "checksum ryu 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7" 433 | "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" 434 | "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" 435 | "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef" 436 | "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c" 437 | "checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811" 438 | "checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550" 439 | "checksum syn 0.15.22 (registry+https://github.com/rust-lang/crates.io-index)" = "ae8b29eb5210bc5cf63ed6149cbf9adfc82ac0be023d8735c176ee74a2db4da7" 440 | "checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" 441 | "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" 442 | "checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096" 443 | "checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6" 444 | "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" 445 | "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" 446 | "checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a" 447 | "checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" 448 | "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" 449 | "checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" 450 | "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" 451 | "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 452 | "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 453 | --------------------------------------------------------------------------------