Package offline changes
This commit is contained in:
Родитель
bc48fac323
Коммит
6d2cb1845c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -314,7 +314,7 @@
|
|||
"mkdirp": "0.5.1 ",
|
||||
"opener": "^1.4.3",
|
||||
"service-downloader": "github:anthonydresser/service-downloader#0.1.2",
|
||||
"sqlops": "github:anthonydresser/sqlops-extension-sqlops",
|
||||
"sqlops": "github:anthonydresser/sqlops-extension-sqlops#1.1.11",
|
||||
"tmp": "0.0.33 ",
|
||||
"vscode-extension-telemetry": "^0.0.5",
|
||||
"vscode-jsonrpc": "3.5.0",
|
||||
|
@ -380,4 +380,4 @@
|
|||
"vscode-languageserver-protocol": "3.5.0",
|
||||
"vscode-languageserver-types": "3.5.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
50
src/utils.ts
50
src/utils.ts
|
@ -8,6 +8,8 @@ import * as path from 'path';
|
|||
import * as crypto from 'crypto';
|
||||
import * as os from 'os';
|
||||
|
||||
var baseConfig = require('./config.json');
|
||||
|
||||
// The function is a duplicate of \src\paths.js. IT would be better to import path.js but it doesn't
|
||||
// work for now because the extension is running in different process.
|
||||
export function getAppDataPath() {
|
||||
|
@ -101,3 +103,51 @@ export function verifyPlatform(): Thenable<boolean> {
|
|||
return Promise.resolve(true);
|
||||
}
|
||||
}
|
||||
|
||||
export function getServiceInstallConfig() {
|
||||
let config = JSON.parse(JSON.stringify(baseConfig));
|
||||
config.installDirectory = path.join(__dirname, config.installDirectory);
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export function getResolvedServiceInstallationPath(runtime: Runtime): string{
|
||||
let config = getServiceInstallConfig();
|
||||
let dir = config.installDirectory;
|
||||
dir = dir.replace('{#version#}', config.version);
|
||||
dir = dir.replace('{#platform#}', getRuntimeDisplayName(runtime));
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
export function getRuntimeDisplayName(runtime: Runtime): string {
|
||||
switch (runtime) {
|
||||
case Runtime.Windows_64:
|
||||
return 'Windows';
|
||||
case Runtime.Windows_86:
|
||||
return 'Windows';
|
||||
case Runtime.OSX:
|
||||
return 'OSX';
|
||||
case Runtime.Linux_64:
|
||||
return 'Linux';
|
||||
default:
|
||||
return 'Unknown';
|
||||
}
|
||||
}
|
||||
|
||||
export enum Runtime {
|
||||
Unknown = <any>'Unknown',
|
||||
Windows_86 = <any>'Windows_86',
|
||||
Windows_64 = <any>'Windows_64',
|
||||
OSX = <any>'OSX',
|
||||
CentOS_7 = <any>'CentOS_7',
|
||||
Debian_8 = <any>'Debian_8',
|
||||
Fedora_23 = <any>'Fedora_23',
|
||||
OpenSUSE_13_2 = <any>'OpenSUSE_13_2',
|
||||
SLES_12_2 = <any>'SLES_12_2',
|
||||
RHEL_7 = <any>'RHEL_7',
|
||||
Ubuntu_14 = <any>'Ubuntu_14',
|
||||
Ubuntu_16 = <any>'Ubuntu_16',
|
||||
Linux_64 = <any>'Linux_64',
|
||||
Linux_86 = <any>'Linux-86'
|
||||
}
|
|
@ -6,13 +6,21 @@ var os = require('os');
|
|||
var del = require('del');
|
||||
var path = require('path');
|
||||
var serviceDownloader = require('service-downloader');
|
||||
var baseConfig = require('../out/config.json');
|
||||
|
||||
|
||||
function getServiceInstallConfig() {
|
||||
let config = JSON.parse(JSON.stringify(baseConfig));
|
||||
config.installDirectory = path.join(__dirname, config.installDirectory);
|
||||
return require('../out/utils').getServiceInstallConfig();
|
||||
}
|
||||
|
||||
return config;
|
||||
function getResolvedServiceInstallationPath(runtime) {
|
||||
return require('../out/utils').getResolvedServiceInstallationPath(runtime);
|
||||
}
|
||||
|
||||
async function installService(runtime) {
|
||||
const config = getServiceInstallConfig();
|
||||
const serverdownloader = new serviceDownloader.ServiceDownloadProvider(config);
|
||||
|
||||
return serverdownloader.installService(runtime)
|
||||
}
|
||||
|
||||
async function getOrDownloadServer() {
|
||||
|
@ -22,7 +30,6 @@ async function getOrDownloadServer() {
|
|||
return serverdownloader.getOrDownloadServer()
|
||||
}
|
||||
|
||||
|
||||
gulp.task('ext:install-service', () => {
|
||||
return getOrDownloadServer();
|
||||
});
|
||||
|
@ -44,8 +51,9 @@ function doPackageSync(packageName) {
|
|||
function cleanServiceInstallFolder() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const config = getServiceInstallConfig();
|
||||
console.log('Deleting Service Install folder: ' + config.installDirectory);
|
||||
del(config.installDirectory + '/*').then(() => {
|
||||
let root = path.join(__dirname, '../out/' + 'pgsqltoolsservice');
|
||||
console.log('Deleting Service Install folder: ' + root);
|
||||
del(root + '/*').then(() => {
|
||||
resolve();
|
||||
}).catch((error) => {
|
||||
reject(error)
|
||||
|
@ -53,8 +61,8 @@ function cleanServiceInstallFolder() {
|
|||
});
|
||||
}
|
||||
|
||||
function doOfflinePackage(runtimeId, platform, packageName) {
|
||||
return getOrDownloadServer().then(() => {
|
||||
function doOfflinePackage(runtimeId, runtime, packageName) {
|
||||
return installService(runtime).then(() => {
|
||||
return doPackageSync(packageName + '-' + runtimeId + '.vsix');
|
||||
});
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
"lib": [
|
||||
"es6", "es2015.promise"
|
||||
],
|
||||
"sourceMap": false,
|
||||
"sourceMap": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"experimentalDecorators": true,
|
||||
"declaration": true,
|
||||
|
|
|
@ -4922,9 +4922,9 @@ sprintf-js@~1.0.2:
|
|||
version "1.0.3"
|
||||
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
|
||||
|
||||
"sqlops@github:anthonydresser/sqlops-extension-sqlops":
|
||||
"sqlops@github:anthonydresser/sqlops-extension-sqlops#1.1.11":
|
||||
version "1.1.11"
|
||||
resolved "https://codeload.github.com/anthonydresser/sqlops-extension-sqlops/tar.gz/dac501bbaa03a25239c060c6371dfdcf06707599"
|
||||
resolved "https://codeload.github.com/anthonydresser/sqlops-extension-sqlops/tar.gz/06c604d7f6ab9642a678d86a1b93412da37b01cc"
|
||||
dependencies:
|
||||
glob "^7.1.2"
|
||||
gulp-chmod "^2.0.0"
|
||||
|
|
Загрузка…
Ссылка в новой задаче