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 /// Canonical base URL of the published site (e.g. `"https://example.com"`).
18 /// When set, the generated `releases.atom` feed will include absolute links
19 /// and proper entry IDs. Trailing slashes are stripped automatically.
20 pub base_url: Option<String>,
21}
22
23/// A full configuration for the Abbaye site generator.
24///
25/// Here's a sample configuration that works well as a starting point for rust projects:
26///
27/// ```toml
28/// [site]
29/// name = "Abbaye"
30///
31/// [version_extractor]
32/// type = "cargo" # extract version from Cargo.toml
33///
34/// [changelog]
35/// # let's use the default changelog extractor
36///
37/// [[builders]]
38/// type = "cargo" # calls `cargo build --release` for each target
39/// targets = ["x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl"]
40/// [[builders]]
41/// type = "cargo_doc" # generates documentation using `cargo doc`
42/// no_deps = true
43///
44/// [[builders]]
45/// type = "archive" # creates a compressed tarball of the source code
46/// ```
47///
48/// You can learn more about each builder type in the [builders module documentation](crate::builders).
49///
50#[derive(Debug, Deserialize)]
51pub struct AbbayeConfig {
52 pub site: SiteConfig,
53 pub version_extractor: AnyVersionExtractor,
54 pub changelog: ChangelogConfig,
55 pub builders: Vec<AnyBuilder>,
56 #[serde(default = "abbaye2_output_dir")]
57 pub output_dir: Option<PathBuf>,
58}
59
60fn abbaye2_output_dir() -> Option<PathBuf> {
61 Some(PathBuf::from("public"))
62}