pub fn version_projection(root: &Path) -> ArtifactExpand description
The projection of the version the shell tool reads at start-up, share/version.txt.
Its value is the authority read directly — crate::release::version::declared — and
not this executable’s own constant, which the foreign-generation guard of
majordomus generate has already proved equal to it wherever the crate’s sources are.
Part of the distribution target because it is part of what the distribution ships: every
archive carries share/ whole, and the release plan’s generate distribution --check
holds it.
use majordomus_cli::generate::version_projection;
use majordomus_cli::release::version::{parse_projection, MANIFEST, PROJECTION};
let dir = tempfile::tempdir().unwrap();
std::fs::create_dir_all(dir.path().join("apps/majordomus-cli")).unwrap();
std::fs::write(dir.path().join(MANIFEST), "[package]\nversion = \"0.9.0\"\n").unwrap();
let artifact = version_projection(dir.path());
assert_eq!(artifact.path, PROJECTION);
assert!(artifact.content.starts_with("# GENERATED FILE"));
assert_eq!(parse_projection(&artifact.content).as_deref(), Some("0.9.0"));