Skip to content

Commit

Permalink
feat(setup): deprecate setup task
Browse files Browse the repository at this point in the history
**BREAKING CHANGE**: the setup task is deprecated in favor of using gulp
hooks.
  • Loading branch information
tlancina committed Mar 28, 2016
1 parent 5fe8ffb commit a48e7b9
Showing 1 changed file with 4 additions and 63 deletions.
67 changes: 4 additions & 63 deletions lib/ionic/setup.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,12 @@
var Task = require('./task').Task,
fs = require('fs'),
path = require('path'),
argv = require('optimist').argv,
exec = require('child_process').exec,
Q = require('q'),
IonicProject = require('./project'),
IonicAppLib = require('ionic-app-lib'),
Setup = IonicAppLib.setup,
Utils = IonicAppLib.utils,
colors = require('colors');
var Task = require('./task').Task;

var IonicTask = function() {};

IonicTask.prototype = new Task();

IonicTask.prototype.run = function(ionic) {
if( argv._.length < 2 ) {
return ionic.fail('Missing setup task command.', 'setup');
}

var self = this;
var tasks = argv._.slice(1);
var promises = [];

var promise = Q();

for (var x = 0; x < tasks.length; x++) {
try {
(function() {
//create closure for task
var task = self.runSetupTask(tasks[x]);
// console.log('Task: ', task);
promises.push(task);
})();
} catch (ex) {

}
}

promises.forEach(function(task) {
// console.log('Task foreach:', task);
promise = promise.then(function(){ return task(process.cwd()); });
});

promise
.fin(function() {
console.log('Ionic setup complete'.green.bold);
})
.catch(function(error) {
console.log('Error from setup - ' + error);
});

};

IonicTask.prototype.runSetupTask = function runSetupTask(setupTask) {
switch (setupTask) {
case 'sass':
return Setup.sassSetup;
break;
case 'facebook':
return Setup.setupFacebook;
break;
default:
var errorMessage = 'Invalid setup task command: ' + setupTask;
console.log(errorMessage);
return Q(errorMessage);
}
IonicTask.prototype.run = function() {
//TODO link to gulp hook docs
console.log('The setup task has been deprecated.\n');
};

exports.IonicTask = IonicTask;

0 comments on commit a48e7b9

Please sign in to comment.