update structure

This commit is contained in:
Philipp Kunz 2016-06-25 16:29:06 +02:00
parent b8a0c788eb
commit e77a30b2bc
6 changed files with 29 additions and 9 deletions

File diff suppressed because one or more lines are too long

3
dist/npmci.ssh.d.ts vendored
View File

@ -1,3 +1,2 @@
import "typings-global"; import "typings-global";
export declare let ssh: () => void; export declare let ssh: () => any;
export declare let evaluateSshkey: (sshkeyEnvVarArg: any) => void;

9
dist/npmci.ssh.js vendored
View File

@ -4,11 +4,14 @@ var plugins = require("./npmci.plugins");
var sshRegex = /^(.*)\|?(.*)\|?(.*)/; var sshRegex = /^(.*)\|?(.*)\|?(.*)/;
var sshInstance; var sshInstance;
exports.ssh = function () { exports.ssh = function () {
var done = plugins.q.defer();
sshInstance = new plugins.smartssh.SshInstance(); sshInstance = new plugins.smartssh.SshInstance();
plugins.smartparam.forEachMinimatch(process.env, "NPMCI_SSHKEY_*", exports.evaluateSshkey); plugins.smartparam.forEachMinimatch(process.env, "NPMCI_SSHKEY_*", evaluateSshEnv);
sshInstance.writeToDisk(); sshInstance.writeToDisk();
done.resolve();
return done.promise;
}; };
exports.evaluateSshkey = function (sshkeyEnvVarArg) { var evaluateSshEnv = function (sshkeyEnvVarArg) {
var resultArray = sshRegex.exec(sshkeyEnvVarArg); var resultArray = sshRegex.exec(sshkeyEnvVarArg);
var sshKey = new plugins.smartssh.SshKey(); var sshKey = new plugins.smartssh.SshKey();
if (resultArray[1] && resultArray[1] != "undefined") if (resultArray[1] && resultArray[1] != "undefined")
@ -22,4 +25,4 @@ exports.evaluateSshkey = function (sshkeyEnvVarArg) {
sshInstance.addKey(sshKey); sshInstance.addKey(sshKey);
}; };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5wbWNpLnNzaC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ3hCLElBQVksT0FBTyxXQUFNLGl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NzaEtleS5ob3N0ID0gcmVzdWx0QXJyYXlbMV07XG4gICAgXG4gICAgc3NoSW5zdGFuY2UuYWRkS2V5KHNzaEtleSk7XG59OyJdfQ==

View File

@ -36,7 +36,7 @@
"smartcli": "^1.0.4", "smartcli": "^1.0.4",
"smartfile": "^4.0.5", "smartfile": "^4.0.5",
"smartparam": "^0.1.1", "smartparam": "^0.1.1",
"smartssh": "^1.1.0", "smartssh": "^1.1.2",
"smartstring": "^2.0.10", "smartstring": "^2.0.10",
"through2": "^2.0.1", "through2": "^2.0.1",
"typings-global": "^1.0.3" "typings-global": "^1.0.3"

View File

@ -2,6 +2,7 @@ import "typings-global";
import * as plugins from "./npmci.plugins"; import * as plugins from "./npmci.plugins";
import {bash} from "./npmci.bash"; import {bash} from "./npmci.bash";
import * as env from "./npmci.env" import * as env from "./npmci.env"
import * as sshModule from "./npmci.ssh"
let npm = function(){ let npm = function(){
let done = plugins.q.defer(); let done = plugins.q.defer();
@ -46,6 +47,13 @@ let dockerGitlab = function(){
return done.promise; return done.promise;
} }
let ssh = function(){
let done = plugins.q.defer();
sshModule.ssh()
.then(done.resolve);
return done.promise;
}
export let prepare = function(serviceArg:string){ export let prepare = function(serviceArg:string){
switch (serviceArg) { switch (serviceArg) {
case "npm": case "npm":

View File

@ -5,12 +5,15 @@ let sshRegex = /^(.*)\|?(.*)\|?(.*)/
let sshInstance:plugins.smartssh.SshInstance; let sshInstance:plugins.smartssh.SshInstance;
export let ssh = () => { export let ssh = () => {
let done = plugins.q.defer();
sshInstance = new plugins.smartssh.SshInstance(); sshInstance = new plugins.smartssh.SshInstance();
plugins.smartparam.forEachMinimatch(process.env,"NPMCI_SSHKEY_*",evaluateSshkey); plugins.smartparam.forEachMinimatch(process.env,"NPMCI_SSHKEY_*",evaluateSshEnv);
sshInstance.writeToDisk(); sshInstance.writeToDisk();
done.resolve();
return done.promise;
}; };
export let evaluateSshkey = (sshkeyEnvVarArg) => { let evaluateSshEnv = (sshkeyEnvVarArg) => {
let resultArray = sshRegex.exec(sshkeyEnvVarArg); let resultArray = sshRegex.exec(sshkeyEnvVarArg);
let sshKey = new plugins.smartssh.SshKey(); let sshKey = new plugins.smartssh.SshKey();