use include_dir::{Dir, include_dir};
pub static SAAS: Dir<'static> = include_dir!("$CARGO_MANIFEST_DIR/src/starters/saas");
#[derive(Debug)]
pub struct Builtin {
pub name: &'static str,
pub description: &'static str,
pub dir: &'static Dir<'static>,
}
pub static BUILTINS: &[Builtin] = &[Builtin {
name: "saas",
description: "Multi-tenant SaaS: session auth + row-level tenancy + tenant-scoped dashboard",
dir: &SAAS,
}];
#[must_use]
pub fn find(name: &str) -> Option<&'static Builtin> {
BUILTINS.iter().find(|b| b.name == name)
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn saas_is_registered() {
let b = find("saas").expect("saas built-in should be registered");
assert_eq!(b.name, "saas");
assert!(!b.description.is_empty());
}
#[test]
fn unknown_builtin_is_none() {
assert!(find("does-not-exist").is_none());
}
#[test]
fn saas_tree_contains_manifest() {
assert!(
SAAS.get_file(super::super::manifest::MANIFEST_FILE)
.is_some(),
"embedded saas starter must ship an autumn-starter.toml manifest"
);
}
}