Skip to content
This repository has been archived by the owner on Nov 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #75 from FlorentinDUBOIS/feat/profile
Browse files Browse the repository at this point in the history
feat(profile): add build profile in version
  • Loading branch information
d33d33 authored Jul 17, 2018
2 parents b08303a + efb11c5 commit 785f737
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::process::Command;
use std::path::Path;
use std::env;
use std::fs::File;
use std::io::prelude::*;

Expand All @@ -11,7 +12,9 @@ fn main() {
.expect("failed to execute process");

let hash = String::from_utf8_lossy(&output.stdout);
let content = format!("static COMMIT: &'static str = {:?};\n", hash.trim());
let profile = env::var("PROFILE").expect("Expect to be built using cargo");
let mut content = format!("static COMMIT: &'static str = {:?};\n", hash.trim());
content += &format!("static PROFILE: &'static str = {:?};\n", profile);

let path = Path::new("./src/version.rs");

Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ fn main() {
log::bootstrap();

let matches = App::new("beamium")
.version(&*format!("{} ({})", env!("CARGO_PKG_VERSION"), COMMIT))
.version(&*format!(
"{} ({}#{})",
env!("CARGO_PKG_VERSION"),
COMMIT,
PROFILE,
))
.author("d33d33 <[email protected]>")
.about("Send Prometheus metrics to Warp10")
.args_from_usage(
Expand Down

0 comments on commit 785f737

Please sign in to comment.