Exemple #1
0
	    views.forEach(function(view){
		    var path = './node_modules/module-generator/boilerplates/view.template';
			var tpl = replacer(path);
			if (view.length > 1) {
				fs.createFileSync(destination + '/views/' + view + '.html', tpl);
			}
	    });
Exemple #2
0
	function render(type, resource) {
		//push scriptLinksPath to files array if it's not a test
	    var path = './node_modules/module-generator/boilerplates/' + type + '.template';
	    var scriptLinksPath;
		var tpl = replacer(path);

	    if (type === 'register') {
	    	// to do: this needs to be rendered conditionally
	    	fs.createFileSync(destination + '/' + resource + '.js', tpl);
	    	mainScript = scriptLinks + '/' + resource + '.js';
	    } else if (type === 'view') {
	    	fs.createFileSync(destination + '/views/' + resource + '.html', tpl);
	    } else if (type === 'stylesheet') {
	    	styleLinksPath = resources + '.scss';
	    	fs.createFileSync('app/styles/' + resource + '.scss', tpl);
	    } else {
	    	testPath = './node_modules/module-generator/boilerplates/' + type + 'test.template';
			testTpl = replacer(testPath);
			scriptLinksPath = scriptLinks + '/' + pluralize(type) + '/' + resource + '.js';
	    	fs.createFileSync(destination + '/' + pluralize(type) + '/' + resource + '.js', tpl);
	    	fs.createFileSync(destination + '/test/' + pluralize(type) + '/' + resource + '.js', testTpl);
	    	files.push(scriptLinksPath);
	    }
	}
Exemple #3
0
exports.toFile = function(doc, path) {
	return fs.createFileSync(path, exports.toString(doc));
};