make the azdata install url configurable (#7989)

* make the azdata install url configurable

* use settings without reloading

* comments
This commit is contained in:
Alan Ren
2019-10-24 14:57:17 -07:00
committed by GitHub
parent d660405e73
commit 93685d3a09
8 changed files with 73 additions and 28 deletions

View File

@@ -3,12 +3,14 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EOL } from 'os';
import * as vscode from 'vscode';
import * as path from 'path';
import { SemVer } from 'semver';
import * as nls from 'vscode-nls';
import { Command, OsType, ToolType } from '../../interfaces';
import { IPlatformService } from '../platformService';
import { ToolBase } from './toolBase';
import { DeploymentConfigurationKey, AzdataPipInstallUriKey, azdataPipInstallArgsKey } from '../../constants';
const localize = nls.loadMessageBundle();
const installationRoot = '~/.local/bin';
@@ -66,22 +68,50 @@ export class AzdataTool extends ToolBase {
}
}
readonly allInstallationCommands: Map<OsType, Command[]> = new Map<OsType, Command[]>([
[OsType.linux, linuxInstallationCommands],
[OsType.win32, defaultInstallationCommands],
[OsType.darwin, defaultInstallationCommands],
[OsType.others, defaultInstallationCommands]
]);
protected get allInstallationCommands(): Map<OsType, Command[]> {
return new Map<OsType, Command[]>([
[OsType.linux, this.defaultInstallationCommands],
[OsType.win32, this.defaultInstallationCommands],
[OsType.darwin, this.defaultInstallationCommands],
[OsType.others, this.defaultInstallationCommands]
]);
}
protected get uninstallCommand(): string | undefined {
if (this.osType !== OsType.linux) {
return defaultUninstallCommand;
return this.defaultUninstallCommand;
} else {
return super.uninstallCommand;
}
}
private get defaultInstallationCommands(): Command[] {
return [
{
comment: localize('resourceDeployment.Azdata.InstallUpdatePythonRequestsPackage', "installing/updating to latest version of requests python package azdata ..."),
command: `pip3 install -U requests`
},
{
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata ..."),
command: `pip3 install -r ${this.azdataInstallUri} ${this.azdataInstallAdditionalArgs} --quiet --user`
}
];
}
private get defaultUninstallCommand(): string {
return `pip3 uninstall -r ${this.azdataInstallUri} ${this.azdataInstallAdditionalArgs} -y `;
}
private get azdataInstallUri(): string {
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[AzdataPipInstallUriKey];
}
private get azdataInstallAdditionalArgs(): string {
return vscode.workspace.getConfiguration(DeploymentConfigurationKey)[azdataPipInstallArgsKey];
}
}
/*
const linuxInstallationCommands = [
{
sudo: true,
@@ -114,16 +144,4 @@ const linuxInstallationCommands = [
command: 'apt-get install -y azdata-cli'
}
];
const defaultInstallationCommands = [
{
comment: localize('resourceDeployment.Azdata.InstallUpdatePythonRequestsPackage', "installing/updating to latest version of requests python package azdata ..."),
command: `pip3 install -U requests`
},
{
comment: localize('resourceDeployment.Azdata.InstallingAzdata', "installing azdata ..."),
command: `pip3 install -r https://aka.ms/azdata --quiet --user`
}
];
const defaultUninstallCommand = `pip3 uninstall -r https://aka.ms/azdata -y `;
*/