generator-yeosimian
Version:
A wordpress site, custom with vagrant and openshift
222 lines (216 loc) • 6.71 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-yeosimian') + ' generator!'
));
var questions = [
{
name: 'name',
message: 'Nombre para la base de datos y sitio de pruebas (Todo en minuscula y sin espacios ni guiones)'
},
{
name: 'theme',
message: 'Nombre para el tema (Todo en minuscula y sin espacios, use guiones_bajos)'
},
{
name: 'ship',
message: 'Source Code de Openshift (ssh://....@....rhcloud.com/.git/)'
},
{
name: 'openshiftdb',
message: 'Nombre de la base de datos en Openshift'
},
{
name: 'openshiftuser',
message: 'Usuario de la base de datos en Openshift'
},
{
name: 'openshiftpass',
message: 'Contraseña de la base de datos en Openshift'
}
];
this.prompt(questions, function (answers) {
this.name = answers.name;
this.theme = answers.theme;
this.ship = answers.ship;
this.openshiftdb = answers.openshiftdb;
this.openshiftuser = answers.openshiftuser;
this.openshiftpass = answers.openshiftpass;
done();
}.bind(this));
},
writing: function () {
this.fs.copy(
this.templatePath('gitignore'),
this.destinationPath('.gitignore')
);
this.fs.copy(
this.templatePath('UnitTest.php'),
this.destinationPath('UnitTest.php')
);
this.fs.copy(
this.templatePath('Vagrantfile'),
this.destinationPath('Vagrantfile')
);
this.fs.copy(
this.templatePath('index.php'),
this.destinationPath('index.php')
);
this.fs.copy(
this.templatePath('licencia.txt'),
this.destinationPath('licencia.txt')
);
this.fs.copy(
this.templatePath('license.txt'),
this.destinationPath('license.txt')
);
this.fs.copy(
this.templatePath('readme.html'),
this.destinationPath('readme.html')
);
this.fs.copyTpl(
this.templatePath('shippable.yml'),
this.destinationPath('shippable.yml'),
{ ship: this.ship }
);
this.fs.copyTpl(
this.templatePath('vagrant.sh'),
this.destinationPath('vagrant.sh'),
{ name: this.name }
);
this.fs.copy(
this.templatePath('wp-activate.php'),
this.destinationPath('wp-activate.php')
);
this.fs.copy(
this.templatePath('wp-blog-header.php'),
this.destinationPath('wp-blog-header.php')
);
this.fs.copy(
this.templatePath('wp-comments-post.php'),
this.destinationPath('wp-comments-post.php')
);
this.fs.copy(
this.templatePath('wp-config-sample.php'),
this.destinationPath('wp-config-sample.php')
);
this.fs.copy(
this.templatePath('wp-cron.php'),
this.destinationPath('wp-cron.php')
);
this.fs.copy(
this.templatePath('wp-links-opml.php'),
this.destinationPath('wp-links-opml.php')
);
this.fs.copy(
this.templatePath('wp-load.php'),
this.destinationPath('wp-load.php')
);
this.fs.copy(
this.templatePath('wp-login.php'),
this.destinationPath('wp-login.php')
);
this.fs.copy(
this.templatePath('wp-mail.php'),
this.destinationPath('wp-mail.php')
);
this.fs.copy(
this.templatePath('wp-settings.php'),
this.destinationPath('wp-settings.php')
);
this.fs.copy(
this.templatePath('wp-signup.php'),
this.destinationPath('wp-signup.php')
);
this.fs.copy(
this.templatePath('wp-trackback.php'),
this.destinationPath('wp-trackback.php')
);
this.fs.copy(
this.templatePath('xmlrpc.php'),
this.destinationPath('xmlrpc.php')
);
this.fs.copy(
this.templatePath('.openshift'),
this.destinationPath('.openshift')
);
this.fs.copy(
this.templatePath('stack'),
this.destinationPath('stack')
);
this.fs.copyTpl(
this.templatePath('stack/local-virtualhost.conf'),
this.destinationPath('stack/local-virtualhost.conf'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('stack/openshift-config.php'),
this.destinationPath('stack/openshift-config.php'),
{ openshiftdb: this.openshiftdb,openshiftuser: this.openshiftuser,openshiftpass: this.openshiftpass }
);
this.fs.copyTpl(
this.templatePath('stack/local-config.php'),
this.destinationPath('stack/local-config.php'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('stack/local-db.sql'),
this.destinationPath('stack/local-db.sql'),
{ name: this.name }
);
this.fs.copy(
this.templatePath('wp-admin'),
this.destinationPath('wp-admin')
);
this.fs.copy(
this.templatePath('wp-content'),
this.destinationPath('wp-content')
);
this.fs.copy(
this.templatePath('custom-simian-theme'),
this.destinationPath('wp-content/themes/'+this.theme)
);
this.fs.copyTpl(
this.templatePath('custom-simian-theme/Gulpfile.js'),
this.destinationPath('wp-content/themes/'+this.theme+'/Gulpfile.js'),
{ name: this.name }
);
this.fs.copyTpl(
this.templatePath('custom-simian-theme/style.css'),
this.destinationPath('wp-content/themes/'+this.theme+'/style.css'),
{ theme: this.theme }
);
this.fs.copyTpl(
this.templatePath('custom-simian-theme/package.json'),
this.destinationPath('wp-content/themes/'+this.theme+'/package.json'),
{ theme: this.theme }
);
this.fs.copyTpl(
this.templatePath('custom-simian-theme/index.php'),
this.destinationPath('wp-content/themes/'+this.theme+'/index.php'),
{ theme: this.theme }
);
this.fs.copyTpl(
this.templatePath('custom-simian-theme/functions.php'),
this.destinationPath('wp-content/themes/'+this.theme+'/functions.php'),
{ theme: this.theme }
);
this.fs.copyTpl(
this.templatePath('custom-simian-theme/footer.php'),
this.destinationPath('wp-content/themes/'+this.theme+'/footer.php'),
{ theme: this.theme }
);
this.fs.copy(
this.templatePath('wp-includes'),
this.destinationPath('wp-includes')
);
},
install: function () {
}
});