1pub mod cli;
4pub mod compare;
5pub mod config;
6pub mod dataset;
7pub mod dedup;
8pub mod events;
9pub mod exec;
10pub mod export;
11pub mod history;
12pub mod hub;
13pub mod llm;
14pub mod logging;
15pub mod metrics;
16pub mod pipeline;
17pub mod pricing;
18pub mod project_format;
19pub mod project_lock;
20pub mod prompts;
21pub mod retry;
22pub mod runpod;
23pub mod runs;
24pub mod secrets;
25pub mod system;
26pub mod train;
27pub mod tui;
28pub mod update;
29
30#[cfg(test)]
32pub(crate) mod test_support {
33 pub(crate) static SIGNALS: tokio::sync::Mutex<()> = tokio::sync::Mutex::const_new(());
39
40 pub(crate) fn make_executable(path: &std::path::Path) -> std::io::Result<()> {
42 use std::os::unix::fs::PermissionsExt as _;
43 std::fs::set_permissions(path, std::fs::Permissions::from_mode(0o755))
44 }
45
46 pub(crate) fn sh_available() -> bool {
48 std::process::Command::new("sh")
49 .arg("-c")
50 .arg(":")
51 .status()
52 .is_ok_and(|status| status.success())
53 }
54
55 pub(crate) fn tools_available() -> bool {
57 sh_available()
58 && ["python3", "tar"].iter().all(|program| {
59 std::process::Command::new(program)
60 .arg("--version")
61 .output()
62 .is_ok_and(|output| output.status.success())
63 })
64 }
65
66 pub(crate) fn tar(
68 dir: &std::path::Path,
69 archive: &std::path::Path,
70 top: &str,
71 ) -> Result<(), Box<dyn std::error::Error>> {
72 let status = std::process::Command::new("tar")
73 .arg("-czf")
74 .arg(archive)
75 .arg("-C")
76 .arg(dir)
77 .arg(top)
78 .status()?;
79 if status.success() {
80 Ok(())
81 } else {
82 Err(format!("tar failed: {status}").into())
83 }
84 }
85
86 pub(crate) fn text(output: &std::process::Output) -> String {
88 format!(
89 "{}{}",
90 String::from_utf8_lossy(&output.stdout),
91 String::from_utf8_lossy(&output.stderr)
92 )
93 }
94}