Skip to content

Commit

Permalink
v0.3.0
Browse files Browse the repository at this point in the history
* Added new `===` and `!==` operators #110
* Fix for issue #109
* Updated Readme
    * Updated agenda groups examples for #105
    * Changed class names not to match property names in readme #99
  • Loading branch information
doug-martin committed May 18, 2014
1 parent 29697cb commit 317c821
Show file tree
Hide file tree
Showing 32 changed files with 3,943 additions and 489 deletions.
2 changes: 0 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
language: node_js
node_js:
- 0.6
- 0.8
- 0.10
39 changes: 37 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ module.exports = function (grunt) {
child = require("child_process");
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),

exec: {
removeDocs: "rm -rf docs/* && mkdir -p ./docs/examples/browser && cp -r ./examples/browser/ ./docs/examples/browser && cp ./nools.min.js ./docs/nools.js",
createDocs: 'coddoc -f multi-html -d ./lib --dir ./docs'
},

jshint: {
src: ["./index.js", "lib/**/*.js", "Gruntfile.js"],
options: {
Expand Down Expand Up @@ -46,17 +52,33 @@ module.exports = function (grunt) {
src: ['./browser/nools.js'],
dest: './nools.js'
}
},

benchmark: {
manners: {
files: "./benchmark/manners/benchmark.js"
},
sendMoreMoney: {
files: "./benchmark/sendMoreMoney/benchmark.js"
},
simple: {
files: "./benchmark/simple/benchmark.js"
},
waltzDb: {
files: "./benchmark/waltzDb/benchmark.js"
}
}
});

// Default task.
grunt.registerTask('default', ['jshint', "compile-tests", 'it', 'browserify:nools', 'uglify:min']);
grunt.registerTask('default', ['jshint', "compile-tests", 'it', 'browserify:nools', 'uglify:min', 'exec']);
grunt.loadNpmTasks('grunt-it');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-browserify');
grunt.loadNpmTasks('grunt-exec');

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

function counter(err) {
Expand All @@ -80,7 +102,20 @@ module.exports = function (grunt) {
counter(err);
});
});
});

grunt.registerTask("benchmarks", function () {

});

grunt.registerMultiTask('benchmark', 'execute it unit tests in a spawned process', function () {
var done = this.async();
require(this.data.files).classic(function (err) {
if (err) {
done(false);
} else {
done();
}
});
});
};
31 changes: 16 additions & 15 deletions benchmark/manners/benchmark.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
(function () {
"use strict";
var data = require("./data"),
nools = require("../../index");
"use strict";
var data = require("./data"),
nools = require("../../index");

var flow = nools.compile(__dirname + "/manners.nools");
var guests = data.load(flow).manners64;
var session = flow.getSession.apply(flow, guests);
session.assert(new (flow.getDefined("count"))({value: 1}));
var start = new Date();
session.match().then(function () {
console.log("Duration %dms", new Date() - start);
}, function (err) {
console.log(err.stack);
});
})();
var flow = nools.compile(__dirname + "/manners.nools");
var guests = data.load(flow).manners64;
var session = flow.getSession.apply(flow, guests);
session.assert(new (flow.getDefined("count"))({value: 1}));
var start = new Date();

module.exports = session.match().then(function () {
console.log("Duration %dms", new Date() - start);
session.dispose();
}, function (err) {
session.dispose();
console.log(err.stack);
});
2 changes: 1 addition & 1 deletion benchmark/sendMoreMoney/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var nools = require("../../index"),
var start = new Date(),
session;
console.log("starting");
(session = flow.getSession(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)).match().then(function () {
module.exports = (session = flow.getSession(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)).match().then(function () {
console.log("%dms", +(new Date()) - start);
session.dispose();
});
Expand Down
9 changes: 4 additions & 5 deletions benchmark/simple/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ for (var i = 0; i < COUNT; i++) {
}


var start = new Date().getTime();
var start = new Date();

var execCount = 0;

Expand All @@ -35,13 +35,12 @@ for (var j = 0; j < COUNT; j++) {
}
}

session.match(function (err) {
module.exports = session.match(function (err) {
if (err) {
throw err;
}
var end = new Date().getTime();
var diff = end - start;
console.log("elapsed: " + diff);
console.log("Duration %dms", new Date() - start);
session.dispose();
});


3 changes: 2 additions & 1 deletion benchmark/waltzDb/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ var items = data.load(flow).waltzdb4;
var session = flow.getSession.apply(flow, items);
session.assert(new (flow.getDefined("stage"))({value: "DUPLICATE"}));
var start = new Date();
session.match(function (err) {
module.exports = session.match(function (err) {
if (err) {
console.log(err.stack);
} else {
console.log("Duration %dms", new Date() - start);
}
session.dispose();
});

10 changes: 10 additions & 0 deletions docs/History.html
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@



<h1>0.3.0</h1>
<ul>
<li>Added new <code>===</code> and <code>!==</code> operators <a href="https://github.com/C2FO/nools/issues/110">#110</a></li>
<li>Fix for issue <a href="https://github.com/C2FO/nools/issues/109">#109</a></li>
<li>Updated Readme<ul>
<li>Updated agenda groups examples for <a href="https://github.com/C2FO/nools/issues/105">#105</a></li>
<li>Changed class names not to match property names in readme <a href="https://github.com/C2FO/nools/issues/99">#99</a></li>
</ul>
</li>
</ul>
<h1>0.2.3</h1>
<ul>
<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>
Expand Down
Loading

0 comments on commit 317c821

Please sign in to comment.