yagit

Yet another static site generator for Git 🙀️

NameSizeMode
..
build.rs 814 bytes -rw-r--r--
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::{fs::File, io::Write};

static_toml::static_toml! {
  static CONFIG = include_toml!("config.toml");
}

const STORE_PATH:          &str = CONFIG.git.store_path;
const PRIVATE_STORE_PATH:  &str = CONFIG.git.private_store_path;
const OUTPUT_PATH:         &str = CONFIG.output.path;
const PRIVATE_OUTPUT_ROOT: &str = CONFIG.output.private_output_root;

const MAN_SRC: &str = include_str!("src/yagit.1");

fn main() {
  let man_src = MAN_SRC
    .replace("PRIVATE_STORE_PATH", PRIVATE_STORE_PATH)
    .replace("STORE_PATH", STORE_PATH)
    .replace("OUTPUT_PATH", OUTPUT_PATH)
    .replace("PRIVATE_OUTPUT_ROOT", PRIVATE_OUTPUT_ROOT);

  let mut man_page = File::create("yagit.1")
    .expect("Could not create \"yagit.1\"");

  write!(&mut man_page, "{}", man_src).expect("Could not write to \"yagit.1\"");
}