diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2024-04-20 16:38:35 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2024-04-20 16:42:14 +0200 |
commit | 334f764cbffa8d591a007f0fec962f58cf0efde4 (patch) | |
tree | 3e6c4227b107693cd5d2298cd51cdaa015dda675 /crates/rebel/src/main.rs | |
parent | edf1d5a5cea4bfb662696f3b5c24dbd95e1733c1 (diff) | |
download | rebel-334f764cbffa8d591a007f0fec962f58cf0efde4.tar rebel-334f764cbffa8d591a007f0fec962f58cf0efde4.zip |
Introduce rebel-resolve module
It would be nice to reduce the dependencies of the driver on the context
further, so more of rebel-resolve can become private.
Diffstat (limited to 'crates/rebel/src/main.rs')
-rw-r--r-- | crates/rebel/src/main.rs | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/crates/rebel/src/main.rs b/crates/rebel/src/main.rs index 76b4551..fe0671b 100644 --- a/crates/rebel/src/main.rs +++ b/crates/rebel/src/main.rs @@ -1,17 +1,13 @@ -mod args; -mod context; mod driver; -mod paths; -mod pin; mod recipe; -mod resolve; -mod task; mod template; -use std::collections::HashSet; +use std::{collections::HashSet, fs::File, path::Path}; use clap::Parser; +use rebel_common::error::*; +use rebel_resolve::{self as resolve, context, pin}; use rebel_runner::{self as runner, Runner}; #[derive(Parser)] @@ -29,6 +25,14 @@ struct Opts { tasks: Vec<String>, } +fn read_pins<P: AsRef<Path>>(path: P) -> Result<pin::Pins> { + let f = File::open(path)?; + let pins: pin::Pins = serde_yaml::from_reader(f) + .map_err(Error::new) + .context("YAML error")?; + Ok(pins) +} + fn main() { let opts: Opts = Opts::parse(); @@ -36,7 +40,7 @@ fn main() { let ctx = context::Context::new( recipe::read_recipes("examples/recipes").unwrap(), - pin::read_pins("examples/pins.yml").unwrap(), + read_pins("examples/pins.yml").unwrap(), ) .unwrap(); |