1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use spurs::{cmd, SshCommand};
pub fn rpm_install(pkg: &str) -> SshCommand {
cmd!("sudo rpm -ivh {}", pkg)
}
pub fn yum_install(pkgs: &[&str]) -> SshCommand {
cmd!("sudo yum install -y {}", pkgs.join(" "))
}
#[cfg(test)]
mod test {
use spurs::SshCommand;
#[test]
fn test_rpm_install() {
assert_eq!(
super::rpm_install("foobar"),
SshCommand::make_cmd(
"sudo rpm -ivh foobar".into(),
None,
false,
false,
false,
false,
),
);
}
#[test]
fn test_yum_install() {
assert_eq!(
super::yum_install(&["foobar"]),
SshCommand::make_cmd(
"sudo yum install -y foobar".into(),
None,
false,
false,
false,
false,
),
);
}
}