abbaye/config.rs
1use std::path::PathBuf;
2
3use serde::Deserialize;
4
5use crate::{
6 builders::AnyBuilder, changelog::ChangelogConfig, version_extractors::AnyVersionExtractor,
7};
8
9/// General website metadata.
10#[derive(Debug, Deserialize)]
11pub struct SiteConfig {
12 /// Display name of the project, used in page titles and headings.
13 pub name: String,
14 /// Path to the README file rendered on each version page.
15 /// Defaults to `README.md` in the current working directory.
16 pub readme: Option<PathBuf>,
17}
18
19/// A full configuration for the Abbaye site generator.
20///
21/// Here's a sample configuration that works well as a starting point for rust projects:
22///
23/// ```toml
24/// [site]
25/// name = "Abbaye"
26///
27/// [version_extractor]
28/// type = "cargo" # extract version from Cargo.toml
29///
30/// [changelog]
31/// # let's use the default changelog extractor
32///
33/// [[builders]]
34/// type = "cargo" # calls `cargo build --release` for each target
35/// targets = ["x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl"]
36/// [[builders]]
37/// type = "cargo_doc" # generates documentation using `cargo doc`
38/// no_deps = true
39///
40/// [[builders]]
41/// type = "archive" # creates a compressed tarball of the source code
42/// ```
43///
44/// You can learn more about each builder type in the [builders module documentation](crate::builders).
45///
46#[derive(Debug, Deserialize)]
47pub struct AbbayeConfig {
48 pub site: SiteConfig,
49 pub version_extractor: AnyVersionExtractor,
50 pub changelog: ChangelogConfig,
51 pub builders: Vec<AnyBuilder>,
52 #[serde(default = "abbaye2_output_dir")]
53 pub output_dir: Option<PathBuf>,
54}
55
56fn abbaye2_output_dir() -> Option<PathBuf> {
57 Some(PathBuf::from("public"))
58}