pub mod tar;
pub mod deb;
pub mod pac;
use crate::cfg::ResolvedTarget;
use crate::stage::Staging;
use anyhow::Result;
use std::path::{Path, PathBuf};
pub trait Packager
{
fn package(
&self,
staging: &Staging,
target: &ResolvedTarget,
out_dir: &Path,
name: &str,
version: &str,
) -> Result<PathBuf>;
}
pub fn packager(format: &str) -> Box<dyn Packager>
{
match format
{
"tgz" => Box::new(tar::TarGzPackager),
"deb" => Box::new(deb::DebPackager),
"pkg" => Box::new(pac::PacmanPackager),
_ => panic!("'{}' is not supported yet.", format),
}
}