Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion src/installers/BepInExInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { InstallArgs, InstallerCapability, PackageInstaller } from "./PackageInstaller";
import path from "path";
import FsProvider from "../providers/generic/file/FsProvider";
import { MODLOADER_PACKAGES } from "../r2mm/installing/profile_installers/ModLoaderVariantRecord";
Expand All @@ -7,6 +7,15 @@ import { PackageLoader } from "../model/installing/PackageLoader";
const basePackageFiles = ["manifest.json", "readme.md", "icon.png"];

export class BepInExInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

/**
* Handles installation of BepInEx
*/
Expand Down Expand Up @@ -39,4 +48,16 @@ export class BepInExInstaller extends PackageInstaller {
}
}
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
23 changes: 22 additions & 1 deletion src/installers/GodotMLInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { InstallArgs, InstallerCapability, PackageInstaller } from "./PackageInstaller";
import path from "path";
import FsProvider from "../providers/generic/file/FsProvider";

export class GodotMLInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

/**
* Handles installation of GodotML
*/
Expand All @@ -20,4 +29,16 @@ export class GodotMLInstaller extends PackageInstaller {
await fs.copyFolder(copyFrom, copyTo);
}
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
23 changes: 22 additions & 1 deletion src/installers/InstallRuleInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { InstallArgs, InstallerCapability, PackageInstaller } from "./PackageInstaller";
import Profile from "../model/Profile";
import FsProvider from "../providers/generic/file/FsProvider";
import path from "path";
Expand Down Expand Up @@ -223,6 +223,15 @@ export class InstallRuleInstaller extends PackageInstaller {
this.rule = rules;
}

async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

/**
* Handles installation of packages according to the install rules defined
* for it.
Expand Down Expand Up @@ -267,4 +276,16 @@ export class InstallRuleInstaller extends PackageInstaller {
}
return Promise.resolve(undefined);
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
46 changes: 44 additions & 2 deletions src/installers/LovelyInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { InstallArgs, InstallerCapability, PackageInstaller } from "./PackageInstaller";
import { InstallRuleInstaller, addToStateFile } from "./InstallRuleInstaller";
import FsProvider from "../providers/generic/file/FsProvider";
import FileUtils from "../utils/FileUtils";
Expand All @@ -7,6 +7,15 @@ import R2Error from "../model/errors/R2Error";
import path from "path";

export class LovelyInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

async install(args: InstallArgs) {
const {
mod,
Expand Down Expand Up @@ -43,9 +52,30 @@ export class LovelyInstaller extends PackageInstaller {

await addToStateFile(mod, fileRelocations, profile);
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}

export class LovelyPluginInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

async install(args: InstallArgs) {
const {
mod,
Expand All @@ -63,7 +93,7 @@ export class LovelyPluginInstaller extends PackageInstaller {
if (srcTree instanceof R2Error) {
throw R2Error;
}

const srcFiles = srcTree.getRecursiveFiles();
for (const srcFile of srcFiles) {
const relFile = srcFile.replace(packagePath, "");
Expand All @@ -77,4 +107,16 @@ export class LovelyPluginInstaller extends PackageInstaller {

await addToStateFile(mod, fileRelocations, profile);
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
23 changes: 22 additions & 1 deletion src/installers/MelonLoaderInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { InstallArgs, InstallerCapability, PackageInstaller } from "./PackageInstaller";
import FsProvider from "../providers/generic/file/FsProvider";
import path from "path";

const basePackageFiles = ["manifest.json", "readme.md", "icon.png"];

export class MelonLoaderInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

/**
* Handles installation of MelonLoader
*/
Expand All @@ -21,4 +30,16 @@ export class MelonLoaderInstaller extends PackageInstaller {
}
}
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
23 changes: 22 additions & 1 deletion src/installers/NorthstarInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstallArgs, PackageInstaller } from './PackageInstaller';
import { InstallArgs, InstallerCapability, PackageInstaller } from './PackageInstaller';
import path from 'path';
import FsProvider from '../providers/generic/file/FsProvider';
import { MODLOADER_PACKAGES } from '../r2mm/installing/profile_installers/ModLoaderVariantRecord';
Expand All @@ -7,6 +7,15 @@ import { PackageLoader } from '../model/installing/PackageLoader';
const basePackageFiles = ["manifest.json", "readme.md", "icon.png"];

export class NorthstarInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

/**
* Handles installation of Northstar
*/
Expand Down Expand Up @@ -39,4 +48,16 @@ export class NorthstarInstaller extends PackageInstaller {
}
}
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
13 changes: 11 additions & 2 deletions src/installers/PackageInstaller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ export type InstallArgs = {
packagePath: string;
};

export class InstallerCapability {
install: boolean = false;
uninstall: boolean = false;
enable: boolean = false;
disable: boolean = false;
}


export abstract class PackageInstaller {
abstract capability(): Promise<InstallerCapability>;
abstract install(args: InstallArgs): Promise<void>;
// abstract disable(args: InstallArgs): Promise<void>; // TODO: Implement
// abstract uninstall(): Promise<void>; // TODO: Implement
abstract uninstall(args: InstallArgs): Promise<void>;
abstract enable(args: InstallArgs): Promise<void>;
abstract disable(args: InstallArgs): Promise<void>;
}
23 changes: 22 additions & 1 deletion src/installers/ReturnOfModdingInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { InstallArgs, InstallerCapability, PackageInstaller } from "./PackageInstaller";
import path from "path";
import FsProvider from "../providers/generic/file/FsProvider";
import { MODLOADER_PACKAGES } from "../r2mm/installing/profile_installers/ModLoaderVariantRecord";
Expand All @@ -7,6 +7,15 @@ import { PackageLoader } from "../model/installing/PackageLoader";
const basePackageFiles = ["manifest.json", "readme.md", "icon.png"];

export class ReturnOfModdingInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

/**
* Handles installation of BepInEx
*/
Expand Down Expand Up @@ -39,4 +48,16 @@ export class ReturnOfModdingInstaller extends PackageInstaller {
}
}
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
44 changes: 43 additions & 1 deletion src/installers/ShimloaderInstaller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InstallArgs, PackageInstaller } from "./PackageInstaller";
import { InstallArgs, InstallerCapability, PackageInstaller } from "./PackageInstaller";
import path from "path";
import FsProvider from "../providers/generic/file/FsProvider";
import FileTree from "../model/file/FileTree";
Expand All @@ -7,6 +7,15 @@ import R2Error from "../model/errors/R2Error";
import { InstallRuleInstaller } from "./InstallRuleInstaller";

export class ShimloaderInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

/**
* Handle installation of unreal-shimloader
*/
Expand Down Expand Up @@ -53,9 +62,30 @@ export class ShimloaderInstaller extends PackageInstaller {
await fs.mkdirs(configDir);
}
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}

export class ShimloaderPluginInstaller extends PackageInstaller {
async capability(): Promise<InstallerCapability> {
return {
install: true,
uninstall: false,
enable: false,
disable: false,
}
}

readonly installer = new InstallRuleInstaller({
gameName: "none" as any, // This isn't acutally used for actual installation but needs some value
rules: [
Expand Down Expand Up @@ -84,4 +114,16 @@ export class ShimloaderPluginInstaller extends PackageInstaller {
async install(args: InstallArgs) {
await this.installer.install(args);
}

async uninstall(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async enable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}

async disable(args: InstallArgs): Promise<void> {
throw new Error("Method not implemented.");
}
}
Loading