2017-02-19 16:37:54 +00:00
|
|
|
var fs = require('./fs.js');
|
2017-02-18 19:10:01 +00:00
|
|
|
var utils = require('./utils.js');
|
2016-08-21 14:42:42 +00:00
|
|
|
|
|
|
|
var TemplateGenerator = function(templateName) {
|
|
|
|
this.templateName = templateName;
|
|
|
|
};
|
|
|
|
|
|
|
|
TemplateGenerator.prototype.generate = function(destinationFolder, name) {
|
2017-02-18 19:10:01 +00:00
|
|
|
var templatePath = utils.joinPath(__dirname, '/../', this.templateName);
|
2017-01-14 00:17:29 +00:00
|
|
|
console.log('Initializing Embark Template....'.green);
|
2016-08-21 14:42:42 +00:00
|
|
|
|
2017-02-19 03:40:42 +00:00
|
|
|
fs.copySync(templatePath, destinationFolder + name);
|
2017-02-18 21:06:39 +00:00
|
|
|
utils.cd(destinationFolder + name);
|
2017-01-14 00:17:29 +00:00
|
|
|
|
|
|
|
console.log('Installing packages.. this can take a few seconds'.green);
|
2017-02-18 21:06:39 +00:00
|
|
|
utils.runCmd('npm install');
|
2017-01-14 00:17:29 +00:00
|
|
|
console.log('Init complete'.green);
|
|
|
|
console.log('\nApp ready at '.green + destinationFolder + name);
|
|
|
|
|
|
|
|
if (name === 'embark_demo') {
|
|
|
|
console.log('-------------------'.yellow);
|
|
|
|
console.log('next steps:'.green);
|
|
|
|
console.log(('-> cd ' + destinationFolder + name).green);
|
|
|
|
console.log('-> embark blockchain or embark simulator'.green);
|
|
|
|
console.log('open another console in the same directory and run'.green);
|
|
|
|
console.log('-> embark run'.green);
|
|
|
|
console.log('For more info go to http://github.com/iurimatias/embark-framework'.green);
|
|
|
|
}
|
2016-08-21 14:42:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = TemplateGenerator;
|