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

Commit

Permalink
fixed folder mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Dec 28, 2017
1 parent 64da827 commit b2c744c
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 63 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log (vscode-deploy-reloaded)

## 0.6.0 (December 28th, 2017; bugfixes)

* fixed [folder mappings](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/folder_mappings)
* fixed `hideIf` and `showIf` properties for [targets](https://github.com/mkloubert/vscode-deploy-reloaded/wiki#targets-)
* code cleanups
* added [demo](https://github.com/mkloubert/vscode-deploy-reloaded#send-files-to-other-editors-), which shows how to send files to another editor

## 0.5.0 (December 28th, 2017; improvements)

* bugfixes
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ The extension supports the following destinations:
* [List remote files](#list-remote-files-)
* [Tools](#tools-)
* [Quick code execution](#quick-code-execution-)
* [Send files to other editors](#send-files-to-other-editors-)
2. [Preview](#preview-)
3. [Install](#install-)
4. [How to use](#how-to-use-)
Expand Down Expand Up @@ -75,6 +76,12 @@ The extension supports the following destinations:

![Demo Quick code execution](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo7.gif)

#### Send files to other editors [[↑](#tools-)]

The following demo shows, how you can send a file to another VS Code instance over a secure and encrypted TCP connection:

![Demo Send files to other editors](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo8.gif)

## Preview [[↑](#table-of-contents)]

Keep in mind, that this is a preview extension, which is in a good beta state.
Expand Down
Binary file added img/demo8.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/compare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ export async function compareFiles(workspaces: deploy_workspaces.Workspace | dep
action: async () => {
let remoteFile: Buffer;

const ALL_DIRS = await WS.getAllDirectories();

const CANCELLATION_SOURCE = new vscode.CancellationTokenSource();
try {
const PLUGINS = t.__workspace.getDownloadPlugins(t);
Expand All @@ -67,7 +69,8 @@ export async function compareFiles(workspaces: deploy_workspaces.Workspace | dep

const PI = PLUGINS.shift();

const NAME_AND_PATH = WS.getNameAndPathForFileDeployment(DOC.fileName, t);
const NAME_AND_PATH = WS.getNameAndPathForFileDeployment(t, DOC.fileName,
ALL_DIRS);
if (false === NAME_AND_PATH) {
continue;
}
Expand Down
20 changes: 11 additions & 9 deletions src/delete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export async function deleteFileIn(file: string, target: deploy_targets.Target,
* @param {boolean} [deleteLocalFiles] Also delete local files or not.
*/
export async function deleteFilesIn(files: string[],
target: deploy_targets.Target, targetNr?: number,
target: deploy_targets.Target,
deleteLocalFiles?: boolean) {
const ME: deploy_workspaces.Workspace = this;

Expand All @@ -127,10 +127,6 @@ export async function deleteFilesIn(files: string[],

deleteLocalFiles = deploy_helpers.toBooleanSafe(deleteLocalFiles);

if (isNaN(targetNr)) {
targetNr = target.__index + 1;
}

const TARGET_NAME = deploy_targets.getTargetName(target);

const PLUGINS = ME.getDeletePlugins(target);
Expand All @@ -149,6 +145,8 @@ export async function deleteFilesIn(files: string[],
deploy_helpers.tryDispose(cancelBtnCommand);
};

const ALL_DIRS = await ME.getAllDirectories();

const CANCELLATION_SOURCE = new vscode.CancellationTokenSource();
try {
// cancel button
Expand Down Expand Up @@ -234,7 +232,8 @@ export async function deleteFilesIn(files: string[],
}

const FILES_TO_DELETE = files.map(f => {
const NAME_AND_PATH = ME.getNameAndPathForFileDeployment(f, target);
const NAME_AND_PATH = ME.getNameAndPathForFileDeployment(target, f,
ALL_DIRS);
if (false === NAME_AND_PATH) {
return null;
}
Expand Down Expand Up @@ -499,7 +498,7 @@ export async function deletePackage(pkg: deploy_packages.Package,

const SELECTED_TARGET = await deploy_targets.showTargetQuickPick(
ME.context.extension,
TARGETS,
TARGETS.filter(t => deploy_targets.isVisibleForPackage(t, pkg)),
{
placeHolder: ME.t('DELETE.selectTarget'),
}
Expand All @@ -508,8 +507,11 @@ export async function deletePackage(pkg: deploy_packages.Package,
return;
}

await deleteFilesIn.apply(ME,
[ FILES_TO_DELETE, SELECTED_TARGET, SELECTED_TARGET.__index + 1, deleteLocalFiles ]);
await deploy_helpers.applyFuncFor(
deleteFilesIn, ME
)(FILES_TO_DELETE,
SELECTED_TARGET,
deleteLocalFiles);
}

/**
Expand Down
24 changes: 12 additions & 12 deletions src/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ let nextCancelBtnCommandId = Number.MIN_SAFE_INTEGER;
*
* @param {string[]} files The files to deploy.
* @param {deploy_targets.Target} target The target to deploy to.
* @param {number} [targetNr] The number of the target.
*/
export async function deployFilesTo(files: string[],
target: deploy_targets.Target, targetNr?: number) {
target: deploy_targets.Target) {
const ME: deploy_workspaces.Workspace = this;

target = ME.prepareTarget(target);
Expand All @@ -58,10 +57,6 @@ export async function deployFilesTo(files: string[],
return;
}

if (isNaN(targetNr)) {
targetNr = target.__index + 1;
}

const TARGET_NAME = deploy_targets.getTargetName(target);
const TARGET_TYPE = deploy_targets.normalizeTargetType(target);
const STATE_KEY = deploy_helpers.toStringSafe(target.__id);
Expand Down Expand Up @@ -96,6 +91,8 @@ export async function deployFilesTo(files: string[],
deploy_helpers.tryDispose(cancelBtnCommand);
};

const ALL_DIRS = await ME.getAllDirectories();

const CANCELLATION_SOURCE = new vscode.CancellationTokenSource();
try {
// cancel button
Expand Down Expand Up @@ -182,9 +179,10 @@ export async function deployFilesTo(files: string[],

const FILES_TO_UPLOAD: deploy_plugins.LocalFileToUpload[] = [];
for (const F of files) {
const NAME_AND_PATH = ME.getNameAndPathForFileDeployment(F, target);
const NAME_AND_PATH = ME.getNameAndPathForFileDeployment(target, F,
ALL_DIRS);
if (false === NAME_AND_PATH) {
return null;
continue;
}

const LF = new deploy_plugins.LocalFileToUpload(ME, F, NAME_AND_PATH);
Expand Down Expand Up @@ -436,17 +434,19 @@ export async function deployPackage(pkg: deploy_packages.Package) {

const SELECTED_TARGET = await deploy_targets.showTargetQuickPick(
ME.context.extension,
TARGETS,
TARGETS.filter(t => deploy_targets.isVisibleForPackage(t, pkg)),
{
placeHolder: ME.t('deploy.selectTarget'),
}
);
if (!SELECTED_TARGET) {
return;
}

await deployFilesTo.apply(ME,
[ FILES_TO_DEPLOY, SELECTED_TARGET, SELECTED_TARGET.__index + 1 ]);

await deploy_helpers.applyFuncFor(
deployFilesTo, ME
)(FILES_TO_DEPLOY,
SELECTED_TARGET);
}
finally {
if (PACKAGE_BTN) {
Expand Down
2 changes: 1 addition & 1 deletion src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ export function applyFuncFor<TFunc extends Function = Function>(
thisArgs: any
): TFunc {
if (!func) {
return <any>func;
return func;
}

return <any>function() {
Expand Down
20 changes: 10 additions & 10 deletions src/pull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,9 @@ export async function pullFileFrom(file: string, target: deploy_targets.Target)
*
* @param {string[]} files The files to pull.
* @param {deploy_targets.Target} target The target from where to pull from.
* @param {number} [targetNr] The number of the target.
*/
export async function pullFilesFrom(files: string[],
target: deploy_targets.Target, targetNr?: number) {
target: deploy_targets.Target) {
const ME: deploy_workspaces.Workspace = this;

target = ME.prepareTarget(target);
Expand All @@ -89,10 +88,6 @@ export async function pullFilesFrom(files: string[],
return;
}

if (isNaN(targetNr)) {
targetNr = target.__index + 1;
}

const TARGET_NAME = deploy_targets.getTargetName(target);
const STATE_KEY = deploy_helpers.toStringSafe(target.__id);

Expand Down Expand Up @@ -124,6 +119,8 @@ export async function pullFilesFrom(files: string[],
deploy_helpers.tryDispose(cancelBtnCommand);
};

const ALL_DIRS = await ME.getAllDirectories();

const CANCELLATION_SOURCE = new vscode.CancellationTokenSource();
try {
// cancel button
Expand Down Expand Up @@ -211,7 +208,8 @@ export async function pullFilesFrom(files: string[],
}

const FILES_TO_PULL = files.map(f => {
const NAME_AND_PATH = ME.getNameAndPathForFileDeployment(f, target);
const NAME_AND_PATH = ME.getNameAndPathForFileDeployment(target, f,
ALL_DIRS);
if (false === NAME_AND_PATH) {
return null;
}
Expand Down Expand Up @@ -490,7 +488,7 @@ export async function pullPackage(pkg: deploy_packages.Package) {

const SELECTED_TARGET = await deploy_targets.showTargetQuickPick(
ME.context.extension,
TARGETS,
TARGETS.filter(t => deploy_targets.isVisibleForPackage(t, pkg)),
{
placeHolder: ME.t('pull.selectSource'),
}
Expand All @@ -499,6 +497,8 @@ export async function pullPackage(pkg: deploy_packages.Package) {
return;
}

await pullFilesFrom.apply(ME,
[ FILES_TO_PULL, SELECTED_TARGET, SELECTED_TARGET.__index + 1 ]);
await deploy_helpers.applyFuncFor(
pullFilesFrom, ME
)(FILES_TO_PULL,
SELECTED_TARGET);
}
2 changes: 1 addition & 1 deletion src/targets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,7 @@ export function isVisibleForPackage(target: Target, pkg: deploy_packages.Package
}

const SHOW_IF = deploy_helpers.asArray(
deploy_helpers.asArray(target.hideIf)
deploy_helpers.asArray(target.showIf)
).map(sif => deploy_helpers.normalizeString(sif))
.filter(sif => '' !== sif);

Expand Down
Loading

0 comments on commit b2c744c

Please sign in to comment.