1 use crate::configuration::Configuration;
2 use std::io::{Error, ErrorKind::Other, Result};
3 use std::process::{Command, Stdio};
5 const COMMAND: &str = "rsync";
7 pub struct PublishArchive;
10 pub fn new() -> Self {
15 impl super::Command for PublishArchive {
16 fn before_dependencies(&self) -> Vec<Box<dyn super::Command>> {
22 input: Option<&String>,
23 configuration: &Configuration,
26 let input = input.ok_or_else(|| {
27 Error::new(Other, "You must provide a location to publish the archive")
32 .stdout(Stdio::null())
33 .stderr(Stdio::null())
35 .map_err(|_| Error::new(Other, "Publishing requires rsync"))?;
41 &configuration.archive_output_directory.display()
44 .stdout(Stdio::null())
45 .stderr(Stdio::null())
47 .map_err(|_| Error::new(Other, "Rsync failed to publish."))?;
51 fn after_dependencies(&self) -> Vec<Box<dyn super::Command>> {
55 fn command(&self) -> &'static str {
59 fn help(&self) -> &'static str {
60 "<destination>\tPublishes the archive to a remote host"