-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
22 additions
and
20 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ import { validateManifest } from "../util/validate-manifest"; | |
import * as path from "path"; | ||
|
||
let sshConnect = ""; | ||
let sshConnectForce = ""; | ||
const manifestPath = getCachedNomoManifestPath(); | ||
const iconPath = getCachedNomoIconPath(); | ||
|
||
|
@@ -32,19 +31,18 @@ export async function connectToSSH(args: { | |
const { sshHost, sshBaseDir, publicBaseUrl, sshPort } = rawSSH; | ||
const portOption = sshPort ? `-p ${sshPort}` : ""; | ||
sshConnect = `ssh -t ${sshHost} ${portOption}`; | ||
sshConnectForce = `ssh -T ${sshHost} ${portOption}`; | ||
|
||
await extractAndCache({ | ||
tarFilePath: archive, | ||
}); | ||
|
||
manifestChecks(manifestPath); | ||
const commands = [ | ||
// ls(), | ||
// checkCreateDir(sshBaseDir), | ||
deployFile(archive, sshBaseDir), | ||
// deployFile(manifestPath, sshBaseDir), | ||
// deployFile(iconPath, sshBaseDir), | ||
ls(), | ||
checkCreateDir(sshBaseDir), | ||
deployFile(archive, sshHost, sshBaseDir, sshPort), | ||
deployFile(manifestPath, sshHost, sshBaseDir, sshPort), | ||
deployFile(iconPath, sshHost, sshBaseDir, sshPort), | ||
]; | ||
|
||
await runCommandsSequentially(commands); | ||
|
@@ -59,22 +57,26 @@ function checkCreateDir(sshBaseDir: string): string { | |
return `${sshConnect} "${mkdirCommand}"`; | ||
} | ||
|
||
function deployFile(filePath: string, sshBaseDir: string): string { | ||
function scpCommand( | ||
filePath: string, | ||
sshHost: string, | ||
sshBaseDir: string, | ||
port?: number | ||
): string { | ||
const absolutePath = path.resolve(filePath); | ||
|
||
const scpCommand = `${sshConnectForce} 'scp ${absolutePath} ${sshBaseDir}'`; | ||
|
||
return scpCommand; | ||
return `scp ${ | ||
port ? `-P ${port}` : "" | ||
} ${absolutePath} ${sshHost}:${sshBaseDir}`; | ||
} | ||
function deployFile2(filePath: string, sshBaseDir: string): string { | ||
// const portOption = rawSSH.sshPort ? `-P ${rawSSH.sshPort}` : ''; | ||
//const sshKeyOption = rawSSH.sshKey ? `-i ${rawSSH.sshKey}` : ''; | ||
//const scpCommand = `scp ${sshKeyOption} ${portOption} ${filePath} ${rawSSH.sshHost}:${sshBaseDir}`; | ||
// return scpCommand; | ||
} | ||
//"scp -i /path/to/private/key -P 51110 /Users/ilijaGlavas/StudioProjects/nomo-webon-cli/out/nomo.tar.gz [email protected]:/var/www/html/webons/demo.nomo.app/ | ||
|
||
//("scp -p 51110 /Users/ilijaGlavas/StudioProjects/nomo-webon-cli/out/nomo.tar.gz [email protected]:/var/www/html/webons/demo.nomo.app/"); | ||
function deployFile( | ||
filePath: string, | ||
sshHost: string, | ||
sshBaseDir: string, | ||
port?: number | ||
): string { | ||
return `${scpCommand(filePath, sshHost, sshBaseDir, port)}`; | ||
} | ||
|
||
function manifestChecks(manifestFilePath: string) { | ||
const nomoManifestContent = fs.readFileSync(manifestFilePath, "utf-8"); | ||
|