now ships with ssh support
This commit is contained in:
parent
e77a30b2bc
commit
2b4bfbdb39
19
dist/npmci.ssh.js
vendored
19
dist/npmci.ssh.js
vendored
@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./npmci.plugins");
|
||||
var sshRegex = /^(.*)\|?(.*)\|?(.*)/;
|
||||
var sshRegex = /^(.*)\|(.*)\|(.*)/;
|
||||
var sshInstance;
|
||||
exports.ssh = function () {
|
||||
var done = plugins.q.defer();
|
||||
@ -14,15 +14,16 @@ exports.ssh = function () {
|
||||
var evaluateSshEnv = function (sshkeyEnvVarArg) {
|
||||
var resultArray = sshRegex.exec(sshkeyEnvVarArg);
|
||||
var sshKey = new plugins.smartssh.SshKey();
|
||||
if (resultArray[1] && resultArray[1] != "undefined")
|
||||
sshKey.privKeyBase64 = resultArray[1];
|
||||
var publicKey;
|
||||
if (resultArray[2] && resultArray[2] != "undefined")
|
||||
sshKey.pubKeyBase64 = resultArray[2];
|
||||
var host;
|
||||
if (resultArray[3] && resultArray[3] != "undefined")
|
||||
if (notUndefined(resultArray[1]))
|
||||
sshKey.host = resultArray[1];
|
||||
if (notUndefined(resultArray[2]))
|
||||
sshKey.privKeyBase64 = resultArray[2];
|
||||
if (notUndefined(resultArray[3]))
|
||||
sshKey.pubKeyBase64 = resultArray[3];
|
||||
sshInstance.addKey(sshKey);
|
||||
};
|
||||
var notUndefined = function (stringArg) {
|
||||
return (stringArg && stringArg != "undefined" && stringArg != "##");
|
||||
};
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnNzaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGlCQUFpQixDQUFDLENBQUE7QUFFM0MsSUFBSSxRQUFRLEdBQUcscUJBQXFCLENBQUE7Q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A9IHJlc3VsdEFycmF5WzJdO1xuICAgIGlmKG5vdFVuZGVmaW5lZChyZXN1bHRBcnJheVszXSkpIHNzaEtleS5wdWJLZXlCYXNlNjQgPSByZXN1bHRBcnJheVszXTtcbiAgICBcbiAgICBzc2hJbnN0YW5jZS5hZGRLZXkoc3NoS2V5KTtcbn07XG5cbmxldCBub3RVbmRlZmluZWQgPSAoc3RyaW5nQXJnOnN0cmluZykgPT4ge1xuICAgIHJldHVybiAoc3RyaW5nQXJnICYmIHN0cmluZ0FyZyAhPSBcInVuZGVmaW5lZFwiICYmIHN0cmluZ0FyZyAhPSBcIiMjXCIpXG59Il19
|
||||
|
@ -1,7 +1,7 @@
|
||||
import "typings-global";
|
||||
import * as plugins from "./npmci.plugins";
|
||||
|
||||
let sshRegex = /^(.*)\|?(.*)\|?(.*)/
|
||||
let sshRegex = /^(.*)\|(.*)\|(.*)/
|
||||
let sshInstance:plugins.smartssh.SshInstance;
|
||||
|
||||
export let ssh = () => {
|
||||
@ -17,11 +17,13 @@ let evaluateSshEnv = (sshkeyEnvVarArg) => {
|
||||
let resultArray = sshRegex.exec(sshkeyEnvVarArg);
|
||||
let sshKey = new plugins.smartssh.SshKey();
|
||||
|
||||
if(resultArray[1] && resultArray[1] != "undefined") sshKey.privKeyBase64 = resultArray[1];
|
||||
let publicKey:string;
|
||||
if(resultArray[2] && resultArray[2] != "undefined") sshKey.pubKeyBase64 = resultArray[2];
|
||||
let host:string;
|
||||
if(resultArray[3] && resultArray[3] != "undefined") sshKey.host = resultArray[1];
|
||||
if(notUndefined(resultArray[1])) sshKey.host = resultArray[1];
|
||||
if(notUndefined(resultArray[2])) sshKey.privKeyBase64 = resultArray[2];
|
||||
if(notUndefined(resultArray[3])) sshKey.pubKeyBase64 = resultArray[3];
|
||||
|
||||
sshInstance.addKey(sshKey);
|
||||
};
|
||||
};
|
||||
|
||||
let notUndefined = (stringArg:string) => {
|
||||
return (stringArg && stringArg != "undefined" && stringArg != "##")
|
||||
}
|
Loading…
Reference in New Issue
Block a user