smartscaf/ts/smartscaf.classes.smartscaf.ts

51 lines
1.1 KiB
TypeScript
Raw Normal View History

2017-04-28 22:44:23 +00:00
import * as plugins from './smartscaf.plugins'
// interfaces
import { Smartfile } from 'smartfile'
export interface ScafTemplateContructorOptions {
name?: string,
description?: string
sourceDir?: string
}
export class ScafTemplate {
name: string
description: string
2017-04-30 21:58:03 +00:00
templateSmartfileArray: Smartfile[]
requiredVariables: string[]
suppliedVariables: any
2017-04-28 22:44:23 +00:00
/**
* read a template from a directory
*/
async readTemplateFromDir (dirArg: string) {
2017-04-30 21:58:03 +00:00
this.templateSmartfileArray = await plugins.smartfile.fs.fileTreeToObject(dirArg, '**/*')
this._findVariablesInTemplate()
2017-04-28 22:44:23 +00:00
}
2017-04-30 21:58:03 +00:00
/**
* supply the variables to render the teplate with
* @param variablesArg
*/
async supplyVariables (variablesArg) {
2017-04-28 22:44:23 +00:00
await this._checkSuppliedVariables(variablesArg)
}
/**
* finds all variables in a Template
*/
private async _findVariablesInTemplate () {
2017-04-30 21:58:03 +00:00
for (let localSmartfile of this.templateSmartfileArray) {
}
2017-04-28 22:44:23 +00:00
}
/**
* checks if supplied Variables satisfy the template
*/
private async _checkSuppliedVariables (variablesArg) {
2017-04-30 21:58:03 +00:00
2017-04-28 22:44:23 +00:00
}
}