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

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");