gulpjs / undertaker

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

Add a task uniq id as an event attribute #19

Closed dinoboff closed 9 years ago

dinoboff commented 9 years ago

Currently, events come with a uid attribute (to match a "start" event to a "stop"/"error" event) and the name (a provided string or the function name). The task name is not necessary unique.

Is it possible to add task id attribute unique to each task?

phated commented 9 years ago

@dinoboff I am :+1: for this, how would you handle it? Just generate a uid inside undertaker.set?

dinoboff commented 9 years ago

@phated it wouldn't cover private task used by series and parallel.

What about in buildTree?

dinoboff commented 9 years ago

something like.

    meta = {
      name: name,
      uid: uid++,
      tree: {
        label: name,
        type: 'function',
        nodes: []
      }
    };

    metadata.set(task, meta);
    return meta.tree;

Would it cover all cases?

ps: series and parallel function would also need it

dinoboff commented 9 years ago

the extension helper can handle it :)

phated commented 9 years ago

I believe this is wrapped up as of https://github.com/phated/undertaker/commit/1810ec7e68b0c5ed34b0030a198cae0741dfd716