-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(DockerHost): Added first part of support for remote docker host
- Loading branch information
Showing
5 changed files
with
119 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
import * as vscode from "vscode"; | ||
import * as terminal from './terminal'; | ||
import * as path from "path"; | ||
import * as fs from "fs"; | ||
import * as guid from './guid'; | ||
import * as settings from "./settings" | ||
|
||
import { workspace, WorkspaceEdit, ShellExecution } from 'vscode'; | ||
import { execFile } from "child_process"; | ||
|
||
export function SetupRemoteDockerFolder() | ||
{ | ||
terminal.PSTerminal.show(true); | ||
const currentRoot = settings.GetCurrentRootPath(); | ||
const hostPath = 'c:\\sources\\'; | ||
const shareName = 'sources'; | ||
const mapAs = 'S'; | ||
terminal.SendPSText(`${settings.GetConfigCommand(true)} | Set-ALDockerHostFolder -HostPath ${hostPath} -ShareName ${shareName} -ShareMapAs ${mapAs}`); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
import * as vscode from "vscode"; | ||
import * as terminal from './terminal'; | ||
import * as path from "path"; | ||
import * as fs from "fs"; | ||
import * as guid from './guid'; | ||
|
||
import { workspace, WorkspaceEdit, ShellExecution } from 'vscode'; | ||
import { execFile } from "child_process"; | ||
|
||
export function GetCurrentRootPath():string | ||
{ | ||
if (vscode.workspace.workspaceFolders.length === 1) { | ||
return vscode.workspace.workspaceFolders[0].uri.fsPath+'\\..'; | ||
} | ||
if (vscode.window.activeTextEditor===undefined) { | ||
return vscode.workspace.workspaceFolders[0].uri.fsPath+'\\..'; | ||
} | ||
const fileUri = vscode.window.activeTextEditor.document.uri; | ||
const workspace = vscode.workspace.getWorkspaceFolder(fileUri); | ||
console.log(`Navertical: current workspace folder is: ${workspace.uri.fsPath}`); | ||
return workspace.uri.fsPath+'\\..'; | ||
} | ||
|
||
export function IsRemoteDocker():boolean | ||
{ | ||
const remoteHost = vscode.workspace.getConfiguration().get('navertical.DockerHost').toString(); | ||
return (remoteHost.toLowerCase()!=='localhost'); | ||
} | ||
|
||
export function GetRemoteDockerName():string | ||
{ | ||
const remoteHost = vscode.workspace.getConfiguration().get('navertical.DockerHost').toString(); | ||
return remoteHost; | ||
} | ||
|
||
export function GetRemoteDockerSSL():boolean | ||
{ | ||
const remoteHostSSL = <boolean>vscode.workspace.getConfiguration().get('navertical.DockerHostUseSSL'); | ||
return remoteHostSSL; | ||
} | ||
|
||
export function GetRemoteMapping():string | ||
{ | ||
const remoteHostMapping = vscode.workspace.getConfiguration().get('navertical.DockerHostFolderMap').toString(); | ||
return remoteHostMapping; | ||
} | ||
|
||
export function GetConfigCommand(remote:boolean):string | ||
{ | ||
const currentRoot = GetCurrentRootPath(); | ||
if (!remote || !IsRemoteDocker()) { | ||
return `Read-ALConfiguration -Path ${currentRoot}` | ||
} else { | ||
return `Read-ALConfiguration -Path ${currentRoot} -DockerHost ${GetRemoteDockerName()} -DockerHostSSL $${GetRemoteDockerSSL()} -PathMapString '${GetRemoteMapping()}'` | ||
} | ||
} |