Skip to content
Snippets Groups Projects
Commit b37c45ad authored by Jorge Aparicio's avatar Jorge Aparicio
Browse files

make task.$T.priority optional

default the value to 1 if omitted
parent aa224945
No related branches found
No related tags found
No related merge requests found
...@@ -31,16 +31,8 @@ pub fn app(app: check::App) -> Result<App> { ...@@ -31,16 +31,8 @@ pub fn app(app: check::App) -> Result<App> {
resources: app.resources, resources: app.resources,
tasks: app.tasks tasks: app.tasks
.into_iter() .into_iter()
.map(|(k, v)| { .map(|(k, v)| (k, ::check::task(v)))
let name = k.clone(); .collect(),
Ok((
k,
::check::task(v)
.chain_err(|| format!("checking task `{}`", name))?,
))
})
.collect::<Result<_>>()
.chain_err(|| "checking `tasks`")?,
}; };
::check::resources(&app) ::check::resources(&app)
...@@ -68,15 +60,11 @@ fn resources(app: &App) -> Result<()> { ...@@ -68,15 +60,11 @@ fn resources(app: &App) -> Result<()> {
Ok(()) Ok(())
} }
fn task(task: syntax::check::Task) -> Result<Task> { fn task(task: syntax::check::Task) -> Task {
if let Some(priority) = task.priority { Task {
Ok(Task {
enabled: task.enabled, enabled: task.enabled,
path: task.path, path: task.path,
priority, priority: task.priority.unwrap_or(1),
resources: task.resources, resources: task.resources,
})
} else {
bail!("should contain a `priority` field")
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment