Skip to main content

abbaye/
main.rs

1//! # Abbaye
2//!
3//! Abbaye is a Static Site Generator (SSG) for your software. As GitHub,
4//! Gitea, Forgejo and consorts offer, Abbaye can be used to generate a
5//! website with your software's presentation, documentation, and distribution, per version.
6//!
7//! Here's an example file structure:
8//!
9//! ```text
10//! .
11//! ├── index.html # the main page of the website, enabling choosing a version, defaults to "latest" (contains a list of available versions and a iframe to the selected version?)
12//! ├── latest -> v2.0.0 # symlink to the latest version (biggest version number)
13//! ├── v1.0.0/ # the directory containing the version 1.0.0 of the software
14//! │   ├── index.html # the main page of the version 1.0.0, from the README.md file.
15//! │   │   # Contains a sidebar with links to the documentation and distribution.
16//! │   │   # After the readme content, A changelog is displayed.
17//! │   ├── docs/ # the directory containing the documentation of the version 1.0.0
18//! │   │   ├── index.html # the main page of the documentation of the version 1.0.0
19//! │   │   └── …
20//! │   ├── docs.tar.gz # the tarball containing the documentation of the version 1.0.0
21//! │   └── dist/ # the directory containing the distribution of the version 1.0.0
22//! │       ├── source.tgz # the source code of the version 1.0.0
23//! │       ├── mybin-v1.0.0-x86_64-unknown-linux-gnu
24//! │       └── mybin-v1.0.0-x86_64-unknown-linux-musl
25//! └── v2.0.0/ # the directory containing the version 2.0.0 of the software
26//!     ├── index.html # the main page of the version 2.0.0
27//!     ├── …
28//!     └── …
29//! ```
30
31use miette::Result;
32
33/// All builders for the site (ex: cargo build, cargo doc, etc.).
34pub mod builders;
35/// Parses the changelog file and generates a changelog page for the site.
36pub mod changelog;
37/// Handles the `abbaye.toml` configuration file.
38pub mod config;
39/// Generates the site from the configuration and builds it.
40pub mod site;
41/// Extracts current version information from different sources (ex: git tags, cargo metadata, etc.).
42pub mod version_extractors;
43
44#[tokio::main]
45async fn main() -> Result<()> {
46    tracing_subscriber::fmt()
47        .with_timer(tracing_subscriber::fmt::time::SystemTime)
48        .with_env_filter(tracing_subscriber::EnvFilter::from_default_env())
49        .init();
50
51    let config = site::load_config()?;
52    site::build_site(config).await
53}