diff --git a/src/models.rs b/src/models.rs index d2a8e59..ad74a12 100644 --- a/src/models.rs +++ b/src/models.rs @@ -1,9 +1,7 @@ //! Contains the Structs for the Schema of the Roxfile //! as well as the validation logic. use crate::logs; -use crate::modules::execution::model_injection::{ - inject_pipeline_metadata, inject_task_metadata, inject_template_values, -}; +use crate::modules::execution::model_injection::{inject_task_metadata, inject_template_values}; use crate::modules::execution::output; use crate::utils::{color_print, ColorEnum}; use anyhow::Result; @@ -219,7 +217,6 @@ pub struct RoxFile { pub tasks: Vec, pub pipelines: Option>, pub templates: Option>, - pub additional_files: Option>, } impl RoxFile { @@ -259,7 +256,16 @@ impl RoxFile { .collect(); // Pipelines - roxfile.pipelines = inject_pipeline_metadata(roxfile.pipelines); + if let Some(mut sorted_pipelines) = roxfile.pipelines { + sorted_pipelines.sort_by(|x, y| x.name.to_lowercase().cmp(&y.name.to_lowercase())); + roxfile.pipelines = Some(sorted_pipelines) + } + + // Docs + if let Some(mut sorted_docs) = roxfile.docs { + sorted_docs.sort_by(|x, y| x.name.to_lowercase().cmp(&y.name.to_lowercase())); + roxfile.docs = Some(sorted_docs) + } Ok(roxfile) } diff --git a/src/modules/ci.rs b/src/modules/ci.rs index 4498b7d..9f94482 100644 --- a/src/modules/ci.rs +++ b/src/modules/ci.rs @@ -135,7 +135,7 @@ pub async fn display_ci_status(ci_info: CiInfo) { .expect("Failed to retrieve workflow data!") .into_iter() .next() - .unwrap(); + .expect("Failed to retrieve workflow!"); let results: Vec = workflow_instance .list_jobs(workflow.id) @@ -144,7 +144,7 @@ pub async fn display_ci_status(ci_info: CiInfo) { .filter(Filter::All) .send() .await - .unwrap() + .expect("Failed to retrieve CI results!") .into_iter() .flat_map(|job| { let results: Vec = job diff --git a/src/modules/execution/model_injection.rs b/src/modules/execution/model_injection.rs index 3d74d95..a149a5a 100644 --- a/src/modules/execution/model_injection.rs +++ b/src/modules/execution/model_injection.rs @@ -1,16 +1,5 @@ use crate::models; -/// Inject additional metadata into each Pipeline and sort based on name. -pub fn inject_pipeline_metadata( - pipelines: Option>, -) -> Option> { - if let Some(mut some_pipelines) = pipelines { - some_pipelines.sort_by(|x, y| x.name.to_lowercase().cmp(&y.name.to_lowercase())); - return Some(some_pipelines); - } - pipelines -} - /// Get used Template's information and inject set values pub fn inject_template_values(mut task: models::Task, template: &models::Template) -> models::Task { task.command = {