made gitversion & gitreleasemanager extend dotnet-tool
This commit is contained in:
@@ -8,15 +8,14 @@ import { TYPES, IExecResult, IBuildAgent } from "./common";
|
||||
import { IVersionManager } from "./versionManager";
|
||||
|
||||
export interface IDotnetTool {
|
||||
run(args: string[]): Promise<IExecResult>;
|
||||
toolInstall(toolName: string, versionSpec: string, checkLatest: boolean, includePre: boolean): Promise<string>;
|
||||
}
|
||||
|
||||
@injectable()
|
||||
export class DotnetTool implements IDotnetTool {
|
||||
|
||||
private buildAgent: IBuildAgent;
|
||||
private versionManager: IVersionManager;
|
||||
protected buildAgent: IBuildAgent;
|
||||
protected versionManager: IVersionManager;
|
||||
private httpClient: http.HttpClient;
|
||||
|
||||
constructor(
|
||||
@@ -28,8 +27,9 @@ export class DotnetTool implements IDotnetTool {
|
||||
this.httpClient = new http.HttpClient("dotnet");
|
||||
}
|
||||
|
||||
public run(args: string[]): Promise<IExecResult> {
|
||||
return this.buildAgent.exec("dotnet", args);
|
||||
public execute(cmd: string, args: string[]): Promise<IExecResult> {
|
||||
console.log(`Command: ${cmd} ${args.join(' ')}`);
|
||||
return this.buildAgent.exec(cmd, args);
|
||||
}
|
||||
|
||||
public async toolInstall(toolName: string, versionSpec: string, checkLatest: boolean, includePre: boolean)
|
||||
@@ -131,7 +131,7 @@ export class DotnetTool implements IDotnetTool {
|
||||
args = args.concat(["--version", version]);
|
||||
}
|
||||
|
||||
const result = await this.run(args);
|
||||
const result = await this.execute("dotnet", args);
|
||||
const status = result.code === 0 ? "success" : "failure";
|
||||
const message = result.code === 0 ? result.stdout : result.stderr;
|
||||
|
||||
|
||||
@@ -2,12 +2,10 @@ import { Container } from "inversify";
|
||||
import { IVersionManager, VersionManager } from "./versionManager";
|
||||
import { TYPES, IBuildAgent } from "./common";
|
||||
import { BuildAgent } from "../agent/mock/build-agent";
|
||||
import { IDotnetTool, DotnetTool } from "./dotnet-tool";
|
||||
|
||||
const container = new Container();
|
||||
|
||||
container.bind<IVersionManager>(TYPES.IVersionManager).to(VersionManager);
|
||||
container.bind<IBuildAgent>(TYPES.IBuildAgent).to(BuildAgent);
|
||||
container.bind<IDotnetTool>(TYPES.IDotnetTool).to(DotnetTool);
|
||||
|
||||
export default container;
|
||||
|
||||
Reference in New Issue
Block a user