Ionic tool - write template folder correctly.

This commit is contained in:
Max Lynch
2013-09-08 18:34:11 -05:00
parent 99dd52b69b
commit f9ea86ce63
2 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
var fs = require('fs'), var fs = require('fs'),
ncp = require('ncp').ncp,
path = require('path'), path = require('path'),
wrench = require('wrench'),
argv = require('optimist') argv = require('optimist')
.usage('Usage: ionic appname') .usage('Usage: ionic appname')
.argv; .argv;
@ -21,9 +21,17 @@ Ionic.prototype = {
process.exit(1); process.exit(1);
}, },
_fail: function(msg) {
process.stderr.write(msg + '\n');
process.exit(1);
},
_writeTemplateFolder: function() { _writeTemplateFolder: function() {
wrench.copyDirRecursive('template', this.appName, function(err, curFiles) { console.log('Copying template to', this.targetPath);
console.log(curFiles); ncp('template', this.appName, function(err) {
if(err) {
this._fail('Unable to build starter folder', err);
}
}); });
}, },