Skip to main content

build

Function build 

Source
pub fn build(
    planned: &Planned,
    root: &Path,
    out: &Path,
) -> Result<PackVerdict, String>
Expand description

Write a planned pack into out, which must be absent, empty, or a pack this command wrote (it holds a manifest); then verify what was written.

The examples below plan a repository holding main.rs and a logo.png whose content is binary, with a distribution whose chat profile has limits and whose bare one has none.

use majordomus_cli::pack::{build, plan, INDEX, MANIFEST};
let out = dir.path().join("pack");
let verdict = build(&plan(&root, &share, None), &root, &out).unwrap();
assert!(verdict.passes, "{:?}", verdict.findings);
assert!(out.join(INDEX).is_file() && out.join(MANIFEST).is_file());
// a plan with a finding is never written
let refused = build(&plan(&root, &share, Some("bare")), &root, &out);
assert!(refused.is_err());