From e24a5600664e7f099c960fba956825a7c669e10c Mon Sep 17 00:00:00 2001 From: Josh Johnson Date: Tue, 24 Nov 2015 18:48:26 -0500 Subject: [PATCH] Fix Manifest Reader --- src/utils/ManifestUtils.ts | 22 +++++++--------------- src/utils/UpdateNotifier.ts | 6 +++--- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/src/utils/ManifestUtils.ts b/src/utils/ManifestUtils.ts index bb708c7..2645359 100644 --- a/src/utils/ManifestUtils.ts +++ b/src/utils/ManifestUtils.ts @@ -19,24 +19,16 @@ export class ExtensionManifestReader { keywords: string[]; icon: string; - private _checkPropertyExists(propertyName: string) { - for (let property in this) { - if (property === propertyName) return true; - } - - return false; - } - refresh(): void { let manifest = this._extension.packageJSON; - for (let property in manifest) - { - if (this._checkPropertyExists(property)) { - this[property] = manifest[property]; - } - } - + this.name = manifest.name; + this.version = manifest.version; + this.publisher = manifest.publisher; this.displayName = manifest.displayName; + this.description = manifest.description; + this.categories = manifest.categories; + this.keywords = manifest.keywords; + this.icon = manifest.icon; } } \ No newline at end of file diff --git a/src/utils/UpdateNotifier.ts b/src/utils/UpdateNotifier.ts index 74e51e0..8b62fc4 100644 --- a/src/utils/UpdateNotifier.ts +++ b/src/utils/UpdateNotifier.ts @@ -8,7 +8,7 @@ let semver = require('semver'); export function checkForUpdates() { let manifestReader: ExtensionManifestReader = new ExtensionManifestReader('DotJoshJohnson.xml'); - let currentVersion = '0.0.0';//manifestReader.version; + let currentVersion = manifestReader.version; // use the GitHub api to determine the latest released version let url = 'https://api.github.com/repos/DotJoshJohnson/vscode-xml/releases/latest'; @@ -27,10 +27,10 @@ export function checkForUpdates() { let latestVersion = release.name.substring(1); // the release/tag is prefixed with a "v" if (!release.draft && semver.gt(latestVersion, currentVersion)) { - let updateNowLabel = 'Update Now'; + let updateNowLabel = 'Open Extension Manager'; window.showInformationMessage(`Version ${latestVersion} of the ${manifestReader.displayName} extension is available.`, updateNowLabel).then((clicked) => { if (clicked == updateNowLabel) { - commands.executeCommand('workbench.extensions.action.installExtension', manifestReader.displayName); + commands.executeCommand('workbench.extensions.action.listExtensions', manifestReader.displayName); } }); }