-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
**BREAKING CHANGE**: the setup task is deprecated in favor of using gulp hooks.
- Loading branch information
Showing
1 changed file
with
4 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |