use serde::{Deserialize, Serialize};
use std::process::Command;
pub const PROJECTS_DIR: &str = "~/.panbuild/projects/";
#[derive(Serialize, Deserialize, Default)]
pub struct Project {
pub id: String,
pub name: String,
pub summary: String,
pub description: String,
pub web_urls: Vec<String>,
pub vcs_urls: Vec<String>,
pub artifact_names: Vec<String>,
pub maintainers: Vec<String>,
pub versions: Vec<String>,
pub keywords: Vec<String>,
pub is_core: bool,
pub layer: i32,
}
impl Project {
fn to_rust(self: &Self) -> String {
let mut response: String = String::from("crate::projects::project::Project {\n");
response.push_str(&format!(" id: \"{}\".to_string(),", self.id).to_string());
response.push_str(&format!(" name: \"{}\".to_string(),", self.name).to_string());
response.push_str(&format!(" summary: \"{}\".to_string(),", self.summary).to_string());
response.push_str(&format!(" description: \"{}\".to_string(),", self.description).to_string());
response.push_str("}");
response
}
}
#[derive(Serialize, Deserialize, Default)]
pub struct ProjectVersion {
pub project_id: String,
pub name: String,
pub url: String,
pub url_type: crate::manifests::manifest::SourceType,
pub tag: String,
pub branch: String,
pub sha256sum: String,
pub dependencies: Vec<Dependancy>,
}
#[derive(Serialize, Deserialize, Default)]
pub struct SemanticVersion {
pub major: i32,
pub minor: i32,
pub patch: i32,
}
#[derive(Serialize, Deserialize, Default)]
pub struct Dependancy {
pub min_version: SemanticVersion,
pub max_version: SemanticVersion,
pub project_id: String,
}