gulpjs / undertaker

Task registry that allows composition through series/parallel methods.
MIT License
200 stars 31 forks source link

How run a task programmatically ? #61

Closed zckrs closed 8 years ago

zckrs commented 8 years ago

Hi @phated,

I think I missed or misunderstood something.

But how can I start a task defined by Undertaker without Gulp?

Example:

var Undertaker = require('undertaker');

var taker = new Undertaker();

taker.task('awesome', function(cb) {
  console.log('awesome');
  cb();
});

taker.task('raccoon', function(cb) {
  console.log('raccoon');
  cb();
});

taker.task('default', taker.series('awesome', 'raccoon'));

I would run default task by something like taker.run('default') or taker.start('default').

zckrs commented 8 years ago

I found one solution.

series and parallel returns function. So I just need to run function taker.series('default')();

Can you confirm ?

TrySound commented 8 years ago

@zckrs Yes.

tunnckoCore commented 8 years ago

@zckrs yes and pass callback function to handle errors.

zckrs commented 8 years ago

Ok thank you :-)