Permalink
Browse files

v0.1.11

* Fixed issue #73 where requires in dsl would treat a file with a `.` character as a path instead of a module.
  • Loading branch information...
1 parent 49e352d commit 0e7a0f33d56fb8213577951819523451cfb1dc37 @doug-martin doug-martin committed Sep 4, 2013
Showing with 21 additions and 8 deletions.
  1. +4 −0 docs/History.html
  2. +2 −2 docs/nools.js
  3. +3 −0 history.md
  4. +1 −1 lib/parser/nools/util.js
  5. +1 −1 nools.js
  6. +2 −2 nools.min.js
  7. +1 −1 package.json
  8. +7 −1 test/noolsParser.test.js
View
@@ -178,6 +178,10 @@
+<h1>0.1.11</h1>
+<ul>
+<li>Fixed issue <a href="https://github.com/C2FO/nools/issues/73">#73</a> where requires in dsl would treat a file with a <code>.</code> character as a path instead of a module.</li>
+</ul>
<h1>0.1.10</h1>
<ul>
<li>Added ability to <code>import</code> other nools files to create composible rules files <a href="https://github.com/C2FO/nools/issues/58">#58</a></li>
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,3 +1,6 @@
+# 0.1.11
+* Fixed issue [#73](https://github.com/C2FO/nools/issues/73) where requires in dsl would treat a file with a `.` character as a path instead of a module.
+
# 0.1.10
* Added ability to `import` other nools files to create composible rules files [#58](https://github.com/C2FO/nools/issues/58)
View
@@ -61,7 +61,7 @@ exports.resolve = function (from, to) {
if (path.extname(from) !== '') {
from = path.dirname(from);
}
- if (to.replace(/[\/|\/|\.]/, "") === to) {
+ if (to.split(path.sep).length === 1) {
return to;
}
return path.resolve(from, to);
View
@@ -3958,7 +3958,7 @@ exports.resolve = function (from, to) {
if (path.extname(from) !== '') {
from = path.dirname(from);
}
- if (to.replace(/[\/|\/|\.]/, "") === to) {
+ if (to.split(path.sep).length === 1) {
return to;
}
return path.resolve(from, to);
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,7 +1,7 @@
{
"name": "nools",
"description": "A rules engine for node",
- "version": "0.1.10",
+ "version": "0.1.11",
"bin": {
"nools": "./bin/nools"
},
View
@@ -68,12 +68,18 @@ it.describe("nools dsl parser", function (it) {
it.describe("global", function (it) {
- it.should("parse a function call statement", function () {
+ it.should("parse a require call statement", function () {
var parsed = noolsParser.parse("global util = require('util');");
assert.equal(parsed.scope[0].name, 'util');
assert.equal(parsed.scope[0].body, "require('util')");
});
+ it.should("parse a require with a '.' character that is not a relative path", function () {
+ var parsed = noolsParser.parse("global util = require('socket.io');");
+ assert.equal(parsed.scope[0].name, 'util');
+ assert.equal(parsed.scope[0].body, "require('socket.io')");
+ });
+
it.should("resolve relative require paths", function () {
var parsed = noolsParser.parse("global util = require('../util');", "./rules/test.nools");
assert.equal(parsed.scope[0].name, 'util');

0 comments on commit 0e7a0f3

Please sign in to comment.