-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add unraid module and fix docgen (#6)
- Loading branch information
1 parent
58970f0
commit b251357
Showing
9 changed files
with
60 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
node_modules | ||
.env | ||
dist | ||
docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Executor } from '../../../instance/executor'; | ||
import { UnraidModuleExtensionBase } from '../unraid-module-extension-base'; | ||
|
||
export class UnraidModuleCaseModelExtension< | ||
ExecutorConfig, | ||
Ex extends Executor<ExecutorConfig> | ||
> extends UnraidModuleExtensionBase<ExecutorConfig, Ex> { | ||
async getCaseModel(): Promise<string> { | ||
const { code, stdout } = await this.instance.execute(`cat /boot/config/plugins/dynamix/case-model.cfg`); | ||
if (code !== 0) throw new Error('Got non-zero exit code while getting case-model'); | ||
|
||
return stdout.join(''); | ||
} | ||
|
||
async setCaseModel(caseModel: string): Promise<void> { | ||
const { code } = await this.instance.execute(`echo ${caseModel} > /boot/config/plugins/dynamix/case-model.cfg`); | ||
if (code !== 0) throw new Error('Got non-zero exit code while writing case-model'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './casemodel'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * as UnraidModule from './unraid-module'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Executor } from '../../instance/executor'; | ||
import { Unraid } from '../../instance/unraid'; | ||
|
||
export class UnraidModuleExtensionBase<ExecutorConfig, Ex extends Executor<ExecutorConfig>> { | ||
readonly instance: Unraid<ExecutorConfig, Ex>; | ||
|
||
constructor(instance: Unraid<ExecutorConfig, Ex>) { | ||
this.instance = instance; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { mix } from 'ts-mixer'; | ||
import { Executor } from '../../instance/executor'; | ||
import { Unraid } from '../../instance/unraid'; | ||
import { UnraidModuleCaseModelExtension } from './extensions'; | ||
|
||
// required for mixins | ||
export interface UnraidModule<ExecutorConfig, Ex extends Executor<ExecutorConfig>> | ||
extends UnraidModuleCaseModelExtension<ExecutorConfig, Ex> { | ||
instance: Unraid<ExecutorConfig, Ex>; | ||
} | ||
|
||
@mix(UnraidModuleCaseModelExtension) | ||
export class UnraidModule<ExecutorConfig, Ex extends Executor<ExecutorConfig>> { | ||
instance: Unraid<ExecutorConfig, Ex>; | ||
|
||
constructor(instance: Unraid<ExecutorConfig, Ex>) { | ||
this.instance = instance; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
{ | ||
"name": "Unraid API Client", | ||
"entryPoints": ["src/index.ts"], | ||
"entryPoints": ["src/modules/"], | ||
"entryPointStrategy": "Expand", | ||
"out": "docs", | ||
"theme": "minimal", | ||
"includeVersion": true, | ||
"toc": ["System", "Virtual Machines"] | ||
"theme": "default", | ||
"includeVersion": true | ||
} |