quanttide_devops/contract/
mod.rs1pub mod error;
5pub mod model;
6
7pub use error::ContractError;
8pub use model::{
9 BuildTool, Contract, Language, Pipeline, Platform, Registry, Scope, Source, SourceControl,
10 SourceType, Stage, StageBuild, StageRelease, StageTest, VersionSource,
11 detect_language_by_files,
12};
13
14use std::path::Path;
15
16pub fn load(repo_path: &Path) -> Result<Contract, ContractError> {
18 let path = repo_path.join(".quanttide/devops/contract.yaml");
19 let content = std::fs::read_to_string(&path)?;
20 load_from_str(&content)
21}
22
23pub fn load_from_str(s: &str) -> Result<Contract, ContractError> {
25 serde_yaml::from_str::<Contract>(s).map_err(|e| ContractError::Parse(e.to_string()))
26}