summaryrefslogtreecommitdiffstats
path: root/src/config/not_validated.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/not_validated.rs')
-rw-r--r--src/config/not_validated.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/config/not_validated.rs b/src/config/not_validated.rs
index 87dbc78..eab7cbc 100644
--- a/src/config/not_validated.rs
+++ b/src/config/not_validated.rs
@@ -10,6 +10,7 @@
use std::path::PathBuf;
use anyhow::anyhow;
+use anyhow::Context;
use anyhow::Result;
use getset::Getters;
use serde::Deserialize;
@@ -23,6 +24,9 @@ use crate::package::PhaseName;
#[derive(Debug, Getters, Deserialize)]
pub struct NotValidatedConfiguration {
#[getset(get = "pub")]
+ compatibility: semver::VersionReq,
+
+ #[getset(get = "pub")]
log_dir: PathBuf,
#[serde(default = "default_strict_script_interpolation")]
@@ -99,6 +103,13 @@ pub struct NotValidatedConfiguration {
impl NotValidatedConfiguration {
pub fn validate(self) -> Result<Configuration> {
+ let crate_version = semver::Version::parse(env!("CARGO_PKG_VERSION"))
+ .context("Parsing version of crate (CARGO_PKG_VERSION) into semver::Version object")?;
+
+ if !self.compatibility.matches(&crate_version) {
+ return Err(anyhow!("Configuration is not compatible to butido {}", crate_version))
+ }
+
if let Some(linter) = self.script_linter.as_ref() {
if !linter.is_file() {
return Err(anyhow!("Lint script is not a file: {}", linter.display()))