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