@@ -1,5 +1,6 @@
|
||||
use crate::plan::{ClonedPlan, Plan};
|
||||
use crate::project::ProjectPlan;
|
||||
use crate::state::validated_project::Project;
|
||||
use crate::state::{self, ValidatedState};
|
||||
|
||||
pub struct Start {}
|
||||
@@ -54,7 +55,7 @@ impl Cuddle<PrepareProject> {
|
||||
|
||||
impl Cuddle<PreparePlan> {
|
||||
pub async fn build_state(&self) -> anyhow::Result<Cuddle<ValidatedState>> {
|
||||
let state = if let Some(project) = &self.state.project {
|
||||
let mut state = if let Some(project) = &self.state.project {
|
||||
let state = state::State::new();
|
||||
let raw_state = state.build_state(project, &self.state.plan).await?;
|
||||
|
||||
@@ -63,6 +64,8 @@ impl Cuddle<PreparePlan> {
|
||||
ValidatedState::default()
|
||||
};
|
||||
|
||||
state.build_actions().await?;
|
||||
|
||||
Ok(Cuddle { state })
|
||||
}
|
||||
}
|
||||
@@ -79,4 +82,13 @@ impl Cuddle<ValidatedState> {
|
||||
|
||||
false
|
||||
}
|
||||
|
||||
pub fn project(&self) -> Option<&Project> {
|
||||
self.state.project.as_ref()
|
||||
}
|
||||
|
||||
pub fn must_project(&self) -> anyhow::Result<&Project> {
|
||||
self.project()
|
||||
.ok_or(anyhow::anyhow!("project is not available in this context"))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user