Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/cmd/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub enum OsedaCheckError {
BadGitCredentials(String),
DirectoryNameMismatch(String),
CouldNotPingLocalPresentation(String),
MissingDescription(String)
}

impl std::error::Error for OsedaCheckError {}
Expand All @@ -41,6 +42,9 @@ impl std::fmt::Display for OsedaCheckError {
Self::CouldNotPingLocalPresentation(msg) => {
write!(f, "Could not ping localhost after project was ran {}", msg)
}
Self::MissingDescription(msg) => {
write!(f, "Config file is missing description {}", msg)
}
}
}
}
Expand Down
14 changes: 11 additions & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ pub fn validate_config(
));
}

if conf.description.is_empty() {
return Err(OsedaCheckError::MissingDescription(
"Description is missing or empty. Please update the oseda-config.json".to_owned(),
))
}


Ok(())
}

Expand All @@ -107,6 +114,7 @@ pub struct OsedaConfig {
// effectively mutable. Will get updated on each deployment
pub last_updated: DateTime<Utc>,
pub color: String,
// description must not be empty for check/deploy
pub description: String
}

Expand Down Expand Up @@ -281,7 +289,7 @@ mod test {
tags: vec![Tag::ComputerScience],
last_updated: chrono::Utc::now(),
color: Color::Black.into_hex(),
description: String::new(),
description: String::from("Test Description"),
};

let fake_dir = Path::new("/tmp/my-project");
Expand All @@ -299,7 +307,7 @@ mod test {
tags: vec![Tag::ComputerScience],
last_updated: chrono::Utc::now(),
color: Color::Black.into_hex(),
description: String::new(),
description: String::from("Test Description"),
};

let fake_dir = Path::new("/tmp/oseda");
Expand Down Expand Up @@ -337,7 +345,7 @@ mod test {
tags: vec![Tag::ComputerScience],
last_updated: chrono::Utc::now(),
color: Color::Black.into_hex(),
description: String::new(),
description: String::from("Test Description"),
};

let fake_dir = Path::new("/tmp/oseda");
Expand Down
Loading