Comparing version 0.10.0 to 0.10.1
0.10.1 / 2016-02-09 | ||
=================== | ||
* adding ability to forcibly remove a file from the tree | ||
0.10.0 / 2016-02-08 | ||
@@ -3,0 +8,0 @@ =================== |
@@ -97,7 +97,16 @@ | ||
* | ||
* @param {String} location The absolute path to the file. | ||
* Available `options`: | ||
* - `force` removes the file even if dependencies/dependants exist | ||
* | ||
* @param {String} location The absolute path to the file. | ||
* @param {Object} [options] Additional options. | ||
*/ | ||
removeFile(location) { | ||
debug('removing node %s', relative(location)); | ||
this.graph.removeVertex(location); | ||
removeFile(location, options) { | ||
let config = defaults(options, { force: false }); | ||
debug('removing node %s: %j', relative(location), config); | ||
if (config.force) { | ||
this.graph.destroyVertex(location); | ||
} else { | ||
this.graph.removeVertex(location); | ||
} | ||
} | ||
@@ -104,0 +113,0 @@ |
{ | ||
"name": "mako-tree", | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"main": "./lib/tree", | ||
@@ -5,0 +5,0 @@ "description": "The build tree structure used internally by mako", |
@@ -116,3 +116,3 @@ | ||
describe('#removeFile(location)', function () { | ||
describe('#removeFile(location, [options])', function () { | ||
it('should remove the file from the tree', function () { | ||
@@ -137,2 +137,16 @@ let tree = new Tree(); | ||
}); | ||
context('with options', function () { | ||
context('.force', function () { | ||
// a <- b | ||
let tree = new Tree(); | ||
tree.addFile('a'); | ||
tree.addFile('b'); | ||
tree.addDependency('a', 'b'); | ||
tree.removeFile('a', { force: true }); | ||
assert.isFalse(tree.hasFile('a')); | ||
assert.isTrue(tree.hasFile('b')); | ||
}); | ||
}); | ||
}); | ||
@@ -560,3 +574,3 @@ | ||
it('should not properly handle a complex case', function () { | ||
it('should properly handle a complex case', function () { | ||
// a* <- b <- c <- d | ||
@@ -641,3 +655,3 @@ // e <- f <- | ||
describe('.fromString()', function () { | ||
describe('.fromString(input)', function () { | ||
it('should parse a JSON string into a tree instance', function () { | ||
@@ -644,0 +658,0 @@ // a <- b |
61678
1412