initial commit

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: Ife1391ed23a1e7f388b1b5eca90b9ea76a6a6964
This commit is contained in:
raf 2026-01-29 19:36:25 +03:00
commit ef28bdaeb4
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
63 changed files with 17292 additions and 0 deletions

65
src/export/profiles.rs Normal file
View file

@ -0,0 +1,65 @@
use super::rules::Rule;
use crate::error::{PakkerError, Result};
pub trait ExportProfile {
fn name(&self) -> &str;
fn rules(&self) -> Vec<Box<dyn Rule>>;
}
pub struct CurseForgeProfile;
pub struct ModrinthProfile;
pub struct ServerPackProfile;
impl ExportProfile for CurseForgeProfile {
fn name(&self) -> &'static str {
"curseforge"
}
fn rules(&self) -> Vec<Box<dyn Rule>> {
vec![
Box::new(super::rules::CopyProjectFilesRule),
Box::new(super::rules::FilterByPlatformRule),
Box::new(super::rules::CopyOverridesRule),
Box::new(super::rules::GenerateManifestRule::curseforge()),
Box::new(super::rules::FilterNonRedistributableRule),
]
}
}
impl ExportProfile for ModrinthProfile {
fn name(&self) -> &'static str {
"modrinth"
}
fn rules(&self) -> Vec<Box<dyn Rule>> {
vec![
Box::new(super::rules::CopyProjectFilesRule),
Box::new(super::rules::FilterByPlatformRule),
Box::new(super::rules::CopyOverridesRule),
Box::new(super::rules::GenerateManifestRule::modrinth()),
]
}
}
impl ExportProfile for ServerPackProfile {
fn name(&self) -> &'static str {
"serverpack"
}
fn rules(&self) -> Vec<Box<dyn Rule>> {
vec![
Box::new(super::rules::CopyProjectFilesRule),
Box::new(super::rules::CopyServerOverridesRule),
Box::new(super::rules::FilterClientOnlyRule),
]
}
}
pub fn create_profile(name: &str) -> Result<Box<dyn ExportProfile>> {
match name {
"curseforge" => Ok(Box::new(CurseForgeProfile)),
"modrinth" => Ok(Box::new(ModrinthProfile)),
"serverpack" => Ok(Box::new(ServerPackProfile)),
_ => Err(PakkerError::InvalidExportProfile(name.to_string())),
}
}