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

Commit

Permalink
bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mkloubert committed Mar 20, 2018
1 parent efd62d4 commit 3eb1bea
Show file tree
Hide file tree
Showing 18 changed files with 227 additions and 218 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,19 @@

[![Share via Facebook](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Facebook.png)](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&quote=vscode-deploy-reloaded) [![Share via Twitter](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Twitter.png)](https://twitter.com/intent/tweet?source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&text=vscode-deploy-reloaded:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&via=mjkloubert) [![Share via Google+](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Google+.png)](https://plus.google.com/share?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Pinterest](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Pinterest.png)](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&media=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif&description=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.) [![Share via Reddit](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Reddit.png)](https://www.reddit.com/submit?url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded) [![Share via LinkedIn](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/LinkedIn.png)](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&title=vscode-deploy-reloaded&summary=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&source=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded) [![Share via Wordpress](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Wordpress.png)](https://wordpress.com/press-this.php?u=https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded&quote=vscode-deploy-reloaded&s=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20%27vs-deploy%27%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.&i=https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/demo1.gif) [![Share via Email](https://raw.githubusercontent.com/mkloubert/vscode-deploy-reloaded/master/img/share/Email.png)](mailto:?subject=vscode-deploy-reloaded&body=Recoded%20version%20of%20Visual%20Studio%20Code%20extension%20'vs-deploy'%2C%20which%20provides%20commands%20to%20deploy%20files%20to%20one%20or%20more%20destinations.:%20https%3A%2F%2Fmarketplace.visualstudio.com%2Fitems%3FitemName%3Dmkloubert.vscode-deploy-reloaded)

## 0.64.0 (March 20th, 2018; bugfixes)

* fixed bug with automatic password prompts ... s [issue #48](https://github.com/mkloubert/vscode-deploy-reloaded/issues/48#issuecomment-374321041)
* "outsourced" `createDirectoryIfNeeded()`, `exists()` functions to [vscode-helpers](https://www.npmjs.com/package/vscode-helpers) npm module
* code cleanups and improvements

## 0.63.1 (March 18th, 2018; APIs and popups)

* added [api endpoints](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/apis)
* [POST /markdown](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/apis#post-apimarkdown)
* added `alwaysShowWorkspaceNameInPopups` and `showWorkspaceNameInPopups` [settings](https://github.com/mkloubert/vscode-deploy-reloaded/wiki#settings--) ... s. [issue #47](https://github.com/mkloubert/vscode-deploy-reloaded/issues/47#issuecomment-373940021)
* passwords in input boxes of [SFTP](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_sftp) and [FTP](https://github.com/mkloubert/vscode-deploy-reloaded/wiki/target_ftp) targets are masked now ... s. [issue #48](https://github.com/mkloubert/vscode-deploy-reloaded/issues/48#issuecomment-374041368)
* "outsourced" `asBuffer()`, `doesMatch()`, `makeNonDisposable()`, `readAll()` functions to [vscode-helpers](https://www.npmjs.com/package/vscode-helpers) npm module
* "outsourced" `asBuffer()`, `doesMatch()`, `makeNonDisposable()`, `readAll()` functions, `EVENT` constant to [vscode-helpers](https://www.npmjs.com/package/vscode-helpers) npm module
* removed obsolete [npm packages](https://www.npmjs.com/):
* [isbinaryfile](https://www.npmjs.com/package/isbinaryfile)
* bugfixes
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ The extension supports the following destinations:
* [Packages](#packages-)
* [Targets](#targets-)
* [How to execute](#how-to-execute-)
5. [Support and contribute](#support-and-contribute-)
5. [Install offline](#install-offline-)
6. [Support and contribute](#support-and-contribute-)
* [Contributors](#contributors-)
6. [Related projects](#related-projects-)
7. [Related projects](#related-projects-)
* [node-enumerable](#node-enumerable-)
* [node-simple-socket](#node-simple-socket-)
* [vscode-helpers](#vscode-helpers-)
Expand Down Expand Up @@ -335,6 +336,14 @@ You can also use the following, predefined, shortcuts:
| `extension.deploy.reloaded.receiveFile.closeServer` | `CTRL + ALT + S, C` | Cancels the receiving of a file from a remote editor. |
| `extension.deploy.reloaded.sendFile` | `CTRL + ALT + S, S` | Sends the current file to a remote editor. |

## Install offline [[↑](#table-of-contents)]

If you have problems with a newer version of that extension (or have no connection to the Visual Studio Marketplace server), you can try to install a `.vsix` file from [release section](https://github.com/mkloubert/vscode-deploy-reloaded/releases) (s. `Assets`):

* open the extension sidebar (`CTRL + SHIFT + X`)
* click on the ellipsis in the right upper corner (`More`)
* choose `Install from VSIX...`

## Support and contribute [[↑](#table-of-contents)]

If you like the extension, you can support the project by sending a [donation via PayPal](https://paypal.me/MarcelKloubert) to [me](https://github.com/mkloubert).
Expand Down
55 changes: 38 additions & 17 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-deploy-reloaded",
"displayName": "Deploy (Reloaded)",
"description": "Deploys files of a workspace to a destination.",
"version": "0.63.1",
"version": "0.64.0",
"publisher": "mkloubert",
"engines": {
"vscode": "^1.21.0"
Expand Down Expand Up @@ -71116,6 +71116,6 @@
"tmp": "0.0.33",
"uglify-js": "^3.3.13",
"uuid": "^3.2.1",
"vscode-helpers": "^0.19.0"
"vscode-helpers": "^0.21.0"
}
}
86 changes: 85 additions & 1 deletion src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ interface VSCodeInfo {
version: string;
}


/**
* Name of the workspace variable for storing API hosts.
*/
export const WS_VAR_APIS = 'apis';
/**
* Name of the HTTP header that stores the language of an editor.
*/
Expand Down Expand Up @@ -1157,6 +1160,24 @@ export class ApiHost extends deploy_helpers.DisposableBase {
}
}

/**
* Disposes all API hosts of the underlying workspace.
*/
export function disposeApiHosts() {
const WORKSPACE: deploy_workspaces.Workspace = this;

const API_HOSTS = WORKSPACE.vars[ WS_VAR_APIS ];
if (!API_HOSTS) {
return;
}

while (API_HOSTS.length > 0) {
deploy_helpers.tryDispose(
API_HOSTS.pop()
);
}
}

function extensionToJsonObject(extension: vscode.Extension<any>, index: number) {
if (!extension) {
return <any>extension;
Expand Down Expand Up @@ -1188,6 +1209,69 @@ function getTextEditors() {
.distinct(true);
}

/**
* Reloads the API hosts for an underlying workspace.
*/
export async function reloadApiHosts() {
const WORKSPACE: deploy_workspaces.Workspace = this;

deploy_helpers.applyFuncFor(
disposeApiHosts, WORKSPACE
)();

const CFG = WORKSPACE.config;
if (!CFG) {
return;
}

const API_HOSTS = WORKSPACE.vars[ WS_VAR_APIS ];
if (!API_HOSTS) {
return;
}

const APIS_FROM_SETTINGS = CFG.apis;
if (!APIS_FROM_SETTINGS) {
return;
}

for (const P in APIS_FROM_SETTINGS) {
const PORT = parseInt(
deploy_helpers.toStringSafe(P).trim()
);
const SETTINGS_VALUE = APIS_FROM_SETTINGS[P];

let settings: ApiSettings;
if (deploy_helpers.isObject<ApiSettings>(SETTINGS_VALUE)) {
settings = SETTINGS_VALUE;
}
else {
settings = {
autoStart: deploy_helpers.toBooleanSafe(SETTINGS_VALUE, true),
};
}

let newHost: ApiHost;
try {
newHost = new ApiHost(WORKSPACE,
PORT, settings);

if (newHost.autoStart) {
await newHost.start();
}

API_HOSTS.push( newHost );
}
catch (e) {
deploy_helpers.tryDispose( newHost );

await WORKSPACE.showErrorMessage(
WORKSPACE.t('apis.errors.couldNotRegister',
P, e)
);
}
}
}

async function showQuickPickForApiHost(host: ApiHost) {
const NAME_AND_DESC = host.getNameAndDescription();

Expand Down
53 changes: 51 additions & 2 deletions src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import * as deploy_contracts from './contracts';
import * as deploy_delete from './delete';
import * as deploy_deploy from './deploy';
import * as deploy_events from './events';
import * as deploy_helpers from './helpers';
import * as deploy_log from './log';
import * as deploy_pull from './pull';
Expand Down Expand Up @@ -158,6 +157,56 @@ export function cleanupCommands() {
}
}

/**
* Executes Visual Studio Code commands on startup for the underlying workspace.
*/
export async function executeStartupCommands() {
const WORKSPACE: deploy_workspaces.Workspace = this;

const CFG = WORKSPACE.config;
if (!CFG) {
return;
}

try {
for (let cmd of deploy_helpers.asArray(CFG.startupCommands)) {
if (!deploy_helpers.isObject<deploy_contracts.StartupCommand>(cmd)) {
cmd = {
command: cmd,
};
}

const CMD_ID = deploy_helpers.toStringSafe(cmd.command);
if (deploy_helpers.isEmptyString(CMD_ID)) {
continue;
}

try {
let args: any[];
if (deploy_helpers.isNullOrUndefined(cmd.arguments)) {
args = [];
}
else {
args = deploy_helpers.asArray(cmd.arguments, false);
}

await vscode.commands.executeCommand
.apply(null, [ <any>CMD_ID ].concat(args));
}
catch (e) {
await WORKSPACE.showErrorMessage(
WORKSPACE.t('commands.executionError',
CMD_ID, e)
);
}
}
}
catch (e) {
WORKSPACE.logger
.trace(e, 'commands.executeStartupCommands()');
}
}

/**
* Reloads the commands of a workspace.
*
Expand Down Expand Up @@ -199,7 +248,7 @@ export async function reloadCommands(newCfg: deploy_contracts.Configuration) {
events: ME.workspaceSessionState['commands']['events'],
extension: ME.context.extension,
folder: ME.folder,
globalEvents: deploy_events.EVENTS,
globalEvents: deploy_helpers.EVENTS,
globals: ME.globals,
globalState: GLOBAL_STATE,
homeDir: deploy_helpers.getExtensionDirInHome(),
Expand Down
24 changes: 0 additions & 24 deletions src/events.ts

This file was deleted.

Loading

0 comments on commit 3eb1bea

Please sign in to comment.