0.1.1 • Published 9 years ago

yofz v0.1.1

Weekly downloads
4
License
MIT
Repository
github
Last release
9 years ago

Yofz - Yeoman File System Helper

This is a node module which ease the process for a developer to create the directories and templates needed for a Yeoman Generator. This module enables you to create a hierarchical structure of Directories and Templates (Plates).

Installation

npm install --save yofz

Coding

Once installed require it. This will create a new instance of Yofz

var Yofz = require('Yofz')

A Yofz instance will require two things: A root directory and a reference to the Yeoman generator being used. This can either be done when requiring the module:

module.exports = generator.Base.extend( {
  initializing: function() {
    require('Yofz')(rootDir, this)
  }
});

Or by using the .setGenerator(..) and .setRoot(..) methods:

var Yofz = require('Yofz')
Yofz.setGenerator(this)
Yofz.setRoot(rootDir)

Creating Directories

var dir = Yofz.Directory(name[, opts])
No.TypeDescription
1StringThe name of the directory.
2JSONConfiguration.

Inside the Configuration object one can enter the following:

No.NameTypeDescription
1childrenArray or AssetChild or children assets.
2writeBooleanTrue if the template file should be written, false otherwise.

Creating Templates

var index = Yofz.Plate(name[,opts])
No.TypeDescription
1StringThe name of the template.
2JSONConfiguration.

Inside the Configuration object one can enter the following:

No.NameTypeDescription
1contextJSONTemplate context object.
2writeBooleanTrue if the template file should be written, false otherwise.

Appending Files and Directories inside other Directories

var root      = Yofz.Directory('root')
var dist      = Yofz.Directory('dist')
var index     = Yofz.Plate('index.js', { 'context': {'title': 'Yofz'}
                                       , 'write': true
                                       })
dist.contains(index)
root.contains(root)

Build It

Yofz.build()