mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 23:58:13 +08:00
Task shit
This commit is contained in:
@ -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;
|
||||
Reference in New Issue
Block a user