From d3434e8408989fbed3b5b102448852dfbf1bbc98 Mon Sep 17 00:00:00 2001 From: Edward Shen Date: Thu, 15 Jul 2021 02:45:05 -0400 Subject: [PATCH] Fix includes for publishing --- Cargo.toml | 9 ++++++++- src/main.rs | 54 +++++++++++++++++++++++++++----------------------- src/metrics.rs | 2 +- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index db94078..b9278ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,14 @@ version = "0.5.0" license = "GPL-3.0-or-later" authors = ["Edward Shen "] edition = "2018" -include = ["src/**/*", "db_queries", "LICENSE", "README.md", "sqlx-data.json"] +include = [ + "src/**/*", + "db_queries", + "LICENSE", + "README.md", + "sqlx-data.json", + "settings.sample.yaml" +] description = "A MangaDex@Home implementation in Rust." repository = "https://github.com/edward-shen/mangadex-home-rs" diff --git a/src/main.rs b/src/main.rs index 3f84c7f..920b596 100644 --- a/src/main.rs +++ b/src/main.rs @@ -260,31 +260,35 @@ impl Display for InvalidCombination { impl Error for InvalidCombination {} fn print_preamble_and_warnings(args: &Config) -> Result<(), Box> { - println!(concat!( - env!("CARGO_PKG_NAME"), - " ", - env!("CARGO_PKG_VERSION"), - " (", - env!("VERGEN_GIT_SHA_SHORT"), - ")", - " Copyright (C) 2021 ", - env!("CARGO_PKG_AUTHORS"), - "\n\n", - env!("CARGO_PKG_NAME"), - " is free software: you can redistribute it and/or modify\n\ - it under the terms of the GNU General Public License as published by\n\ - the Free Software Foundation, either version 3 of the License, or\n\ - (at your option) any later version.\n\n", - env!("CARGO_PKG_NAME"), - " is distributed in the hope that it will be useful,\n\ - but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ - GNU General Public License for more details.\n\n\ - You should have received a copy of the GNU General Public License\n\ - along with ", - env!("CARGO_PKG_NAME"), - ". If not, see .\n" - )); + let build_string = option_env!("VERGEN_GIT_SHA_SHORT") + .map(|git_sha| format!(" ({})", git_sha)) + .unwrap_or_default(); + + println!( + concat!( + env!("CARGO_PKG_NAME"), + " ", + env!("CARGO_PKG_VERSION"), + "{} Copyright (C) 2021 ", + env!("CARGO_PKG_AUTHORS"), + "\n\n", + env!("CARGO_PKG_NAME"), + " is free software: you can redistribute it and/or modify\n\ + it under the terms of the GNU General Public License as published by\n\ + the Free Software Foundation, either version 3 of the License, or\n\ + (at your option) any later version.\n\n", + env!("CARGO_PKG_NAME"), + " is distributed in the hope that it will be useful,\n\ + but WITHOUT ANY WARRANTY; without even the implied warranty of\n\ + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\ + GNU General Public License for more details.\n\n\ + You should have received a copy of the GNU General Public License\n\ + along with ", + env!("CARGO_PKG_NAME"), + ". If not, see .\n" + ), + build_string + ); if args.ephemeral_disk_encryption { error!("Encrypted files are _very_ broken; caveat emptor!"); diff --git a/src/metrics.rs b/src/metrics.rs index 2ff2288..11b1fe6 100644 --- a/src/metrics.rs +++ b/src/metrics.rs @@ -111,7 +111,7 @@ pub async fn load_geo_ip_data(license_key: ClientSecret) -> Result<(), DbLoadErr } }) .unwrap_or(SystemTime::UNIX_EPOCH); - let duration = match SystemTime::now().duration_since(dbg!(db_date_created)) { + let duration = match SystemTime::now().duration_since(db_date_created) { Ok(time) => Duration::from_std(time).expect("duration to fit"), Err(_) => { warn!("Clock may have gone backwards?");