improve Readme

This commit is contained in:
LosslessBot 2016-07-06 06:33:31 +02:00
parent 03edcd9e03
commit 48a1429332
18 changed files with 185 additions and 27 deletions

2
dist/index.d.ts vendored
View File

@ -1 +1,3 @@
import * as CommandModule from "./smartnginx.command";
export { NginxConfig, NginxZone } from "./smartnginx.classes.nginxconfig";
export declare let command: typeof CommandModule;

5
dist/index.js vendored
View File

@ -1,6 +1,9 @@
"use strict";
var CommandModule = require("./smartnginx.command");
// classes
var smartnginx_classes_nginxconfig_1 = require("./smartnginx.classes.nginxconfig");
exports.NginxConfig = smartnginx_classes_nginxconfig_1.NginxConfig;
exports.NginxZone = smartnginx_classes_nginxconfig_1.NginxZone;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBRUEsVUFBVTtBQUNWLCtDQUFvQyxrQ0FBa0MsQ0FBQztBQUEvRCxtRUFBVztBQUFDLCtEQUFtRCJ9
// exports
exports.command = CommandModule;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQ0EsSUFBWSxhQUFhLFdBQU0sc0JBQXNCLENBQUMsQ0FBQTtBQUV0RCxVQUFVO0FBQ1YsK0NBQW9DLGtDQUFrQyxDQUFDO0FBQS9ELG1FQUFXO0FBQUMsK0RBQW1EO0FBRXZFLFVBQVU7QUFDQyxlQUFPLEdBQUcsYUFBYSxDQUFDIn0=

View File

@ -2,19 +2,20 @@ export declare enum ZoneTypes {
}
export declare class NginxConfig {
zones: NginxZone[];
isDeployed: boolean;
constructor();
addZone(zoneArg: NginxZone): void;
listZones(): NginxZone[];
removeZones(zoneArg: NginxZone): void;
deploy(): void;
nginxStart(): void;
nginxStop(): void;
deploy(nginxRestartArg?: boolean): void;
}
export declare class NginxZone {
domain: any;
zoneName: string;
configString: string;
constructor(optionsArg: {
zoneName: string;
type: ZoneTypes;
destination: string;
});
deploy(): void;
}

View File

@ -1,9 +1,14 @@
"use strict";
var plugins = require("./smartnginx.plugins");
var paths = require("./smartnginx.paths");
var command = require("./smartnginx.command");
(function (ZoneTypes) {
})(exports.ZoneTypes || (exports.ZoneTypes = {}));
var ZoneTypes = exports.ZoneTypes;
var allConfigs = [];
var NginxConfig = (function () {
function NginxConfig() {
this.isDeployed = false;
}
;
// interact with Zones
@ -16,13 +21,23 @@ var NginxConfig = (function () {
NginxConfig.prototype.removeZones = function (zoneArg) {
};
// handle deployment of zones
NginxConfig.prototype.deploy = function () {
};
;
NginxConfig.prototype.nginxStart = function () {
};
;
NginxConfig.prototype.nginxStop = function () {
NginxConfig.prototype.deploy = function (nginxRestartArg) {
if (nginxRestartArg === void 0) { nginxRestartArg = false; }
plugins.smartfile.fs.remove(paths.nginxZoneBase);
plugins.smartfile.fs.ensureDir(paths.nginxZoneBase);
for (var _i = 0, allConfigs_1 = allConfigs; _i < allConfigs_1.length; _i++) {
var config = allConfigs_1[_i];
config.isDeployed = false;
}
;
this.isDeployed = true;
for (var _a = 0, _b = this.zones; _a < _b.length; _a++) {
var zone = _b[_a];
zone.deploy();
}
if (nginxRestartArg) {
command.restart(this);
}
};
;
return NginxConfig;
@ -32,8 +47,14 @@ exports.NginxConfig = NginxConfig;
var NginxZone = (function () {
function NginxZone(optionsArg) {
}
;
NginxZone.prototype.deploy = function () {
var filePath = plugins.path.join(paths.nginxZoneBase, this.zoneName + ".conf");
plugins.smartfile.memory.toFsSync(this.configString, filePath);
};
;
return NginxZone;
}());
exports.NginxZone = NginxZone;
var mynginx = new NginxConfig();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jbGF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ztTQUM3QjtRQUFBLENBQUM7UUFDRixJQUFJLENBQUMsVUFBVSxHQUFHLElBQUksQ0FBQztRQUN2QixHQUFHLENBQUEsQ0FBYSxVQUFVLEVBQVYsS0FBQSxJQUFJLENBQUMsS0FBSyxFQUFWLGNBQVUsRUFBVixJQUFVLENBQUM7WUFBdkIsSUFBSSxJQUFJLFNBQUE7WUFDUixJQUFJLENBQUMsTUFBTSxFQUFFLENBQUM7U0FDakI7UUFDRCxFQUFFLENBQUEsQ0FBQyxlQUFlLENBQUMsQ0FBQSxDQUFDO1lBQ2hCLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7UUFDMUIsQ0FBQztJQUNMLENBQUM7O0lBRUwsa0JBQUM7QUFBRCxDQUFDLEFBbENELElBa0NDO0FBbENZLG1CQUFXLGNBa0N2QixDQUFBO0FBQUEsQ0FBQztBQUVGO0lBR0ksbUJBQVksVUFJWDtJQUVELENBQUM7O0lBQ0QsMEJBQU0sR0FBTjtRQUNJLElBQUksUUFBUSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxhQUFhLEVBQUMsSUFBSSxDQUFDLFFBQVEsR0FBRyxPQUFPLENBQUMsQ0FBQztRQUM5RSxPQUFPLENBQUMsU0FBUyxDQUFDLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDLFlBQVksRUFBQyxRQUFRLENBQUMsQ0FBQztJQUNsRSxDQUFDOztJQUNMLGdCQUFDO0FBQUQsQ0FBQyxBQWRELElBY0M7QUFkWSxpQkFBUyxZQWNyQixDQUFBO0FBRUQsSUFBSSxPQUFPLEdBQUcsSUFBSSxXQUFXLEVBQUUsQ0FBQyJ9

14
dist/smartnginx.command.d.ts vendored Normal file
View File

@ -0,0 +1,14 @@
import { NginxConfig } from "./smartnginx.classes.nginxconfig";
/**
* starts nginx
*/
export declare let start: (configArg: NginxConfig) => void;
export declare let restart: (configArg: NginxConfig) => void;
/**
* stops nginx
*/
export declare let stop: () => void;
/**
* checks if nginx is in path
*/
export declare let check: () => boolean;

22
dist/smartnginx.command.js vendored Normal file
View File

@ -0,0 +1,22 @@
"use strict";
/**
* starts nginx
*/
exports.start = function (configArg) {
};
exports.restart = function (configArg) {
exports.stop();
exports.start(configArg);
};
/**
* stops nginx
*/
exports.stop = function () {
};
/**
* checks if nginx is in path
*/
exports.check = function () {
return;
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5jb21tYW5kLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRuZ2lueC5jb21tYW5kLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFHQTs7R0FFRztBQUNRLGFBQUssR0FBRyxVQUFDLFNBQXFCO0FBRXpDLENBQUMsQ0FBQztBQUVTLGVBQU8sR0FBRyxVQUFDLFNBQXFCO0lBQ3ZDLFlBQUksRUFBRSxDQUFDO0lBQ1AsYUFBSyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQ3JCLENBQUMsQ0FBQTtBQUVEOztHQUVHO0FBQ1EsWUFBSSxHQUFHO0FBRWxCLENBQUMsQ0FBQztBQUVGOztHQUVHO0FBQ1EsYUFBSyxHQUFHO0lBQ2YsTUFBTSxDQUFDO0FBQ1gsQ0FBQyxDQUFDIn0=

3
dist/smartnginx.paths.d.ts vendored Normal file
View File

@ -0,0 +1,3 @@
export declare let packageBase: string;
export declare let nginxConfigBase: string;
export declare let nginxZoneBase: string;

6
dist/smartnginx.paths.js vendored Normal file
View File

@ -0,0 +1,6 @@
"use strict";
var plugins = require("./smartnginx.plugins");
exports.packageBase = plugins.path.join(__dirname, "../");
exports.nginxConfigBase = plugins.path.join(exports.packageBase, "nginxconfig/");
exports.nginxZoneBase = plugins.path.join(exports.nginxConfigBase, "zones");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5wYXRocy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL3NtYXJ0bmdpbngucGF0aHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLElBQVksT0FBTyxXQUFNLHNCQUV6QixDQUFDLENBRjhDO0FBRXBDLG1CQUFXLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFDLEtBQUssQ0FBQyxDQUFDO0FBQ2pELHVCQUFlLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsbUJBQVcsRUFBQyxjQUFjLENBQUMsQ0FBQztBQUNoRSxxQkFBYSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLHVCQUFlLEVBQUMsT0FBTyxDQUFDLENBQUMifQ==

View File

@ -1,3 +1,6 @@
import "typings-global";
export import cert = require("cert");
export import path = require("path");
export import q = require("q");
export declare let shelljs: any;
export import smartfile = require("smartfile");

View File

@ -1,5 +1,8 @@
"use strict";
require("typings-global");
exports.cert = require("cert");
exports.path = require("path");
exports.q = require("q");
exports.shelljs = require("shelljs");
exports.smartfile = require("smartfile");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRuZ2lueC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBYyxZQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDdkIsU0FBQyxXQUFXLEdBQUcsQ0FBQyxDQUFDO0FBQ2pCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUMifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRuZ2lueC5wbHVnaW5zLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRuZ2lueC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxRQUFPLGdCQUFnQixDQUFDLENBQUE7QUFDVixZQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDdkIsWUFBSSxXQUFXLE1BQU0sQ0FBQyxDQUFDO0FBQ3ZCLFNBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQztBQUNwQixlQUFPLEdBQUcsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0FBQzFCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUMifQ==

View File

@ -24,6 +24,7 @@
"@types/q": "0.0.25-alpha",
"cert": "0.0.13",
"q": "^1.4.1",
"shelljs": "^0.7.0",
"smartfile": "^4.0.10"
},
"devDependencies": {

View File

@ -1,4 +1,15 @@
"use strict";
require("typings-test");
require("should");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQSJ9
var smartnginx = require("../dist/index");
describe("smartnginx", function () {
var testNginxConfig;
var testNginxZone01;
describe("NginxConfig", function () {
it("\"new NginxConfig()\" should produce an instance of NginxConfig", function () {
testNginxConfig = new smartnginx.NginxConfig();
testNginxConfig.should.be.instanceof(smartnginx.NginxConfig);
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUNoQixJQUFZLFVBQVUsV0FBTSxlQUFlLENBQUMsQ0FBQTtBQUU1QyxRQUFRLENBQUMsWUFBWSxFQUFDO0lBQ2xCLElBQUksZUFBc0MsQ0FBQztJQUMzQyxJQUFJLGVBQW9DLENBQUM7SUFDekMsUUFBUSxDQUFDLGFBQWEsRUFBQztRQUNuQixFQUFFLENBQUMsaUVBQStELEVBQUM7WUFDL0QsZUFBZSxHQUFHLElBQUksVUFBVSxDQUFDLFdBQVcsRUFBRSxDQUFDO1lBQy9DLGVBQWUsQ0FBQyxNQUFNLENBQUMsRUFBRSxDQUFDLFVBQVUsQ0FBQyxVQUFVLENBQUMsV0FBVyxDQUFDLENBQUM7UUFDakUsQ0FBQyxDQUFDLENBQUM7SUFFUCxDQUFDLENBQUMsQ0FBQTtBQUNOLENBQUMsQ0FBQyxDQUFDIn0=

View File

@ -1,3 +1,15 @@
import "typings-test";
import "should";
import smartnginx from "../dist/index"
import * as smartnginx from "../dist/index";
describe("smartnginx",function(){
let testNginxConfig:smartnginx.NginxConfig;
let testNginxZone01:smartnginx.NginxZone;
describe("NginxConfig",function(){
it(`"new NginxConfig()" should produce an instance of NginxConfig`,function(){
testNginxConfig = new smartnginx.NginxConfig();
testNginxConfig.should.be.instanceof(smartnginx.NginxConfig);
});
})
});

View File

@ -1,4 +1,8 @@
import * as plugins from "./smartnginx.plugins";
import * as CommandModule from "./smartnginx.command";
// classes
export {NginxConfig,NginxZone} from "./smartnginx.classes.nginxconfig";
export {NginxConfig,NginxZone} from "./smartnginx.classes.nginxconfig";
// exports
export let command = CommandModule;

View File

@ -1,11 +1,16 @@
import * as plugins from "./smartnginx.plugins";
import * as paths from "./smartnginx.paths";
import * as command from "./smartnginx.command";
export enum ZoneTypes {
}
let allConfigs:NginxConfig[] = [];
export class NginxConfig {
zones:NginxZone[];
isDeployed:boolean = false;
constructor(){
};
@ -22,26 +27,37 @@ export class NginxConfig {
}
// handle deployment of zones
deploy(){
};
nginxStart(){
};
nginxStop(){
deploy(nginxRestartArg:boolean = false){
plugins.smartfile.fs.remove(paths.nginxZoneBase);
plugins.smartfile.fs.ensureDir(paths.nginxZoneBase);
for(let config of allConfigs){
config.isDeployed = false;
};
this.isDeployed = true;
for(let zone of this.zones){
zone.deploy();
}
if(nginxRestartArg){
command.restart(this);
}
};
};
export class NginxZone {
domain
zoneName:string; // the zone name e.g. domain name
configString:string; // the actual zone config file as string
constructor(optionsArg:{
zoneName:string,
type:ZoneTypes,
destination:string
}){
}
};
deploy(){
let filePath = plugins.path.join(paths.nginxZoneBase,this.zoneName + ".conf");
plugins.smartfile.memory.toFsSync(this.configString,filePath);
};
}
let mynginx = new NginxConfig();

28
ts/smartnginx.command.ts Normal file
View File

@ -0,0 +1,28 @@
import * as plugins from "./smartnginx.plugins";
import {NginxConfig,NginxZone} from "./smartnginx.classes.nginxconfig";
/**
* starts nginx
*/
export let start = (configArg:NginxConfig) => {
};
export let restart = (configArg:NginxConfig) => {
stop();
start(configArg);
}
/**
* stops nginx
*/
export let stop = () => {
};
/**
* checks if nginx is in path
*/
export let check = ():boolean => {
return;
};

5
ts/smartnginx.paths.ts Normal file
View File

@ -0,0 +1,5 @@
import * as plugins from "./smartnginx.plugins"
export let packageBase = plugins.path.join(__dirname,"../");
export let nginxConfigBase = plugins.path.join(packageBase,"nginxconfig/");
export let nginxZoneBase = plugins.path.join(nginxConfigBase,"zones");

View File

@ -1,3 +1,6 @@
import "typings-global";
export import cert = require("cert");
export import path = require("path");
export import q = require("q");
export let shelljs = require("shelljs");
export import smartfile = require("smartfile");