feat: added command functionality to install
This commit is contained in:
parent
3a21d12c07
commit
092c616ca4
20 changed files with 464 additions and 76 deletions
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Bin {
|
||||
pub root: String,
|
||||
pub checksums: HashMap<String, String>,
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Build {
|
||||
build_script: String,
|
||||
install_script: String,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct FS {
|
||||
pub config: Option<String>,
|
||||
pub data: Option<String>,
|
||||
|
|
|
@ -8,9 +8,9 @@ pub mod fs;
|
|||
pub mod package;
|
||||
pub mod pkgr;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Manifest<P = Option<pkgr::PKGR>> {
|
||||
pub struct Manifest<P: Clone = Option<pkgr::PKGR>> {
|
||||
pub package: package::Package,
|
||||
pub dependencies: HashMap<String, String>,
|
||||
pub fs: fs::FS,
|
||||
|
@ -19,7 +19,7 @@ pub struct Manifest<P = Option<pkgr::PKGR>> {
|
|||
pub pkgr: P,
|
||||
}
|
||||
|
||||
impl<T> Manifest<T> {
|
||||
impl<P: Clone> Manifest<P> {
|
||||
pub fn valid(&self) -> bool {
|
||||
if self.bin.is_none() && self.build.is_none() {
|
||||
return false;
|
||||
|
@ -28,6 +28,13 @@ impl<T> Manifest<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl TryFrom<String> for Manifest {
|
||||
type Error = toml::de::Error;
|
||||
fn try_from(s: String) -> Result<Self, Self::Error> {
|
||||
toml::from_str(&s)
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for Manifest {
|
||||
type Err = toml::de::Error;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
|
@ -36,7 +43,7 @@ impl FromStr for Manifest {
|
|||
}
|
||||
|
||||
impl Default for Manifest {
|
||||
fn default() -> Self {
|
||||
fn default() -> Manifest {
|
||||
Manifest {
|
||||
package: package::Package::default(),
|
||||
dependencies: HashMap::default(),
|
||||
|
|
|
@ -2,7 +2,7 @@ use std::str::FromStr;
|
|||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub enum PackageType {
|
||||
#[serde(rename = "application")]
|
||||
Application,
|
||||
|
@ -12,7 +12,7 @@ pub enum PackageType {
|
|||
Meta,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Package {
|
||||
pub name: String,
|
||||
|
|
|
@ -1,4 +1,11 @@
|
|||
use std::fmt::{Display, Formatter};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct PKGR {}
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct PKGR {}
|
||||
|
||||
impl Display for PKGR {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue