mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-24 12:19:20 +00:00
adopt auto-updater module
This commit is contained in:
@@ -29,7 +29,7 @@ var build = path.join(root, '.build');
|
||||
var commit = util.getVersion(root);
|
||||
|
||||
var baseModules = [
|
||||
'app', 'applicationinsights', 'assert', 'auto-updater', 'browser-window',
|
||||
'applicationinsights', 'assert', 'browser-window',
|
||||
'child_process', 'chokidar', 'crash-reporter', 'crypto', 'dialog', 'emmet',
|
||||
'events', 'fs', 'getmac', 'glob', 'graceful-fs', 'http', 'http-proxy-agent',
|
||||
'https', 'https-proxy-agent', 'iconv-lite', 'electron', 'ipc', 'menu', 'menu-item', 'net',
|
||||
|
||||
4
src/typings/atom-browser.d.ts
vendored
4
src/typings/atom-browser.d.ts
vendored
@@ -331,7 +331,7 @@ interface IDock {
|
||||
// https://github.com/atom/electron/blob/master/docs/api/auto-updater.md
|
||||
declare module 'auto-updater' {
|
||||
export interface IAutoUpdater extends IEventEmitter {
|
||||
setFeedUrl(url: string): void;
|
||||
setFeedURL(url: string): void;
|
||||
checkForUpdates(): void;
|
||||
}
|
||||
|
||||
@@ -342,7 +342,7 @@ declare module 'auto-updater' {
|
||||
version?: string;
|
||||
}
|
||||
|
||||
export function setFeedUrl(url: string): void;
|
||||
export function setFeedURL(url: string): void;
|
||||
export function checkForUpdates(): void;
|
||||
export function addListener(event: string, listener: Function): EventEmitter;
|
||||
export function on(event: string, listener: Function): EventEmitter;
|
||||
|
||||
@@ -8,6 +8,7 @@ import fs = require('fs');
|
||||
import path = require('path');
|
||||
import events = require('events');
|
||||
|
||||
import electron = require('electron');
|
||||
import platform = require('vs/base/common/platform');
|
||||
import env = require('vs/workbench/electron-main/env');
|
||||
import storage = require('vs/workbench/electron-main/storage');
|
||||
@@ -38,7 +39,7 @@ export interface IUpdate {
|
||||
}
|
||||
|
||||
interface IAutoUpdater extends IEventEmitter {
|
||||
setFeedUrl(url: string): void;
|
||||
setFeedURL(url: string): void;
|
||||
checkForUpdates(): void;
|
||||
}
|
||||
|
||||
@@ -67,7 +68,7 @@ export class UpdateManager extends events.EventEmitter {
|
||||
if (platform.isWindows) {
|
||||
this.raw = new Win32AutoUpdaterImpl();
|
||||
} else if (platform.isMacintosh) {
|
||||
this.raw = <any>require.__$__nodeRequire('auto-updater'); // https://github.com/atom/electron/issues/3194
|
||||
this.raw = electron.autoUpdater;
|
||||
}
|
||||
|
||||
if (this.raw) {
|
||||
@@ -141,7 +142,7 @@ export class UpdateManager extends events.EventEmitter {
|
||||
this._channel = channel;
|
||||
this._feedUrl = feedUrl;
|
||||
|
||||
this.raw.setFeedUrl(feedUrl);
|
||||
this.raw.setFeedURL(feedUrl);
|
||||
this.setState(State.Idle);
|
||||
|
||||
// Check for updates on startup after 30 seconds
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
'use strict';
|
||||
|
||||
import events = require('events');
|
||||
import {IAutoUpdater, IUpdate} from 'auto-updater';
|
||||
import path = require('path');
|
||||
import os = require('os');
|
||||
import cp = require('child_process');
|
||||
@@ -19,7 +18,14 @@ import { getProxyAgent } from 'vs/workbench/node/proxy';
|
||||
import {manager as Settings} from 'vs/workbench/electron-main/settings';
|
||||
import {manager as Lifecycle} from 'vs/workbench/electron-main/lifecycle';
|
||||
|
||||
export class Win32AutoUpdaterImpl extends events.EventEmitter implements IAutoUpdater {
|
||||
export interface IUpdate {
|
||||
url: string;
|
||||
name: string;
|
||||
releaseNotes?: string;
|
||||
version?: string;
|
||||
}
|
||||
|
||||
export class Win32AutoUpdaterImpl extends events.EventEmitter {
|
||||
|
||||
private url: string;
|
||||
private currentRequest: Promise;
|
||||
@@ -36,7 +42,7 @@ export class Win32AutoUpdaterImpl extends events.EventEmitter implements IAutoUp
|
||||
return new TPromise<string>((c, e) => mkdirp(result, null, err => err ? e(err) : c(result)));
|
||||
}
|
||||
|
||||
public setFeedUrl(url: string): void {
|
||||
public setFeedURL(url: string): void {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
@@ -102,7 +108,7 @@ export class Win32AutoUpdaterImpl extends events.EventEmitter implements IAutoUp
|
||||
}
|
||||
|
||||
private getUpdatePackagePath(version: string): TPromise<string> {
|
||||
return this.cachePath.then(cachePath => path.join(cachePath, `CodeSetup-${ version }.exe`));
|
||||
return this.cachePath.then(cachePath => path.join(cachePath, `CodeSetup-${version}.exe`));
|
||||
}
|
||||
|
||||
private quitAndUpdate(updatePackagePath: string): void {
|
||||
|
||||
Reference in New Issue
Block a user