Skip to content

fixes for two api changes #1

Merged
merged 3 commits into from Jan 25, 2012
View
2 Cakefile
@@ -11,7 +11,7 @@ task 'test', ['spec/*','src/*'], (options) ->
args.push '--spec'
tests = _(this.modifiedPrereqs).filter (prereq) -> prereq.match /^spec/
src = _(this.modifiedPrereqs).filter (prereq) -> prereq.match /^src/
- command = "vows #{args.join ' '} #{tests.join(' ')}"
+ command = "./node_modules/vows/bin/vows #{args.join ' '} #{tests.join(' ')}"
this.exec [
command
]
View
8 lib/rules.js
@@ -11,7 +11,7 @@
_ref = require('./dag'), Graph = _ref.Graph, Node = _ref.Node, Arc = _ref.Arc, NodeList = _ref.NodeList;
_ = require('underscore');
assert = require('assert');
- globSync = require('glob').globSync;
+ globSync = require('glob').sync;
fs = require('fs');
RuleGraph = (function() {
function RuleGraph() {
@@ -40,7 +40,7 @@
if (globbed.length > 0) {
return globbed;
} else {
- return void 0;
+ return;
}
} else {
return prereq;
@@ -114,11 +114,11 @@
return Recipe;
})();
RecipeNode = (function() {
- __extends(RecipeNode, Node);
function RecipeNode(name, recipe) {
this.name = name;
this.recipe = recipe;
}
+ __extends(RecipeNode, Node);
RecipeNode.prototype.equals = function(node) {
return RecipeNode.__super__.equals.call(this, node) && node instanceof RecipeNode;
};
@@ -187,11 +187,11 @@
return RecipeNode;
})();
FileNode = (function() {
- __extends(FileNode, Node);
function FileNode(name) {
this.name = name;
this.refresh();
}
+ __extends(FileNode, Node);
FileNode.prototype.equals = function(node) {
return FileNode.__super__.equals.call(this, node) && node instanceof FileNode;
};
View
10 spec/dag.vows.coffee
@@ -33,13 +33,13 @@ testGraph = (options) ->
focus.topic = graphFromMap options.graph
focus["has #{options.nodes.length} nodes: [#{options.nodes.join(',')}]"] = (graph) ->
- assert.length graph.nodes.items, options.nodes.length
+ assert.lengthOf graph.nodes.items, options.nodes.length
actualNodes = graph.nodes.pluck 'name'
options.nodes.forEach (node) ->
assert.include actualNodes, node
focus["has #{options.arcs} arcs"] = (graph) ->
- assert.length graph.arcs.items, options.arcs
+ assert.lengthOf graph.arcs.items, options.arcs
focus["does #{ if not options.hasCycle then "not " else "" }have a cycle"] = (graph) ->
assert.equal graph.hasCycle(), options.hasCycle
@@ -51,7 +51,7 @@ testGraph = (options) ->
if options.sources?
focus["has sources of length #{options.sources.length} containing [#{options.sources.join ','}]"] = (graph) ->
sources = graph.sources().pluck 'name'
- assert.length sources, options.sources.length
+ assert.lengthOf sources, options.sources.length
options.sources.forEach (source) ->
assert.include sources, source
@@ -133,7 +133,7 @@ vows
'has a node list':
topic: (graph) -> graph.nodes
'with one element': (nodes) ->
- assert.length nodes.items, 1
+ assert.lengthOf nodes.items, 1
)
.export(module)
@@ -143,7 +143,7 @@ vows
'A List':
topic: new List
'has no nodes': (list) ->
- assert.length list.items, 0
+ assert.lengthOf list.items, 0
)
.export(module)
View
26 spec/rules.vows.coffee
@@ -11,34 +11,34 @@ vows
'A RuleGraph':
topic: new RuleGraph
'is empty': (graph) ->
- assert.length graph.nodes.items, 0
+ assert.lengthOf graph.nodes.items, 0
'A RuleGraph f([]) -> A':
topic: ->
graph = new RuleGraph
graph.rule new Rule 'A',[],(->)
'has 1 node that is a RecipeNode': (graph) ->
- assert.length graph.nodes.items, 1
+ assert.lengthOf graph.nodes.items, 1
assert.isTrue graph.nodes.items[0] instanceof RecipeNode
'A RuleGraph f([A]) -> B':
topic: ->
graph = new RuleGraph
graph.rule new Rule 'B',['A'],(->)
'has 2 nodes A and B': (graph) ->
- assert.length graph.nodes.items, 2
+ assert.lengthOf graph.nodes.items, 2
'has nodes of type FileNode':
topic: (graph) -> graph.nodes.ofType FileNode
'of length 1 with name A': (files) ->
- assert.length files.items, 1
+ assert.lengthOf files.items, 1
assert.equal files.items[0].name, 'A'
'has nodes of type RecipeNode':
topic: (graph) -> graph.nodes.ofType RecipeNode
'of length 1 with name B': (recipes) ->
- assert.length recipes.items, 1
+ assert.lengthOf recipes.items, 1
assert.equal recipes.items[0].name, 'B'
'has arcs':
topic: (graph) -> graph.arcs.items
'of length 1, from A to B': (arcs) ->
- assert.length arcs, 1
+ assert.lengthOf arcs, 1
assert.equal arcs[0].from.name, 'A'
assert.equal arcs[0].to.name, 'B'
'A RuleGraph f([A]) -> B .. f([B]) -> C':
@@ -49,29 +49,29 @@ vows
'has RecipeNodes':
topic: (graph) -> graph.nodes.ofType RecipeNode
'of length 2': (recipes) ->
- assert.length recipes.items, 2
+ assert.lengthOf recipes.items, 2
'has FileNodes':
topic: (graph) -> graph.nodes.ofType FileNode
'of length 1': (files) ->
- assert.length files.items, 1
+ assert.lengthOf files.items, 1
'A RuleGraph f([A]) -> B=>C':
topic: ->
graph = new RuleGraph
graph.rule new Rule 'B', ['A'], new Recipe (->), (->['C'])
'has RecipeNodes':
topic: (graph) -> graph.nodes.ofType RecipeNode
'of length 1': (recipes) ->
- assert.length recipes.items, 1
+ assert.lengthOf recipes.items, 1
'has FileNodes':
topic: (graph) -> graph.nodes.ofType FileNode
'of length 2': (files) ->
- assert.length files.items, 2
+ assert.lengthOf files.items, 2
'containing C': (files) ->
assert.includes (files.pluck 'name'), 'C'
'has 2 arcs':
topic: (graph) -> graph.arcs
'of length 2': (arcs) ->
- assert.length arcs.items, 2
+ assert.lengthOf arcs.items, 2
'from A,B': (arcs) ->
from = _(arcs.pluck 'from').pluck 'name'
['A','B'].forEach (item) ->
@@ -90,11 +90,11 @@ vows
# 'has FileNodes':
# topic: (graph) -> graph.nodes.ofType FileNode
# 'of length 2': (files) ->
-# assert.length files.items, 2
+# assert.lengthOf files.items, 2
# 'has Arcs':
# topic: (graph) -> graph.arcs
# 'of length 3': (arcs) ->
-# assert.length arcs.items, 3
+# assert.lengthOf arcs.items, 3
# 'from A,B,B': (arcs) ->
# from = _(arcs.pluck 'from').pluck 'name'
# ['A','B','B'].forEach (item) ->
View
2 src/rules.coffee
@@ -21,7 +21,7 @@
{ Graph, Node, Arc, NodeList } = require './dag'
_ = require 'underscore'
assert = require 'assert'
-{ globSync } = require 'glob'
+globSync = require( 'glob').sync
fs = require 'fs'
class RuleGraph extends Graph
Something went wrong with that request. Please try again.