min version check (#8038)

* min version check

* comments
This commit is contained in:
Alan Ren
2019-10-25 17:11:32 -07:00
committed by GitHub
parent 78d3b9d555
commit a895f53029
4 changed files with 32 additions and 12 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { EOL } from 'os';
import { delimiter } from 'path';
import { SemVer } from 'semver';
import { SemVer, compare } from 'semver';
import * as vscode from 'vscode';
import * as nls from 'vscode-nls';
import { Command, ITool, OsType, ToolStatus, ToolType } from '../../interfaces';
@@ -63,11 +63,11 @@ export abstract class ToolBase implements ITool {
return this._onDidUpdateData.event;
}
protected get status(): ToolStatus {
get status(): ToolStatus {
return this._status;
}
protected set status(value: ToolStatus) {
set status(value: ToolStatus) {
this._status = value;
this._onDidUpdateData.fire(this);
}
@@ -270,6 +270,13 @@ export abstract class ToolBase implements ITool {
}
}
isSameOrNewerThan(version: string): boolean {
const currentVersion = new SemVer(this.fullVersion!);
const requiredVersion = new SemVer(version);
return compare(currentVersion, requiredVersion) >= 0;
}
private _storagePathEnsured: boolean = false;
private _status: ToolStatus = ToolStatus.NotInstalled;
private _osType: OsType;