'use strict'; var util = require('util'); var path = require('path'); var yeoman = require('yeoman-generator'); var yosay = require('yosay'); var UnsemanticExpressGenerator = yeoman.generators.Base.extend({ initializing: function () { this.pkg = require('../package.json'); this.ascii_art = require('../ascii_art'); }, prompting: function () { var done = this.async(); var prompts = [{ name: 'siteName', message: 'What is the title of this Web site?', default: '' }, { name: 'siteDescription', message: 'What is the description of this Web site?', default: '' }, { type: 'confirm', name: 'vim', message: 'Are you using vim?', default: true }, { name: 'features', message: 'What frameworks will it use?', type: 'checkbox', choices: [{ name: 'jQuery', value: 'jquery', checked: false }, { name: 'Stylus CSS preprocessor', value: 'preprocess', checked: false }, { name: 'AMD via Require.js', value: 'amd', checked: false }] }]; // Have Yeoman greet the user. this.ascii_art(); this.log(yosay( 'Welcome to the prime UnsemanticExpress generator!' )); this.prompt(prompts, function (props) { this.jQuery = props.jQuery; this.vim = props.vim; this.siteName = props.siteName; this.siteDescription = props.siteDescription; done(); }.bind(this)); }, writing: { app: function () { this.dest.mkdir('app'); this.dest.mkdir('app/templates'); this.template('_package.json', 'package.json'); this.template('_bower.json', 'bower.json'); }, projectfiles: function () { this.src.copy('vimproject.config', 'vimproject.config'); this.src.copy('jshintrc', '.jshintrc'); } }, installingExpress: function() { if (this.jQuery){ // var done = this.async(); this.npmInstall(['express'], { 'saveDev': true }); // this.npmInstall(['express'], { 'saveDev': true }, done); } }, installingUnsemantic: function() { if (! this.jQuery){ this.bowerInstall(['unsemantic'], { 'saveDev': true }); } }, end: function () { this.installDependencies(); } }); module.exports = UnsemanticExpressGenerator;