start tests
This commit is contained in:
parent
1b30aa428e
commit
39abfd760b
2
dist/index.d.ts
vendored
2
dist/index.d.ts
vendored
@ -1,5 +1,5 @@
|
||||
import "typings-global";
|
||||
export { Ssh } from "./smartssh.classes.ssh";
|
||||
export { SshInstance } from "./smartssh.classes.sshinstance";
|
||||
export { SshKey } from "./smartssh.classes.sshkey";
|
||||
export { SshDir } from "./smartssh.classes.sshdir";
|
||||
export { SshConfig } from "./smartssh.classes.sshconfig";
|
||||
|
6
dist/index.js
vendored
6
dist/index.js
vendored
@ -1,7 +1,7 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var smartssh_classes_ssh_1 = require("./smartssh.classes.ssh");
|
||||
exports.Ssh = smartssh_classes_ssh_1.Ssh;
|
||||
var smartssh_classes_sshinstance_1 = require("./smartssh.classes.sshinstance");
|
||||
exports.SshInstance = smartssh_classes_sshinstance_1.SshInstance;
|
||||
var smartssh_classes_sshkey_1 = require("./smartssh.classes.sshkey");
|
||||
exports.SshKey = smartssh_classes_sshkey_1.SshKey;
|
||||
var smartssh_classes_sshdir_1 = require("./smartssh.classes.sshdir");
|
||||
@ -9,4 +9,4 @@ exports.SshDir = smartssh_classes_sshdir_1.SshDir;
|
||||
var smartssh_classes_sshconfig_1 = require("./smartssh.classes.sshconfig");
|
||||
exports.SshConfig = smartssh_classes_sshconfig_1.SshConfig;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFHdkIscUNBQWtCLHdCQUF3QixDQUFDO0FBQW5DLHlDQUFtQztBQUMzQyx3Q0FBcUIsMkJBQTJCLENBQUM7QUFBekMsa0RBQXlDO0FBQ2pELHdDQUFxQiwyQkFBMkIsQ0FBQztBQUF6QyxrREFBeUM7QUFDakQsMkNBQXdCLDhCQUE4Qix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mNlXCI7XHJcbmV4cG9ydCB7U3NoS2V5fSBmcm9tIFwiLi9zbWFydHNzaC5jbGFzc2VzLnNzaGtleVwiO1xyXG5leHBvcnQge1NzaERpcn0gZnJvbSBcIi4vc21hcnRzc2guY2xhc3Nlcy5zc2hkaXJcIjtcclxuZXhwb3J0IHtTc2hDb25maWd9IGZyb20gXCIuL3NtYXJ0c3NoLmNsYXNzZXMuc3NoY29uZmlnXCI7Il19
|
||||
|
52
dist/smartssh.classes.ssh.js
vendored
52
dist/smartssh.classes.ssh.js
vendored
@ -1,52 +0,0 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var helpers = require("./smartssh.classes.helpers");
|
||||
var smartssh_classes_sshdir_1 = require("./smartssh.classes.sshdir");
|
||||
var Ssh = (function () {
|
||||
function Ssh(optionsArg) {
|
||||
if (optionsArg === void 0) { optionsArg = {}; }
|
||||
this.sshDir = new smartssh_classes_sshdir_1.SshDir(optionsArg.sshDir);
|
||||
this.sshKeys = this.sshDir.getKeys();
|
||||
this.sshSync = optionsArg.sshSync;
|
||||
}
|
||||
;
|
||||
Ssh.prototype.addKey = function (sshKeyArg) {
|
||||
this.sshKeys.push(sshKeyArg);
|
||||
this.sync();
|
||||
};
|
||||
;
|
||||
Ssh.prototype.getKey = function (hostArg) {
|
||||
var filteredArray = this.sshKeys.filter(function (keyArg) {
|
||||
return (keyArg.host == hostArg);
|
||||
});
|
||||
if (filteredArray.length > 0) {
|
||||
return filteredArray[0];
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
;
|
||||
Ssh.prototype.removeKey = function (sshKeyArg) {
|
||||
var keyIndex = helpers.getKeyIndex(sshKeyArg.host);
|
||||
this.sshKeys.splice(keyIndex, 1);
|
||||
this.sync();
|
||||
};
|
||||
;
|
||||
Ssh.prototype.replaceKey = function (sshKeyOldArg, sshKeyNewArg) {
|
||||
var keyIndex = helpers.getKeyIndex(sshKeyOldArg.host);
|
||||
this.sshKeys.splice(keyIndex, 1, sshKeyNewArg);
|
||||
this.sync();
|
||||
};
|
||||
;
|
||||
Ssh.prototype.sync = function () {
|
||||
if (this.sshSync) {
|
||||
this.sshDir.sync(this.sshConfig, this.sshKeys); // call sync method of sshDir class;
|
||||
}
|
||||
};
|
||||
;
|
||||
return Ssh;
|
||||
}());
|
||||
exports.Ssh = Ssh;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUNQLENBQUMsQ0FEc0I7QUFFdkIsSUFBWSxPQUFPLFdBQU0sNEJBQTRCLENBQUMsQ0FBQTtBQUV0RCx3Q0FBcUIsMkJBQTJCLENBQUMsQ0FBQTtBQUlqRDtJQUtJLGFBQVksVUFBK0M7UUFBL0MsMEJBQStDLEdBQS9DLGVBQStDO1FBQ3ZELElBQUksQ0FBQyxNQUFNLEdBQUcsSUFBSSxnQ0FBTSxDQUFDLFVBQVUsQ0FBQyxNQUFNLENBQUMsQ0FBQztRQUM1QyxJQUFJLENBQUMsT0FBTyxHQUFHLElBQUksQ0FBQyxNQUFNLENBQUMsT0FBTyxFQUFFLENBQUM7UUFDckMsSUFBSSxDQUFDLE9BQU8sR0FBRyxVQUFVLENBQUMsT0FBTyxDQUFDO0lBQ3RDLENBQUM7O0lBQ0Qsb0JBQU0sR0FBTixVQUFPLFNBQWdCO1FBQ25CLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBQzdCLElBQUksQ0FBQyxJQUFJLEVBQUUsQ0FBQztJQUNoQixDQUFDOztJQUNELG9CQUFNLEdBQU4sVUFBTyxPQUFjO1FBQ2pCLElBQUksYUFBYSxHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLFVBQVMsTUFBTTtZQUN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5zeW5jKCk7XHJcbiAgICB9O1xyXG4gICAgcmVwbGFjZUtleShzc2hLZXlPbGRBcmc6U3NoS2V5LHNzaEtleU5ld0FyZzpTc2hLZXkpe1xyXG4gICAgICAgIGxldCBrZXlJbmRleCA9IGhlbHBlcnMuZ2V0S2V5SW5kZXgoc3NoS2V5T2xkQXJnLmhvc3QpO1xyXG4gICAgICAgIHRoaXMuc3NoS2V5cy5zcGxpY2Uoa2V5SW5kZXgsMSxzc2hLZXlOZXdBcmcpO1xyXG4gICAgICAgIHRoaXMuc3luYygpO1xyXG4gICAgfTtcclxuICAgIHN5bmMoKXtcclxuICAgICAgICBpZih0aGlzLnNzaFN5bmMpe1xyXG4gICAgICAgICAgICB0aGlzLnNzaERpci5zeW5jKHRoaXMuc3NoQ29uZmlnLHRoaXMuc3NoS2V5cyk7IC8vIGNhbGwgc3luYyBtZXRob2Qgb2Ygc3NoRGlyIGNsYXNzO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcbn1cclxuXHJcblxyXG4iXX0=
|
5
dist/smartssh.classes.sshdir.d.ts
vendored
5
dist/smartssh.classes.sshdir.d.ts
vendored
@ -1,9 +1,10 @@
|
||||
import "typings-global";
|
||||
import { SshInstance } from "./smartssh.classes.sshinstance";
|
||||
import { SshKey } from "./smartssh.classes.sshkey";
|
||||
import { SshConfig } from "./smartssh.classes.sshconfig";
|
||||
export declare class SshDir {
|
||||
path: string;
|
||||
constructor(sshDirPathArg: string);
|
||||
sync(sshConfigArg: SshConfig, sshKeysArg: SshKey[]): void;
|
||||
syncToDir(sshInstanceArg: SshInstance): void;
|
||||
syncFromDir(): void;
|
||||
getKeys(): SshKey[];
|
||||
}
|
||||
|
16
dist/smartssh.classes.sshdir.js
vendored
16
dist/smartssh.classes.sshdir.js
vendored
@ -1,13 +1,23 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var plugins = require("./smartssh.plugins");
|
||||
var helpers = require("./smartssh.classes.helpers");
|
||||
var SshDir = (function () {
|
||||
function SshDir(sshDirPathArg) {
|
||||
this.path = sshDirPathArg;
|
||||
var sshDirPath;
|
||||
if (sshDirPathArg) {
|
||||
sshDirPath = sshDirPathArg;
|
||||
}
|
||||
SshDir.prototype.sync = function (sshConfigArg, sshKeysArg) {
|
||||
else {
|
||||
sshDirPath = plugins.smartpath.get.home();
|
||||
}
|
||||
this.path = sshDirPath;
|
||||
}
|
||||
SshDir.prototype.syncToDir = function (sshInstanceArg) {
|
||||
};
|
||||
;
|
||||
SshDir.prototype.syncFromDir = function () {
|
||||
};
|
||||
SshDir.prototype.getKeys = function () {
|
||||
return helpers.sshKeyArrayFromDir(this.path);
|
||||
};
|
||||
@ -15,4 +25,4 @@ var SshDir = (function () {
|
||||
}());
|
||||
exports.SshDir = SshDir;
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFFeEIsSUFBWSxPQUFPLFdBQU0sNEJBQTRCLENBQUMsQ0FBQTtBQUd0RDtJQUVJLGdCQUFZLGFBQW9CO1FBQzVCLElBQUksQ0FBQyxJQUFJLEdBQUcsYUFBYSxDQUFDO0lBQzlCLENBQUM7SUFDRCxxQkFBSSxHQUFKLFVBQUssWUFBc0IsRUFBQyxVQUFtQjtJQUUvQyxDQUFDOztJQUNELHdCQUFPLEdBQVA7UUFDSSxNQUFNLENBQUMsT0FBTyxDQUFDLGtCQUFrQixDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztJQUNqRCxDQUFDO0lBQ0wsYUFBQztBQUFELENBWEEsQUFXQyxJQUFBO0FBWFksY0FBTSxTQVdsQixDQUFBIiwiZmlsZSI6InNtYXJ0c3NoLmNsYXNzZXMuc3NoZGlyLmpzIiwic291cmNlc0NvbnRlbnQiOls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LmNsYXNzZXMuc3Noa2V5XCI7XHJcbmltcG9ydCB7U3NoQ29uZmlnfSBmcm9tIFwiLi9zbWFydHNzaC5jbGFzc2VzLnNzaGNvbmZpZ1wiO1xyXG5leHBvcnQgY2xhc3MgU3NoRGlyIHsgLy8gc3NoRGlyIGNsYXNzIC0+IE5PVCBFWFBPUlRFRCwgT05MWSBGT1IgSU5URVJOQUwgVVNFXHJcbiAgICBwYXRoOnN0cmluZzsgLy8gdGhlIHBhdGggb2YgdGhlIHNzaCBkaXJlY3RvcnlcclxuICAgIGNvbnN0cnVjdG9yKHNzaERpclBhdGhBcmc6c3RyaW5nKXtcclxuICAgICAgICBsZXQgc3NoRGlyUGF0aDpzdHJpbmc7XHJcbiAgICAgICAgaWYoc3NoRGlyUGF0aEFyZyl7XHJcbiAgICAgICAgICAgIHNzaERpclBhdGggPSBzc2hEaXJQYXRoQXJnO1xyXG4gICAgICAgIH0gZWxzZSB7XHJcbiAgICAgICAgICAgIHNzaERpclBhdGggPSBwbHVnaW5zLnNtYXJ0cGF0aC5nZXQuaG9tZSgpO1xyXG4gICAgICAgIH1cclxuICAgICAgICB0aGlzLnBhdGggPSBzc2hEaXJQYXRoO1xyXG4gICAgfVxyXG4gICAgc3luY1RvRGlyKHNzaEluc3RhbmNlQXJnOlNzaEluc3RhbmNlKXsgLy9zeW5jcyBcclxuICAgICAgICBcclxuICAgIH07XHJcbiAgICBzeW5jRnJvbURpcigpe1xyXG4gICAgICAgIFxyXG4gICAgfVxyXG4gICAgZ2V0S2V5cygpe1xyXG4gICAgICAgIHJldHVybiBoZWxwZXJzLnNzaEtleUFycmF5RnJvbURpcih0aGlzLnBhdGgpO1xyXG4gICAgfVxyXG59Il19
|
||||
|
@ -1,6 +1,6 @@
|
||||
import "typings-global";
|
||||
import { SshKey } from "./smartssh.classes.sshkey";
|
||||
export declare class Ssh {
|
||||
export declare class SshInstance {
|
||||
private sshConfig;
|
||||
private sshDir;
|
||||
private sshKeys;
|
53
dist/smartssh.classes.sshinstance.js
vendored
Normal file
53
dist/smartssh.classes.sshinstance.js
vendored
Normal file
@ -0,0 +1,53 @@
|
||||
"use strict";
|
||||
require("typings-global");
|
||||
var helpers = require("./smartssh.classes.helpers");
|
||||
var smartssh_classes_sshdir_1 = require("./smartssh.classes.sshdir");
|
||||
var SshInstance = (function () {
|
||||
function SshInstance(optionsArg) {
|
||||
if (optionsArg === void 0) { optionsArg = {}; }
|
||||
optionsArg ? void (0) : optionsArg = {};
|
||||
this.sshDir = new smartssh_classes_sshdir_1.SshDir(optionsArg.sshDir);
|
||||
this.sshKeys = this.sshDir.getKeys();
|
||||
this.sshSync = optionsArg.sshSync;
|
||||
}
|
||||
;
|
||||
SshInstance.prototype.addKey = function (sshKeyArg) {
|
||||
this.sshKeys.push(sshKeyArg);
|
||||
this.sync();
|
||||
};
|
||||
;
|
||||
SshInstance.prototype.getKey = function (hostArg) {
|
||||
var filteredArray = this.sshKeys.filter(function (keyArg) {
|
||||
return (keyArg.host == hostArg);
|
||||
});
|
||||
if (filteredArray.length > 0) {
|
||||
return filteredArray[0];
|
||||
}
|
||||
else {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
;
|
||||
SshInstance.prototype.removeKey = function (sshKeyArg) {
|
||||
var keyIndex = helpers.getKeyIndex(sshKeyArg.host);
|
||||
this.sshKeys.splice(keyIndex, 1);
|
||||
this.sync();
|
||||
};
|
||||
;
|
||||
SshInstance.prototype.replaceKey = function (sshKeyOldArg, sshKeyNewArg) {
|
||||
var keyIndex = helpers.getKeyIndex(sshKeyOldArg.host);
|
||||
this.sshKeys.splice(keyIndex, 1, sshKeyNewArg);
|
||||
this.sync();
|
||||
};
|
||||
;
|
||||
SshInstance.prototype.sync = function () {
|
||||
if (this.sshSync) {
|
||||
this.sshDir.sync(this.sshConfig, this.sshKeys); // call sync method of sshDir class;
|
||||
}
|
||||
};
|
||||
;
|
||||
return SshInstance;
|
||||
}());
|
||||
exports.SshInstance = SshInstance;
|
||||
|
||||
//# source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O1xyXG4gICAgcmVwbGFjZUtleShzc2hLZXlPbGRBcmc6U3NoS2V5LHNzaEtleU5ld0FyZzpTc2hLZXkpe1xyXG4gICAgICAgIGxldCBrZXlJbmRleCA9IGhlbHBlcnMuZ2V0S2V5SW5kZXgoc3NoS2V5T2xkQXJnLmhvc3QpO1xyXG4gICAgICAgIHRoaXMuc3NoS2V5cy5zcGxpY2Uoa2V5SW5kZXgsMSxzc2hLZXlOZXdBcmcpO1xyXG4gICAgICAgIHRoaXMuc3luYygpO1xyXG4gICAgfTtcclxuICAgIHN5bmMoKXtcclxuICAgICAgICBpZih0aGlzLnNzaFN5bmMpe1xyXG4gICAgICAgICAgICB0aGlzLnNzaERpci5zeW5jKHRoaXMuc3NoQ29uZmlnLHRoaXMuc3NoS2V5cyk7IC8vIGNhbGwgc3luYyBtZXRob2Qgb2Ygc3NoRGlyIGNsYXNzO1xyXG4gICAgICAgIH1cclxuICAgIH07XHJcbn1cclxuXHJcblxyXG4iXX0=
|
1
dist/smartssh.plugins.d.ts
vendored
1
dist/smartssh.plugins.d.ts
vendored
@ -4,3 +4,4 @@ export declare let base64: any;
|
||||
export declare let fs: any;
|
||||
export declare let path: any;
|
||||
export declare let smartfile: any;
|
||||
export import smartpath = require("smartpath");
|
||||
|
3
dist/smartssh.plugins.js
vendored
3
dist/smartssh.plugins.js
vendored
@ -5,5 +5,6 @@ exports.base64 = require("js-base64").Base64;
|
||||
exports.fs = require("fs-extra");
|
||||
exports.path = require("path");
|
||||
exports.smartfile = require("smartfile");
|
||||
exports.smartpath = require("smartpath");
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNtYXJ0c3NoLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sZ0JBQ1AsQ0FBQyxDQURzQjtBQUNaLGlCQUFTLEdBQUcsT0FBTyxDQUFDLFdBQVcsQ0FBQyxDQ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MsQ0FBQztBQUN2QixpQkFBUyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUM5QixpQkFBUyxXQUFXLFdBQVcsQ0FBQyxDQUFDIiwiZmlsZSI6InNtYXJ0c3NoLnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgXCJ0eXBpbmdzLWdsb2JhbFwiXHJcbmV4cG9ydCBsZXQgYmVhdXR5bG9nID0gcmVxdWlyZShcImJlYXV0eWxvZ1wiKTtcclxuZXhwb3J0IGxldCBiYXNlNjQgPSByZXF1aXJlKFwianMtYmFzZTY0XCIpLkJhc2U2NDtcclxuZXhwb3J0IGxldCBmcyA9IHJlcXVpcmUoXCJmcy1leHRyYVwiKTtcclxuZXhwb3J0IGxldCBwYXRoID0gcmVxdWlyZShcInBhdGhcIik7XHJcbmV4cG9ydCBsZXQgc21hcnRmaWxlID0gcmVxdWlyZShcInNtYXJ0ZmlsZVwiKTtcclxuZXhwb3J0IGltcG9ydCBzbWFydHBhdGggPSByZXF1aXJlKFwic21hcnRwYXRoXCIpOyJdfQ==
|
||||
|
@ -26,6 +26,7 @@
|
||||
"fs-extra": "^0.30.0",
|
||||
"js-base64": "^2.1.9",
|
||||
"smartfile": "^3.0.10",
|
||||
"smartpath": "^3.2.2",
|
||||
"typings-global": "^1.0.3",
|
||||
"typings-test": "^1.0.1"
|
||||
},
|
||||
|
1
test/test.d.ts
vendored
1
test/test.d.ts
vendored
@ -1 +1,2 @@
|
||||
import "typings-test";
|
||||
import "should";
|
||||
|
16
test/test.js
16
test/test.js
@ -1,6 +1,16 @@
|
||||
"use strict";
|
||||
require("typings-test");
|
||||
var should = require("should");
|
||||
var smartssh = require("../dist/index.js");
|
||||
require("should");
|
||||
var smartssh = require("../dist/index");
|
||||
describe("smartssh", function () {
|
||||
var testSshInstance;
|
||||
var testSshKey;
|
||||
describe("SshInstance", function () {
|
||||
it("should create a new SshInstance object from class", function () {
|
||||
testSshInstance = new smartssh.SshInstance();
|
||||
testSshInstance.should.be.instanceof(smartssh.SshInstance);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLElBQUksTUFBTSxHQUFHLE9BQU8sQ0FBQyxRQUFRLENBQUMsQ0FBQztBQUMvQixJQUFJLFFBQVEsR0FBRyxPQUFPLENBQUMsa0JBQWtCLENBQUMsQ0FBQyIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy10ZXN0XCJcclxubGV0IHNob3VsZCA9IHJlcXVpcmUoXCJzaG91bGRcIik7XHJcbmxldCBzbWFydHNzaCA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4LmpzXCIpO1xyXG4iXX0=
|
||||
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FDUCxDQUFDLENBRG9CO0FBQ3JCLFFBQU8sUUFBUSxDQUFDLENBQUE7QUFDaEIsSUFBTyxRQUFRLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFFM0MsUUFBUSxDQUFDLFVBQVUsRUFBQztJQUNoQixJQUFJLGVBQW9DLENBQUM7SUFDekMsSUFBSSxVQUEwQixDQUFDO0lBQy9CLFFBQVEsQ0FBQyxhQUFhLEVBQUM7UUFDbkIsRUFBRSxDQUFDLG1EQUFtRCxFQUFDO1lBQ25ELGVBQWUsR0FBRyxJQUFJLFFBQVEsQ0FBQyxXQUFXLEVBQUUsQ0FBQztZQUM3QyxlQUFlLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLFdBQVcsQ0FBQyxDQUFDO1FBQy9ELENBQUMsQ0FBQyxDQUFDO0lBQ1AsQ0FBQyxDQUFDLENBQUE7QUFDTixDQUFDLENBQUMsQ0FBQSIsImZpbGUiOiJ0ZXN0LmpzIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFwidHlwaW5ncy10ZXN0XCJcclxuaW1wb3J0IFwic2hvdWxkXCI7XHJcbmltcG9ydCBzbWFydHNzaCA9IHJlcXVpcmUoXCIuLi9kaXN0L2luZGV4XCIpO1xyXG5cclxuZGVzY3JpYmUoXCJzbWFydHNzaFwiLGZ1bmN0aW9uKCl7XHJcbiAgICBsZXQgdGVzdFNzaEluc3RhbmNlOnNtYXJ0c3NoLlNzaEluc3RhbmNlO1xyXG4gICAgbGV0IHRlc3RTc2hLZXk6c21hcnRzc2guU3NoS2V5O1xyXG4gICAgZGVzY3JpYmUoXCJTc2hJbnN0YW5jZVwiLGZ1bmN0aW9uKCl7XHJcbiAgICAgICAgaXQoXCJzaG91bGQgY3JlYXRlIGEgbmV3IFNzaEluc3RhbmNlIG9iamVjdCBmcm9tIGNsYXNzXCIsZnVuY3Rpb24oKXtcclxuICAgICAgICAgICAgdGVzdFNzaEluc3RhbmNlID0gbmV3IHNtYXJ0c3NoLlNzaEluc3RhbmNlKCk7XHJcbiAgICAgICAgICAgIHRlc3RTc2hJbnN0YW5jZS5zaG91bGQuYmUuaW5zdGFuY2VvZihzbWFydHNzaC5Tc2hJbnN0YW5jZSk7XHJcbiAgICAgICAgfSk7XHJcbiAgICB9KVxyXG59KSJdfQ==
|
||||
|
17
test/test.ts
17
test/test.ts
@ -1,3 +1,16 @@
|
||||
import "typings-test"
|
||||
let should = require("should");
|
||||
let smartssh = require("../dist/index.js");
|
||||
import "should";
|
||||
import smartssh = require("../dist/index");
|
||||
describe("smartssh",function(){
|
||||
let testSshInstance:smartssh.SshInstance;
|
||||
let testSshKey:smartssh.SshKey;
|
||||
describe("SshInstance",function(){
|
||||
it("should create a new SshInstance object from class",function(){
|
||||
testSshInstance = new smartssh.SshInstance();
|
||||
testSshInstance.should.be.instanceof(smartssh.SshInstance);
|
||||
});
|
||||
it("should return an array of sshKeys",function(){
|
||||
|
||||
})
|
||||
})
|
||||
})
|
@ -1,6 +1,7 @@
|
||||
import "typings-global";
|
||||
import * as plugins from "./smartssh.plugins";
|
||||
import * as helpers from "./smartssh.classes.helpers";
|
||||
import {SshInstance} from "./smartssh.classes.sshinstance";
|
||||
import {SshKey} from "./smartssh.classes.sshkey";
|
||||
import {SshConfig} from "./smartssh.classes.sshconfig";
|
||||
export class SshDir { // sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE
|
||||
@ -10,13 +11,16 @@ export class SshDir { // sshDir class -> NOT EXPORTED, ONLY FOR INTERNAL USE
|
||||
if(sshDirPathArg){
|
||||
sshDirPath = sshDirPathArg;
|
||||
} else {
|
||||
sshDirPath = plugins.smartpath.home
|
||||
sshDirPath = plugins.smartpath.get.home();
|
||||
}
|
||||
this.path = sshDirPath;
|
||||
}
|
||||
sync(sshConfigArg:SshConfig,sshKeysArg:SshKey[]){
|
||||
syncToDir(sshInstanceArg:SshInstance){ //syncs
|
||||
|
||||
};
|
||||
syncFromDir(){
|
||||
|
||||
}
|
||||
getKeys(){
|
||||
return helpers.sshKeyArrayFromDir(this.path);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ export class SshInstance {
|
||||
private sshKeys:SshKey[]; //holds all ssh keys
|
||||
private sshSync:boolean; // if set to true, the ssh dir will be kept in sync automatically
|
||||
constructor(optionsArg:{sshDir?:string,sshSync?:boolean}={}){
|
||||
optionsArg ? void(0) : optionsArg = {};
|
||||
this.sshDir = new SshDir(optionsArg.sshDir);
|
||||
this.sshKeys = this.sshDir.getKeys();
|
||||
this.sshSync = optionsArg.sshSync;
|
||||
|
@ -4,3 +4,4 @@ export let base64 = require("js-base64").Base64;
|
||||
export let fs = require("fs-extra");
|
||||
export let path = require("path");
|
||||
export let smartfile = require("smartfile");
|
||||
export import smartpath = require("smartpath");
|
Loading…
Reference in New Issue
Block a user