Task shit

This commit is contained in:
Max Lynch
2013-09-08 22:09:57 -05:00
parent 6ae11762f0
commit 46f4da7118
2 changed files with 44 additions and 45 deletions

View File

@ -3,11 +3,39 @@ var fs = require('fs'),
path = require('path'),
IonicTask = require('./task').IonicTask;
var argv = require('optimist').argv;
var IonicStartTask = function() {
}
IonicStartTask.prototype = new IonicTask();
IonicStartTask.prototype.run = function(ionic) {
IonicStartTask.HELP_LINE = 'Start a new Ionic project with the given name.';
IonicStartTask.prototype = new IonicTask();
IonicStartTask.prototype.run = function(ionic) {
this.appName = argv._[0];
this.targetPath = path.resolve(this.appName);
// Make sure to create this, or ask them if they want to override it
if(this._checkTargetPath() === false) {
process.stderr.write('Not continuing.');
process.exit(1);
}
console.log('Creating Ionic app in folder', this.targetPath);
this._writeTemplateFolder();
};
IonicStartTask.prototype._writeTemplateFolder = function() {
console.log('Copying template to', this.targetPath);
ncp('template', this.appName, function(err) {
if(err) {
this._fail('Unable to build starter folder', err);
}
});
};
exports.IonicStartTask = IonicStartTask;