generator-ionicgenerator
Version:
An Ionic app, custom with gulp and sass
129 lines (123 loc) • 3.38 kB
JavaScript
'use strict';
var yeoman = require('yeoman-generator');
var chalk = require('chalk');
var yosay = require('yosay');
module.exports = yeoman.generators.Base.extend({
prompting: function () {
var done = this.async();
// Have Yeoman greet the user.
this.log(yosay(
'Welcome to the splendid ' + chalk.red('generator-ionicgenerator') + '!'
));
var questions = [
{
name: 'name',
message: 'Nombre de la aplicacion (Todo en minuscula y sin espacios ni guiones) utilice el mismo nombre que uso en heroku'
}
];
this.prompt(questions, function (answers) {
this.name = answers.name;
done();
}.bind(this));
},
writing: function () {
this.fs.copy(
this.templatePath('web.js'),
this.destinationPath('web.js')
);
this.fs.copy(
this.templatePath('test.js'),
this.destinationPath('test.js')
);
this.fs.copyTpl(
this.templatePath('shippable.yml'),
this.destinationPath('shippable.yml'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('package.json'),
this.destinationPath('package.json'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('ionic.project'),
this.destinationPath('ionic.project'),
{ name: this.name }
);
this.fs.copy(
this.templatePath('gulpfile.js'),
this.destinationPath('gulpfile.js')
);
this.fs.copyTpl(
this.templatePath('config.xml'),
this.destinationPath('config.xml'),
{ name: this.name }
);
this.fs.copy(
this.templatePath('bower.json'),
this.destinationPath('bower.json')
);
this.fs.copy(
this.templatePath('.jshintrc'),
this.destinationPath('.jshintrc')
);
this.fs.copy(
this.templatePath('.jscsrc'),
this.destinationPath('.jscsrc')
);
this.fs.copy(
this.templatePath('gitignore'),
this.destinationPath('.gitignore')
);
this.fs.copy(
this.templatePath('.editorconfig'),
this.destinationPath('.editorconfig')
);
this.fs.copy(
this.templatePath('.buildpacks'),
this.destinationPath('.buildpacks')
);
this.fs.copy(
this.templatePath('.bowerrc'),
this.destinationPath('.bowerrc')
);
this.fs.copy(
this.templatePath('hooks'),
this.destinationPath('hooks')
);
this.fs.copy(
this.templatePath('plugins'),
this.destinationPath('plugins')
);
this.fs.copy(
this.templatePath('scss'),
this.destinationPath('scss')
);
this.fs.copy(
this.templatePath('www'),
this.destinationPath('www')
);
this.fs.copyTpl(
this.templatePath('www/index.html'),
this.destinationPath('www/index.html'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('www/home/home.tpl.html'),
this.destinationPath('www/home/home.tpl.html'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('www/js/controllers.js'),
this.destinationPath('www/js/controllers.js'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('www/js/app.js'),
this.destinationPath('www/js/app.js'),
{ name: this.name }
);
},
install: function () {
}
});