summaryrefslogtreecommitdiffstats
path: root/crates/rebel/src/recipe.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/rebel/src/recipe.rs')
-rw-r--r--crates/rebel/src/recipe.rs33
1 files changed, 5 insertions, 28 deletions
diff --git a/crates/rebel/src/recipe.rs b/crates/rebel/src/recipe.rs
index 24b4bff..d0bb47e 100644
--- a/crates/rebel/src/recipe.rs
+++ b/crates/rebel/src/recipe.rs
@@ -1,35 +1,12 @@
-use std::{collections::HashMap, ffi::OsStr, fs::File, path::Path, result};
+use std::{collections::HashMap, ffi::OsStr, fs::File, path::Path};
-use scoped_tls_hkt::scoped_thread_local;
-use serde::{de::DeserializeOwned, Deserialize, Deserializer};
+use serde::{de::DeserializeOwned, Deserialize};
use walkdir::WalkDir;
-use rebel_common::{error::*, types::*};
+use rebel_common::error::*;
use crate::task::{TaskDef, TaskMeta};
-scoped_thread_local!(static CURRENT_RECIPE: str);
-
-fn current_recipe() -> String {
- CURRENT_RECIPE.with(|current| current.to_string())
-}
-
-pub fn deserialize_task_id<'de, D>(deserializer: D) -> result::Result<TaskID, D::Error>
-where
- D: Deserializer<'de>,
-{
- #[derive(Deserialize)]
- struct RecipeTaskID {
- recipe: Option<String>,
- task: String,
- }
- let RecipeTaskID { recipe, task } = RecipeTaskID::deserialize(deserializer)?;
- Ok(TaskID {
- recipe: recipe.unwrap_or_else(current_recipe),
- task,
- })
-}
-
#[derive(Clone, Debug, Deserialize, Default)]
pub struct RecipeMeta {
pub name: Option<String>,
@@ -94,7 +71,7 @@ fn read_recipe_tasks(
basename: &str,
tasks: &mut HashMap<String, HashMap<String, Vec<TaskDef>>>,
) -> Result<RecipeMeta> {
- let recipe_def = CURRENT_RECIPE.set(basename, || read_yaml::<Recipe>(path))?;
+ let recipe_def = read_yaml::<Recipe>(path)?;
let name = recipe_def
.meta
@@ -124,7 +101,7 @@ fn read_subrecipe_tasks(
tasks: &mut HashMap<String, HashMap<String, Vec<TaskDef>>>,
) -> Result<()> {
let recipe = format!("{basename}/{recipename}");
- let recipe_def = CURRENT_RECIPE.set(&recipe, || read_yaml::<Subrecipe>(path))?;
+ let recipe_def = read_yaml::<Subrecipe>(path)?;
let name = recipe_meta.name.as_deref().unwrap_or(basename).to_string();