Skip to content

Commit 6414e67

Browse files
committed
Revert "check"
This reverts commit 8eb479f.
1 parent 6ef3951 commit 6414e67

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

src/main/osinstaller/CxInstaller.ts

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ export class CxInstaller {
2525
private readonly client: AstClient;
2626

2727
private static readonly PLATFORMS: Record<SupportedPlatforms, PlatformData> = {
28-
win32: {platform: 'windows', extension: 'zip'},
29-
darwin: {platform: macOS, extension: 'tar.gz'},
30-
linux: {platform: linuxOS, extension: 'tar.gz'}
28+
win32: { platform: 'windows', extension: 'zip' },
29+
darwin: { platform: macOS, extension: 'tar.gz' },
30+
linux: { platform: linuxOS, extension: 'tar.gz' }
3131
};
3232

3333
constructor(platform: string, client: AstClient) {
@@ -74,8 +74,12 @@ export class CxInstaller {
7474
await fs.promises.mkdir(this.resourceDirPath, {recursive: true});
7575
const cliVersion = await this.readASTCLIVersion();
7676

77-
if (await this.checkLatestExecutableVersionIsInstalled()) {
78-
return;
77+
if (this.checkExecutableExists()) {
78+
const installedVersion = await this.readInstalledVersionFile(this.resourceDirPath);
79+
if (installedVersion === cliVersion) {
80+
logger.info('Executable already installed.');
81+
return;
82+
}
7983
}
8084

8185
await this.cleanDirectoryContents(this.resourceDirPath);
@@ -98,27 +102,11 @@ export class CxInstaller {
98102
fs.chmodSync(this.getExecutablePath(), 0o755);
99103
logger.info('Extracted CLI to:', this.resourceDirPath);
100104
} catch (error) {
101-
if (await this.checkLatestExecutableVersionIsInstalled()) {
102-
return;
103-
}
104105
logger.error('Error during installation:', error);
105106
process.exit(1);
106107
}
107108
}
108109

109-
private async checkLatestExecutableVersionIsInstalled(): Promise<boolean> {
110-
const cliVersion = await this.readASTCLIVersion();
111-
112-
if (this.checkExecutableExists()) {
113-
const installedVersion = await this.readInstalledVersionFile(this.resourceDirPath);
114-
if (installedVersion === cliVersion) {
115-
logger.info('Executable already installed.');
116-
return true;
117-
}
118-
}
119-
return false;
120-
}
121-
122110
private async cleanDirectoryContents(directoryPath: string): Promise<void> {
123111
try {
124112
const files = await fsPromises.readdir(directoryPath);
@@ -208,7 +196,7 @@ export class CxInstaller {
208196
private getCompressFolderName(): string {
209197
return `ast-cli.${this.platform === winOS ? 'zip' : 'tar.gz'}`;
210198
}
211-
199+
212200
public getPlatform(): SupportedPlatforms {
213201
return this.platform;
214202
}

0 commit comments

Comments
 (0)