From 9a4285c6300f1dd1eb2beff62221a4f4bf18dadc Mon Sep 17 00:00:00 2001 From: abhikdps Date: Tue, 17 Dec 2024 19:42:27 +0530 Subject: [PATCH] Import getCreatorVersion from utils file --- codecov.yml | 1 + .../contentCreator/createSampleExecutionEnvPage.ts | 12 ++---------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/codecov.yml b/codecov.yml index 419df937b..bbe11cfda 100644 --- a/codecov.yml +++ b/codecov.yml @@ -19,5 +19,6 @@ ignore: - src/webview/apps/contentCreator/createAnsibleCollectionPageApp.ts - src/webview/apps/contentCreator/createAnsibleProjectPageApp.ts - src/webview/apps/contentCreator/createDevfilePageApp.ts + - src/webview/apps/contentCreator/createSampleExecutionEnvPageApp.ts - src/webview/apps/welcomePage/welcomePageApp.ts - src/webview/apps/quickLinks/quickLinksApp.ts diff --git a/src/features/contentCreator/createSampleExecutionEnvPage.ts b/src/features/contentCreator/createSampleExecutionEnvPage.ts index 3ef140451..650d39bd2 100644 --- a/src/features/contentCreator/createSampleExecutionEnvPage.ts +++ b/src/features/contentCreator/createSampleExecutionEnvPage.ts @@ -8,7 +8,7 @@ import { getNonce } from "../utils/getNonce"; import { AnsibleSampleExecutionEnvInterface, PostMessageEvent } from "./types"; import { withInterpreter } from "../utils/commandRunner"; import { SettingsManager } from "../../settings"; -import { expandPath, getBinDetail, runCommand } from "./utils"; +import { expandPath, runCommand, getCreatorVersion } from "./utils"; import { ANSIBLE_CREATOR_EE_VERSION_MIN } from "../../definitions/constants"; export class CreateSampleExecutionEnv { @@ -276,14 +276,6 @@ export class CreateSampleExecutionEnv { ); } - private async getCreatorVersion(): Promise { - const creatorVersion = ( - await getBinDetail("ansible-creator", "--version") - ).toString(); - console.log("ansible-creator version: ", creatorVersion); - return creatorVersion; - } - public async getCreatorCommand(url: string): Promise { let command = ""; @@ -395,7 +387,7 @@ export class CreateSampleExecutionEnv { let commandResult: string; commandOutput += `------------------------------------ ansible-creator logs ------------------------------------\n`; - const creatorVersion = await this.getCreatorVersion(); + const creatorVersion = await getCreatorVersion(); if (semver.gte(creatorVersion, ANSIBLE_CREATOR_EE_VERSION_MIN)) { // execute ansible-creator command const ansibleCreatorExecutionResult = await runCommand(command, env);