Skip to content

Commit 61d427f

Browse files
committed
Merge pull request #114 from doug-martin/master
v0.3.0
2 parents 29697cb + 317c821 commit 61d427f

32 files changed

+3943
-489
lines changed

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
language: node_js
22
node_js:
3-
- 0.6
4-
- 0.8
53
- 0.10

Gruntfile.js

+37-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ module.exports = function (grunt) {
55
child = require("child_process");
66
grunt.initConfig({
77
pkg: grunt.file.readJSON('package.json'),
8+
9+
exec: {
10+
removeDocs: "rm -rf docs/* && mkdir -p ./docs/examples/browser && cp -r ./examples/browser/ ./docs/examples/browser && cp ./nools.min.js ./docs/nools.js",
11+
createDocs: 'coddoc -f multi-html -d ./lib --dir ./docs'
12+
},
13+
814
jshint: {
915
src: ["./index.js", "lib/**/*.js", "Gruntfile.js"],
1016
options: {
@@ -46,17 +52,33 @@ module.exports = function (grunt) {
4652
src: ['./browser/nools.js'],
4753
dest: './nools.js'
4854
}
55+
},
56+
57+
benchmark: {
58+
manners: {
59+
files: "./benchmark/manners/benchmark.js"
60+
},
61+
sendMoreMoney: {
62+
files: "./benchmark/sendMoreMoney/benchmark.js"
63+
},
64+
simple: {
65+
files: "./benchmark/simple/benchmark.js"
66+
},
67+
waltzDb: {
68+
files: "./benchmark/waltzDb/benchmark.js"
69+
}
4970
}
5071
});
5172

5273
// Default task.
53-
grunt.registerTask('default', ['jshint', "compile-tests", 'it', 'browserify:nools', 'uglify:min']);
74+
grunt.registerTask('default', ['jshint', "compile-tests", 'it', 'browserify:nools', 'uglify:min', 'exec']);
5475
grunt.loadNpmTasks('grunt-it');
5576
grunt.loadNpmTasks('grunt-contrib-jshint');
5677
grunt.loadNpmTasks('grunt-contrib-uglify');
5778
grunt.loadNpmTasks('grunt-browserify');
79+
grunt.loadNpmTasks('grunt-exec');
5880

59-
grunt.registerTask("compile-tests", "compiles all lest files", function () {
81+
grunt.registerTask("compile-tests", "compiles all nools files", function () {
6082
var files = grunt.file.expand("./test/rules/*.nools"), count = files.length, done = this.async();
6183

6284
function counter(err) {
@@ -80,7 +102,20 @@ module.exports = function (grunt) {
80102
counter(err);
81103
});
82104
});
105+
});
83106

107+
grunt.registerTask("benchmarks", function () {
108+
109+
});
84110

111+
grunt.registerMultiTask('benchmark', 'execute it unit tests in a spawned process', function () {
112+
var done = this.async();
113+
require(this.data.files).classic(function (err) {
114+
if (err) {
115+
done(false);
116+
} else {
117+
done();
118+
}
119+
});
85120
});
86121
};

benchmark/manners/benchmark.js

+16-15
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
(function () {
2-
"use strict";
3-
var data = require("./data"),
4-
nools = require("../../index");
1+
"use strict";
2+
var data = require("./data"),
3+
nools = require("../../index");
54

6-
var flow = nools.compile(__dirname + "/manners.nools");
7-
var guests = data.load(flow).manners64;
8-
var session = flow.getSession.apply(flow, guests);
9-
session.assert(new (flow.getDefined("count"))({value: 1}));
10-
var start = new Date();
11-
session.match().then(function () {
12-
console.log("Duration %dms", new Date() - start);
13-
}, function (err) {
14-
console.log(err.stack);
15-
});
16-
})();
5+
var flow = nools.compile(__dirname + "/manners.nools");
6+
var guests = data.load(flow).manners64;
7+
var session = flow.getSession.apply(flow, guests);
8+
session.assert(new (flow.getDefined("count"))({value: 1}));
9+
var start = new Date();
10+
11+
module.exports = session.match().then(function () {
12+
console.log("Duration %dms", new Date() - start);
13+
session.dispose();
14+
}, function (err) {
15+
session.dispose();
16+
console.log(err.stack);
17+
});

benchmark/sendMoreMoney/benchmark.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var nools = require("../../index"),
66
var start = new Date(),
77
session;
88
console.log("starting");
9-
(session = flow.getSession(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)).match().then(function () {
9+
module.exports = (session = flow.getSession(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)).match().then(function () {
1010
console.log("%dms", +(new Date()) - start);
1111
session.dispose();
1212
});

benchmark/simple/benchmark.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ for (var i = 0; i < COUNT; i++) {
1111
}
1212

1313

14-
var start = new Date().getTime();
14+
var start = new Date();
1515

1616
var execCount = 0;
1717

@@ -35,13 +35,12 @@ for (var j = 0; j < COUNT; j++) {
3535
}
3636
}
3737

38-
session.match(function (err) {
38+
module.exports = session.match(function (err) {
3939
if (err) {
4040
throw err;
4141
}
42-
var end = new Date().getTime();
43-
var diff = end - start;
44-
console.log("elapsed: " + diff);
42+
console.log("Duration %dms", new Date() - start);
43+
session.dispose();
4544
});
4645

4746

benchmark/waltzDb/benchmark.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ var items = data.load(flow).waltzdb4;
88
var session = flow.getSession.apply(flow, items);
99
session.assert(new (flow.getDefined("stage"))({value: "DUPLICATE"}));
1010
var start = new Date();
11-
session.match(function (err) {
11+
module.exports = session.match(function (err) {
1212
if (err) {
1313
console.log(err.stack);
1414
} else {
1515
console.log("Duration %dms", new Date() - start);
1616
}
17+
session.dispose();
1718
});
1819

docs/History.html

+10
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,16 @@
178178

179179

180180

181+
<h1>0.3.0</h1>
182+
<ul>
183+
<li>Added new <code>===</code> and <code>!==</code> operators <a href="https://github.com/C2FO/nools/issues/110">#110</a></li>
184+
<li>Fix for issue <a href="https://github.com/C2FO/nools/issues/109">#109</a></li>
185+
<li>Updated Readme<ul>
186+
<li>Updated agenda groups examples for <a href="https://github.com/C2FO/nools/issues/105">#105</a></li>
187+
<li>Changed class names not to match property names in readme <a href="https://github.com/C2FO/nools/issues/99">#99</a></li>
188+
</ul>
189+
</li>
190+
</ul>
181191
<h1>0.2.3</h1>
182192
<ul>
183193
<li>Added new <code>getFacts</code> method to allow for querying of facts currently in session. <a href="https://github.com/C2FO/nools/issues/52">#52</a>;</li>

0 commit comments

Comments
 (0)