@@ -1,7 +1,7 @@
|
||||
use validated_project::Project;
|
||||
|
||||
use crate::{
|
||||
actions::Actions,
|
||||
actions::{Actions, ExecutableActions},
|
||||
plan::{self, ClonedPlan, PlanPathExt},
|
||||
project::{self, ProjectPlan},
|
||||
schema_validator::SchemaValidator,
|
||||
@@ -43,7 +43,7 @@ impl State {
|
||||
Ok(ValidatedState {
|
||||
project: Some(project),
|
||||
plan: None,
|
||||
actions: LocalActions::default(),
|
||||
actions: ExecutableActions::default(),
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -58,20 +58,21 @@ pub struct ValidatedState {
|
||||
pub project: Option<Project>,
|
||||
pub plan: Option<Plan>,
|
||||
|
||||
pub actions: LocalActions,
|
||||
pub actions: ExecutableActions,
|
||||
}
|
||||
|
||||
impl ValidatedState {
|
||||
pub(crate) async fn build_actions(&mut self) -> anyhow::Result<&mut Self> {
|
||||
tracing::debug!("building actions");
|
||||
|
||||
let mut local_actions = LocalActions::default();
|
||||
if let Some(project) = &self.project {
|
||||
if let Some(actions) = Actions::new(&project.root, &project.value).await? {
|
||||
self.actions.add(actions);
|
||||
local_actions.add(actions);
|
||||
}
|
||||
}
|
||||
|
||||
self.actions.build().await?;
|
||||
self.actions = local_actions.build().await?;
|
||||
|
||||
Ok(self)
|
||||
}
|
||||
@@ -89,12 +90,15 @@ impl LocalActions {
|
||||
self
|
||||
}
|
||||
|
||||
pub async fn build(&mut self) -> anyhow::Result<&mut Self> {
|
||||
pub async fn build(&mut self) -> anyhow::Result<ExecutableActions> {
|
||||
let mut executable_actions = ExecutableActions::default();
|
||||
|
||||
for actions in &mut self.0 {
|
||||
actions.build().await?;
|
||||
let mut exec_actions = actions.build().await?;
|
||||
executable_actions.actions.append(&mut exec_actions.actions)
|
||||
}
|
||||
|
||||
Ok(self)
|
||||
Ok(executable_actions)
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user