use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::Read;
use std::path::Path;
mod error;
pub use error::Error;
use crate::{android, ios};
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Spec {
pub app: AppSpec,
}
impl Spec {
pub fn open<P>(path: P) -> Result<Spec, Error>
where
P: AsRef<Path>,
{
let mut file = File::open(path)?;
let mut bytes = vec![];
file.read_to_end(&mut bytes)?;
Ok(toml::from_slice::<Spec>(&bytes)?)
}
}
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct AppSpec {
pub name: String,
pub version: String,
pub ios: ios::Spec,
pub android: android::Spec,
}