1use anyhow::Result;
4pub use registry::Registry;
5use std::{path::Path, process::Command};
6
7mod registry;
8
9pub const REPO: &str = "https://github.com/spacejamapp/jam-test-vectors.git";
11
12#[cfg(not(feature = "full"))]
14pub const SCALE: &[&str] = &["tiny"];
15
16#[cfg(feature = "full")]
18pub const SCALE: &[&str] = &["tiny", "full"];
19
20pub fn run(vectors: &Path, output: &Path) -> Result<()> {
22 Registry::new(vectors, output).run()
23}
24
25pub fn download(target: &Path) -> Result<()> {
27 if target.exists() {
28 return Ok(());
29 }
30
31 Command::new("git")
32 .args([
33 "clone",
34 REPO,
35 target.to_str().expect("target is not a valid path"),
36 "--depth=1",
37 ])
38 .status()?;
39 Ok(())
40}
41
42pub fn head(target: &Path) -> Result<String> {
44 let hash = Command::new("git")
45 .args(["rev-parse", "HEAD"])
46 .current_dir(target)
47 .output()?
48 .stdout;
49 Ok(String::from_utf8(hash)?)
50}