react 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -4
- package/doc/simple.dot +25 -0
- package/doc/simple.png +0 -0
- package/lib/event-manager.js +3 -0
- package/lib/track-tasks.js +1 -1
- package/package.json +1 -1
- package/test/ast.test.js +23 -0
- package/doc/default-simple.dot +0 -19
- package/doc/default-simple.dot.png +0 -0
package/README.md
CHANGED
|
@@ -128,9 +128,11 @@ foobar.loadRender('foo.txt', 'bar.txt', 'BBB', function (err, renderedOut) {
|
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
Below is a graph of how the dependencies are mapped by React which
|
|
131
|
-
also indicates how the tasks will be executed
|
|
131
|
+
also indicates how the tasks will be executed. This was generated by the
|
|
132
|
+
react plugin [react-graphviz](https://github.com/jeffbski/react-graphviz)
|
|
133
|
+
which you can use to also graph your flows.
|
|
132
134
|
|
|
133
|
-

|
|
134
136
|
|
|
135
137
|
|
|
136
138
|
|
|
@@ -182,6 +184,7 @@ See the [Advanced React](https://github.com/jeffbski/react/blob/master/doc/advan
|
|
|
182
184
|
|
|
183
185
|
## Status
|
|
184
186
|
|
|
187
|
+
- 2012-03-12 - Pass ast.define events to process (v0.5.2)
|
|
185
188
|
- 2012-01-18 - Remove old DSL interfaces, improve plugin loading, log flow name with task name, ast.defined event, test with node 0.7.0 (v0.5.1)
|
|
186
189
|
- 2012-01-17 - Additional documentation (v0.3.5)
|
|
187
190
|
- 2012-01-16 - Refine events and create logging plugin (v0.3.3)
|
|
@@ -194,7 +197,7 @@ See the [Advanced React](https://github.com/jeffbski/react/blob/master/doc/advan
|
|
|
194
197
|
## Test Results
|
|
195
198
|
|
|
196
199
|
```bash
|
|
197
|
-
ok ast.test.js ....................
|
|
200
|
+
ok ast.test.js .................... 20/20
|
|
198
201
|
ok cb-task.test.js ................ 31/31
|
|
199
202
|
ok core-deferred.test.js .......... 11/11
|
|
200
203
|
ok core-promised.test.js .......... 11/11
|
|
@@ -213,7 +216,7 @@ ok validate-cb-task.test.js ......... 6/6
|
|
|
213
216
|
ok validate-ret-task.test.js ........ 7/7
|
|
214
217
|
ok validate.test.js ............... 31/31
|
|
215
218
|
ok vcon.test.js ................... 55/55
|
|
216
|
-
total ...........................
|
|
219
|
+
total ........................... 471/471
|
|
217
220
|
|
|
218
221
|
ok
|
|
219
222
|
```
|
package/doc/simple.dot
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
digraph loadRender {
|
|
2
|
+
loadRender_input [ shape = box, style = filled, fillcolor = aquamarine ];
|
|
3
|
+
fooPath [ style = filled, fillcolor = gainsboro ];
|
|
4
|
+
barPath [ style = filled, fillcolor = gainsboro ];
|
|
5
|
+
barP2 [ style = filled, fillcolor = gainsboro ];
|
|
6
|
+
loadFoo [ shape = box, color = blue, fillcolor = beige, style = filled ];
|
|
7
|
+
foo [ style = filled, fillcolor = gainsboro ];
|
|
8
|
+
loadBar [ shape = box, color = blue, fillcolor = beige, style = filled ];
|
|
9
|
+
bar [ style = filled, fillcolor = gainsboro ];
|
|
10
|
+
render [ shape = box, color = blue, fillcolor = beige, style = filled ];
|
|
11
|
+
renderedOut [ style = filled, fillcolor = gainsboro ];
|
|
12
|
+
loadRender_output [ shape = box, style = filled, fillcolor = aquamarine ];
|
|
13
|
+
loadRender_input -> fooPath;
|
|
14
|
+
loadRender_input -> barPath;
|
|
15
|
+
loadRender_input -> barP2;
|
|
16
|
+
fooPath -> loadFoo;
|
|
17
|
+
loadFoo -> foo;
|
|
18
|
+
barPath -> loadBar;
|
|
19
|
+
barP2 -> loadBar;
|
|
20
|
+
loadBar -> bar;
|
|
21
|
+
foo -> render;
|
|
22
|
+
bar -> render;
|
|
23
|
+
render -> renderedOut;
|
|
24
|
+
renderedOut -> loadRender_output;
|
|
25
|
+
}
|
package/doc/simple.png
ADDED
|
Binary file
|
package/lib/event-manager.js
CHANGED
|
@@ -8,6 +8,8 @@ var EVENT_EMITTER2_CONFIG = {
|
|
|
8
8
|
maxListeners: 30 // the max number of listeners that can be assigned to an event, defaults to 10.
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
+
var PASS_EVENTS_PROCESS_RE = /^ast.defined$/; // events to pass up to global process
|
|
12
|
+
|
|
11
13
|
var TYPES = {
|
|
12
14
|
// Flow monitoring events and their params
|
|
13
15
|
AST_DEFINED: 'ast.defined', // ast
|
|
@@ -61,6 +63,7 @@ EventManager.prototype.emit = function (event, arg1, arg2, argN) {
|
|
|
61
63
|
if (event === undefined) throw new Error('event is undefined');
|
|
62
64
|
if (this.emitter) this.emitter.emit.apply(this.emitter, arguments);
|
|
63
65
|
if (this.parent && this.parent.isEnabled()) this.parent.emit.apply(this.parent, arguments);
|
|
66
|
+
if (PASS_EVENTS_PROCESS_RE.test(event) && process) process.emit.apply(process, arguments); // pass some to process
|
|
64
67
|
};
|
|
65
68
|
|
|
66
69
|
EventManager.prototype.removeListener = function (event, listener) {
|
package/lib/track-tasks.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
var react = require('../'); // require('react');
|
|
24
24
|
|
|
25
|
-
react.events.on(react.events.TYPES.EXEC_FLOW_START, function (env){
|
|
25
|
+
react.events.on(react.events.TYPES.EXEC_FLOW_START, function (env) {
|
|
26
26
|
env.startTime = Date.now();
|
|
27
27
|
env.flowEmitter.emit(react.events.TYPES.FLOW_BEGIN, env); //fire public ev
|
|
28
28
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react",
|
|
3
3
|
"description": "React is a javascript module implementing a lightweight rules engine to make it easier to work with asynchronous code, by reducing boilerplate code and improving error and exception handling while allowing variable and task dependencies when defining flow.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.2",
|
|
5
5
|
"author": "Jeff Barczewski <jeff.barczewski@gmail.com>",
|
|
6
6
|
"repository": { "type": "git", "url": "http://github.com/jeffbski/react.git" },
|
|
7
7
|
"bugs" : { "url": "http://github.com/jeffbski/react/issues" },
|
package/test/ast.test.js
CHANGED
|
@@ -64,6 +64,29 @@ test('ast.defined event called when ast is defined', function (t) {
|
|
|
64
64
|
t.end();
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
+
test('ast.defined event is passed to process', function (t) {
|
|
68
|
+
t.plan(5);
|
|
69
|
+
var fn = react();
|
|
70
|
+
process.once('ast.defined', function (ast) {
|
|
71
|
+
t.type(ast, 'object');
|
|
72
|
+
t.ok(ast.inParams);
|
|
73
|
+
t.ok(ast.tasks);
|
|
74
|
+
t.ok(ast.outTask);
|
|
75
|
+
t.deepEqual(ast.inParams, ['res', 'prefstr', 'poststr']);
|
|
76
|
+
t.end();
|
|
77
|
+
});
|
|
78
|
+
var errors = fn.setAndValidateAST({
|
|
79
|
+
inParams: ['res', 'prefstr', 'poststr'],
|
|
80
|
+
tasks: [
|
|
81
|
+
{ f: load, a: ['res'], out: ['lres'] },
|
|
82
|
+
{ f: upper, a: ['lres'], out: ['ulres'], type: 'ret' },
|
|
83
|
+
{ f: prefix, a: ['prefstr', 'ulres'], out: ['plres'] },
|
|
84
|
+
{ f: postfix, a: ['plres', 'poststr'], out: ['plresp'] }
|
|
85
|
+
],
|
|
86
|
+
outTask: { a: ['plresp'] }
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
|
|
67
90
|
test('cb with err', function (t) {
|
|
68
91
|
t.plan(5);
|
|
69
92
|
|
package/doc/default-simple.dot
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
digraph simple {
|
|
2
|
-
inputs [shape=box];
|
|
3
|
-
loadFoo [shape=box];
|
|
4
|
-
loadBar [shape=box];
|
|
5
|
-
render [shape=box];
|
|
6
|
-
outputs[shape=box];
|
|
7
|
-
inputs -> fooPath;
|
|
8
|
-
inputs -> barPath;
|
|
9
|
-
inputs -> barP2;
|
|
10
|
-
fooPath -> loadFoo;
|
|
11
|
-
loadFoo -> foo;
|
|
12
|
-
barPath -> loadBar;
|
|
13
|
-
loadBar -> bar;
|
|
14
|
-
barP2 -> loadBar;
|
|
15
|
-
foo -> render;
|
|
16
|
-
bar -> render;
|
|
17
|
-
render -> renderedOut;
|
|
18
|
-
renderedOut -> outputs;
|
|
19
|
-
}
|
|
Binary file
|