Use env!("CARGO_PKG_VERSION") instead of hardcoding version when possible

See https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
This commit is contained in:
Bat 2018-10-06 18:33:10 +01:00
parent 7a64005ca9
commit 915b9bb0e5
3 changed files with 4 additions and 4 deletions

View file

@ -15,7 +15,7 @@ mod users;
fn main() { fn main() {
let mut app = App::new("Plume CLI") let mut app = App::new("Plume CLI")
.bin_name("plm") .bin_name("plm")
.version("0.2.0") .version(env!("CARGO_PKG_VERSION"))
.about("Collection of tools to manage your Plume instance.") .about("Collection of tools to manage your Plume instance.")
.subcommand(instance::command()) .subcommand(instance::command())
.subcommand(users::command()); .subcommand(users::command());

View file

@ -9,7 +9,7 @@ use std::time::SystemTime;
use activity_pub::ap_accept_header; use activity_pub::ap_accept_header;
use activity_pub::sign::Signer; use activity_pub::sign::Signer;
const USER_AGENT: &'static str = "Plume/0.2.0"; const USER_AGENT: &'static str = concat!("Plume/", env!("CARGO_PKG_VERSION"));
header! { header! {
(Signature, "Signature") => [String] (Signature, "Signature") => [String]

View file

@ -219,7 +219,7 @@ fn nodeinfo(conn: DbConn) -> Json<serde_json::Value> {
"version": "2.0", "version": "2.0",
"software": { "software": {
"name": "Plume", "name": "Plume",
"version": "0.2.0" "version": env!("CARGO_PKG_VERSION")
}, },
"protocols": ["activitypub"], "protocols": ["activitypub"],
"services": { "services": {
@ -244,7 +244,7 @@ fn about(user: Option<User>, conn: DbConn) -> Template {
"account": user.map(|u| u.to_json(&*conn)), "account": user.map(|u| u.to_json(&*conn)),
"instance": Instance::get_local(&*conn), "instance": Instance::get_local(&*conn),
"admin": Instance::get_local(&*conn).map(|i| i.main_admin(&*conn).to_json(&*conn)), "admin": Instance::get_local(&*conn).map(|i| i.main_admin(&*conn).to_json(&*conn)),
"version": "0.2.0", "version": env!("CARGO_PKG_VERSION"),
"n_users": User::count_local(&*conn), "n_users": User::count_local(&*conn),
"n_articles": Post::count_local(&*conn), "n_articles": Post::count_local(&*conn),
"n_instances": Instance::count(&*conn) - 1 "n_instances": Instance::count(&*conn) - 1