Skip to content
This repository has been archived by the owner on Jul 1, 2021. It is now read-only.

Commit

Permalink
started to implement switch target
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Nov 23, 2017
1 parent 5189762 commit a53b687
Show file tree
Hide file tree
Showing 9 changed files with 603 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 11.2.0 (?????, 2017; switch target and multi root support)

* added `autoSelectWorkspace` setting, which can select the current workspace by active text editor automatically
* added [switch target](https://github.com/mkloubert/vs-deploy/wiki/target_switch)

## 11.1.0 (November 20th, 2017; finished multi root support)

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
"command": "extension.deploy.selectWorkspace",
"title": "Select workspace",
"category": "Deploy"
},
{
"command": "extension.deploy.changeSwitch",
"title": "Change switch",
"category": "Deploy"
}
],
"keybindings": [
Expand Down
12 changes: 12 additions & 0 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import * as deploy_objects from './objects';
import * as deploy_operations from './operations';
import * as deploy_packages from './packages';
import * as deploy_plugins from './plugins';
import * as deploy_switch from './switch';
import * as deploy_sync from './sync';
import * as deploy_targets from './targets';
import * as deploy_templates from './templates';
Expand Down Expand Up @@ -393,6 +394,14 @@ export class Deployer extends Events.EventEmitter implements vscode.Disposable {
});
}

/**
* Changes a switch target.
*/
public async changeSwitch() {
return await deploy_switch.changeSwitch
.apply(this, arguments);
}

/**
* Clears the output on startup depending on the current configuration.
*/
Expand Down Expand Up @@ -4195,6 +4204,9 @@ export class Deployer extends Events.EventEmitter implements vscode.Disposable {
ME._config = cfg;

try {
deploy_switch.reloadTargetStates
.apply(ME, []);

try {
ME._QUICK_DEPLOY_STATUS_ITEM.hide();
if (cfg.button) {
Expand Down
10 changes: 10 additions & 0 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,15 @@ export function activate(context: vscode.ExtensionContext) {
}
});

let changeSwitch = vscode.commands.registerCommand('extension.deploy.changeSwitch', async () => {
try {
await deployer.changeSwitch();
}
catch (e) {
vscode.window.showErrorMessage(`[CHANGE SWITCH ERROR]: ${deploy_helpers.toStringSafe(e)}`);
}
});

let htmlViewer = vscode.workspace.registerTextDocumentContentProvider('vs-deploy-html',
new deploy_content.HtmlTextDocumentContentProvider(deployer));

Expand All @@ -257,6 +266,7 @@ export function activate(context: vscode.ExtensionContext) {
deployer));

context.subscriptions.push(deployer,
changeSwitch,
compareFiles,
deploy, deployFileOrFolder, deployFilesTo, getTargets,
htmlViewer,
Expand Down
10 changes: 10 additions & 0 deletions src/i18.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,15 @@ export interface Translation {
invalidFile?: string;
unknownEngine?: string;
},
switch?: {
defaultName?: string;
defaultOptionName?: string;
description?: string;
noDefined?: string;
noOptionsDefined?: string;
selectOption?: string;
selectSwitch?: string;
},
test?: {
description?: string;
},
Expand Down Expand Up @@ -370,6 +379,7 @@ export interface Translation {
couldNotResolve?: string;
isEmpty?: string;
},
selected?: string;
sync?: {
file?: {
doesNotExistOnRemote?: string;
Expand Down
10 changes: 10 additions & 0 deletions src/lang/de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,15 @@ export const translation: Translation = {
invalidFile: 'Datei ist ungültig!',
unknownEngine: 'Unbekannter Typ {0:trim,surround}!',
},
switch: {
defaultName: 'Schalter #{0:trim}',
defaultOptionName: 'Schalter-Option #{0:trim}',
description: 'Schaltet zwischen anderen existierenden Zielen um',
noDefined: 'Es wurden keine Schalter gefunden!',
noOptionsDefined: 'Es wurden keine Optionen für den Schalter {0:trim,surround} definiert!',
selectOption: 'Wählen Sie eine Option für den Schalter {0:trim,surround}...',
selectSwitch: 'Wählen Sie einen Schalter aus...',
},
test: {
description: 'Ein Test-PlugIn, welches lediglich anzeigt, welche Dateien bereitgestellt würden',
},
Expand Down Expand Up @@ -361,6 +370,7 @@ export const translation: Translation = {
couldNotResolve: "Der relative Pfad für {0:trim,surround} konnte nicht ermittelt werden!",
isEmpty: 'Der relative Pfad für {0:trim,surround} is leer!',
},
selected: 'ausgewählt',
sync: {
file: {
doesNotExistOnRemote: '[entfernte Datei existiert nicht]',
Expand Down
10 changes: 10 additions & 0 deletions src/lang/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,15 @@ export const translation: Translation = {
invalidFile: 'File is invalid!',
unknownEngine: 'Unknown engine {0:trim,surround}!',
},
switch: {
defaultName: 'Switch #{0:trim}',
defaultOptionName: 'Switch option #{0:trim}',
description: 'Switches between existing targets',
noDefined: 'No swicthes available!',
noOptionsDefined: 'No options were defined for the switch {0:trim,surround}!',
selectOption: 'Select an option for the switch {0:trim,surround}...',
selectSwitch: 'Select a switch...',
},
test: {
description: 'A mock deployer that only displays what files would be deployed',
},
Expand Down Expand Up @@ -363,6 +372,7 @@ export const translation: Translation = {
couldNotResolve: "Could not get relative path for {0:trim,surround}!",
isEmpty: 'Relative path for {0:trim,surround} file is empty!',
},
selected: 'selected',
sync: {
file: {
doesNotExistOnRemote: '[remote does not exist]',
Expand Down
Loading

0 comments on commit a53b687

Please sign in to comment.