formatting code upload project instance to files
This commit is contained in:
parent
ce4c98ff13
commit
a0b4f00f47
65 changed files with 399 additions and 748 deletions
|
@ -1,7 +1,4 @@
|
|||
import {
|
||||
FilesChangeNotifierService,
|
||||
IHashesCache,
|
||||
} from "./files_change_notifier_service";
|
||||
import { FilesChangeNotifierService, IHashesCache } from "./files_change_notifier_service";
|
||||
import { IPipeline } from "../model/process_model";
|
||||
import { ExecutorProgramService } from "./executor_program_service";
|
||||
import { EXEC_EVENT, ExecError, SpawnError } from "../model/exec_error_model";
|
||||
|
@ -24,10 +21,7 @@ export abstract class IStackService {
|
|||
abstract init(processed: IPipeline[], path: string): void;
|
||||
}
|
||||
|
||||
export class StackService
|
||||
extends TypedEvent<Iteration[]>
|
||||
implements IStackService
|
||||
{
|
||||
export class StackService extends TypedEvent<Iteration[]> implements IStackService {
|
||||
callStack: Iteration[];
|
||||
path: string;
|
||||
constructor(processed: IPipeline[], path: string) {
|
||||
|
@ -47,11 +41,7 @@ export class StackService
|
|||
}
|
||||
}
|
||||
private commandHandler(processMetaData: IPipeline) {
|
||||
processMetaData.process.command = processMetaData.process.command.replace(
|
||||
"$PATH",
|
||||
this.path
|
||||
);
|
||||
console.log(processMetaData.process.command)
|
||||
processMetaData.process.command = processMetaData.process.command.replace("$PATH", this.path);
|
||||
return processMetaData;
|
||||
}
|
||||
public async call() {
|
||||
|
@ -63,34 +53,21 @@ export class StackService
|
|||
this.emit(this.callStack);
|
||||
}
|
||||
}
|
||||
async execStack(
|
||||
stackNumber: number,
|
||||
stackLayer: Iteration
|
||||
): Promise<void | boolean> {
|
||||
async execStack(stackNumber: number, stackLayer: Iteration): Promise<void | boolean> {
|
||||
const executorService = new ExecutorProgramService(this.path);
|
||||
|
||||
executorService.call(
|
||||
stackLayer.process.process.type,
|
||||
stackLayer.process.process.command
|
||||
);
|
||||
executorService.call(stackLayer.process.process.type, stackLayer.process.process.command);
|
||||
|
||||
const filesChangeNotifierService = new FilesChangeNotifierService(
|
||||
this.path
|
||||
);
|
||||
const filesChangeNotifierService = new FilesChangeNotifierService(this.path);
|
||||
|
||||
filesChangeNotifierService.call();
|
||||
const result = await this.waitEvent<
|
||||
Result<ExecError | SpawnError, ExecutorResult>
|
||||
>(executorService);
|
||||
const result = await this.waitEvent<Result<ExecError | SpawnError, ExecutorResult>>(executorService);
|
||||
await delay(100);
|
||||
if (result.isSuccess()) {
|
||||
this.callStack[stackNumber].result = result.value;
|
||||
this.callStack[stackNumber].hashes = filesChangeNotifierService.hashes;
|
||||
|
||||
const triggerResult = await this.triggerExec(
|
||||
stackLayer.process.trigger,
|
||||
stackNumber
|
||||
);
|
||||
const triggerResult = await this.triggerExec(stackLayer.process.trigger, stackNumber);
|
||||
triggerResult.fold(
|
||||
(s) => {
|
||||
s;
|
||||
|
@ -125,10 +102,7 @@ export class StackService
|
|||
});
|
||||
return promise;
|
||||
}
|
||||
private async triggerExec(
|
||||
trigger: Trigger | null,
|
||||
stackNumber: number
|
||||
): Promise<Result<boolean, boolean>> {
|
||||
private async triggerExec(trigger: Trigger | null, stackNumber: number): Promise<Result<boolean, boolean>> {
|
||||
if (trigger !== null) {
|
||||
const hashes = this.callStack[stackNumber].hashes;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue