update to latest standards

This commit is contained in:
2016-11-23 12:38:38 +01:00
parent 8f29f234f1
commit 27237f14c7
29 changed files with 606 additions and 593 deletions

View File

@@ -1,54 +1,54 @@
import "typings-global";
import * as plugins from "./smartssh.plugins";
import * as helpers from "./smartssh.classes.helpers";
import {SshKey} from "./smartssh.classes.sshkey"
import 'typings-global'
import * as plugins from './smartssh.plugins'
import * as helpers from './smartssh.classes.helpers'
import {SshKey} from './smartssh.classes.sshkey'
export class SshConfig {
private _sshKeyArray:SshKey[];
constructor(sshKeyArrayArg:SshKey[]){
this._sshKeyArray = sshKeyArrayArg;
private _sshKeyArray: SshKey[]
constructor(sshKeyArrayArg: SshKey[]) {
this._sshKeyArray = sshKeyArrayArg
}
/**
* stores a config file
*/
store(dirPathArg:string){
let done = plugins.q.defer();
let configArray:configObject[] = [];
let configString;
for(let key in this._sshKeyArray){
let sshKey = this._sshKeyArray[key];
if(sshKey.host){
configString = "Host " + sshKey.host + "\n" +
" HostName " + sshKey.host + "\n" +
" IdentityFile ~/.ssh/" + sshKey.host + "\n" +
" StrictHostKeyChecking no" + "\n"
store(dirPathArg: string) {
let done = plugins.q.defer()
let configArray: configObject[] = []
let configString
for (let key in this._sshKeyArray) {
let sshKey = this._sshKeyArray[key]
if (sshKey.host) {
configString = 'Host ' + sshKey.host + '\n' +
' HostName ' + sshKey.host + '\n' +
' IdentityFile ~/.ssh/' + sshKey.host + '\n' +
' StrictHostKeyChecking no' + '\n'
}
configArray.push({
configString:configString,
configString: configString,
authorized: sshKey.authorized,
sshKey: sshKey
});
})
}
let configFile:string = "";
for(let key in configArray){
configFile = configFile + configArray[key].configString + "\n";
let configFile: string = ''
for (let key in configArray) {
configFile = configFile + configArray[key].configString + '\n'
};
plugins.smartfile.memory.toFsSync(configFile,plugins.path.join(dirPathArg,"config"));
return done.promise;
plugins.smartfile.memory.toFsSync(configFile,plugins.path.join(dirPathArg,'config'))
return done.promise
}
read(dirPathArg){
let done = plugins.q.defer();
let configArray:configObject[];
plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg,"config"));
read(dirPathArg) {
let done = plugins.q.defer()
let configArray: configObject[]
plugins.smartfile.fs.toStringSync(plugins.path.join(dirPathArg,'config'))
return done.promise;
return done.promise
}
};
export interface configObject {
configString:string;
authorized:boolean;
sshKey:SshKey;
configString: string
authorized: boolean
sshKey: SshKey
};