diff options
Diffstat (limited to 'app/index.js')
| -rw-r--r-- | app/index.js | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/app/index.js b/app/index.js new file mode 100644 index 0000000..d9074fe --- /dev/null +++ b/app/index.js @@ -0,0 +1,93 @@ +'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; |
