#![forbid(unsafe_code)]
#[cfg(not(unix))]
compile_error!("guth-sync currently supports Unix systems with OpenSSH and rsync");
pub mod policy;
pub mod profile;
pub mod transfer;
use guth_cli::{PluginManifest, MANIFEST_SCHEMA};
use std::io;
use std::path::PathBuf;
use uuid::Uuid;
pub const PLUGIN_ID: Uuid = Uuid::from_u128(0x019f613e14ad7205a36d73f8ac49c24e);
pub fn plugin_manifest(executable: PathBuf) -> io::Result<PluginManifest> {
let manifest = PluginManifest {
schema: MANIFEST_SCHEMA,
id: PLUGIN_ID,
name: "Guth Sync".to_string(),
version: env!("CARGO_PKG_VERSION").to_string(),
executable,
description: "SSH-encrypted rsync transfers between matching Guth profiles.".to_string(),
capabilities: vec!["sync".to_string(), "sync-read-only".to_string()],
};
manifest.validate()?;
Ok(manifest)
}
#[cfg(test)]
mod tests {
use super::*;
use uuid::Version;
#[test]
fn plugin_identity_is_uuid_v7() {
assert_eq!(PLUGIN_ID.get_version(), Some(Version::SortRand));
let manifest = plugin_manifest(PathBuf::from("/usr/bin/guth-sync")).unwrap();
assert!(manifest.supports("sync"));
assert!(manifest.supports("sync-read-only"));
}
}