diff --git a/examples/debian.yml b/examples/debian.yml new file mode 100644 index 0000000..b01ba9d --- /dev/null +++ b/examples/debian.yml @@ -0,0 +1,31 @@ +systems: +- fetch: + exe: sudo + params: + - apt + - update + current_dir: null + env: {} + compile: null + install: + exe: sudo + params: + - apt + - upgrade + current_dir: null + env: {} +- install: + exe: rustup + params: + - update + current_dir: null + env: {} +- install: + exe: cargo + params: + - install-update + - -a + current_dir: null + env: {} +steps: Install +nice: null diff --git a/examples/openSUSE.yml b/examples/openSUSE.yml index a3c8864..f921950 100644 --- a/examples/openSUSE.yml +++ b/examples/openSUSE.yml @@ -1,35 +1,30 @@ systems: - fetch: - command: - exe: sudo - params: - - zypper - - refresh - current_dir: null - env: {} + exe: sudo + params: + - zypper + - refresh + current_dir: null + env: {} compile: null install: - command: - exe: sudo - params: - - zypper - - dup - current_dir: null - env: {} + exe: sudo + params: + - zypper + - dup + current_dir: null + env: {} - install: - command: - exe: rustup - params: - - update - current_dir: null - env: {} + exe: rustup + params: + - update + current_dir: null + env: {} - install: - command: - exe: cargo - params: - - install-update - - -a - current_dir: null - env: {} + exe: cargo + params: + - install-update + - -a + current_dir: null + env: {} steps: Install -nice: null diff --git a/src/command.rs b/src/command.rs index b89828e..8d58b8f 100644 --- a/src/command.rs +++ b/src/command.rs @@ -18,33 +18,18 @@ enum UpdateSteps { pub struct Updater { systems: Vec, steps: UpdateSteps, - nice: Option, } #[derive(Debug, Serialize, Deserialize)] pub struct System { - fetch: Option, - compile: Option, - install: Install, + //name: String, + fetch: Option, + compile: Option, + install: Cmd, // deps or rDeps : Tree // exclusive_with : List } -#[derive(Debug, Serialize, Deserialize)] -pub struct Fetch { - command: Cmd, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Compile { - command: Cmd, -} - -#[derive(Debug, Serialize, Deserialize)] -pub struct Install { - command: Cmd, -} - #[derive(Debug, Serialize, Deserialize)] struct Cmd { exe: String, @@ -58,14 +43,11 @@ impl Updater { let mut up = Updater { systems: vec![], steps: UpdateSteps::Fetch, - nice: None, }; up.systems.push(System { fetch: None, compile: None, - install: Install { - command: Cmd::new(), - }, + install: Cmd::new(), }); up } @@ -134,20 +116,20 @@ impl Updater { impl System { pub fn fetch(&self) -> Result<()> { if let Some(fetch) = &self.fetch { - fetch.command.execute()?; + fetch.execute()?; } Ok(()) } pub fn compile(&self) -> Result<()> { if let Some(compile) = &self.compile { - compile.command.execute()?; + compile.execute()?; } Ok(()) } pub fn install(&self) -> Result<()> { - self.install.command.execute()?; + self.install.execute()?; Ok(()) } }