diff options
Diffstat (limited to 'node_modules/sequencify')
-rw-r--r-- | node_modules/sequencify/.npmignore | 9 | ||||
-rw-r--r-- | node_modules/sequencify/.travis.yml | 6 | ||||
-rw-r--r-- | node_modules/sequencify/LICENSE | 20 | ||||
-rw-r--r-- | node_modules/sequencify/README.md | 68 | ||||
-rw-r--r-- | node_modules/sequencify/index.js | 46 | ||||
-rw-r--r-- | node_modules/sequencify/package.json | 31 |
6 files changed, 180 insertions, 0 deletions
diff --git a/node_modules/sequencify/.npmignore b/node_modules/sequencify/.npmignore new file mode 100644 index 000000000..5d8ea4769 --- /dev/null +++ b/node_modules/sequencify/.npmignore @@ -0,0 +1,9 @@ +.DS_Store
+*.log
+node_modules
+build
+*.node
+components
+*.orig
+.idea
+test
diff --git a/node_modules/sequencify/.travis.yml b/node_modules/sequencify/.travis.yml new file mode 100644 index 000000000..273b81203 --- /dev/null +++ b/node_modules/sequencify/.travis.yml @@ -0,0 +1,6 @@ +language: node_js
+node_js:
+ - 0.7
+ - 0.8
+ - 0.9
+ - 0.10
\ No newline at end of file diff --git a/node_modules/sequencify/LICENSE b/node_modules/sequencify/LICENSE new file mode 100644 index 000000000..b7346abd6 --- /dev/null +++ b/node_modules/sequencify/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2013 [Richardson & Sons, LLC](http://richardsonandsons.com/)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/sequencify/README.md b/node_modules/sequencify/README.md new file mode 100644 index 000000000..6b86fc259 --- /dev/null +++ b/node_modules/sequencify/README.md @@ -0,0 +1,68 @@ +
+
+Sequencify
+==========
+
+A module for sequencing tasks and dependencies
+
+Usage
+-----
+
+```javascript
+var sequencify = require('sequencify');
+
+var items = {
+ a: {
+ name: 'a',
+ dep: []
+ // other properties as needed
+ },
+ b: {
+ name: 'b',
+ dep: ['a']
+ },
+ c: {
+ name: 'c',
+ dep: ['a']
+ },
+ d: {
+ name: 'd',
+ dep: ['c']
+ },
+};
+
+var names = ['d', 'b', 'c', 'a']; // The names of the items you want arranged, need not be all
+
+var results = [];
+
+sequencify(items, names, results);
+
+console.log(results);
+// ['a','b','c','d'];
+```
+
+LICENSE
+-------
+
+(MIT License)
+
+Copyright (c) 2013 [Richardson & Sons, LLC](http://richardsonandsons.com/)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/node_modules/sequencify/index.js b/node_modules/sequencify/index.js new file mode 100644 index 000000000..b05f8bf32 --- /dev/null +++ b/node_modules/sequencify/index.js @@ -0,0 +1,46 @@ +/*jshint node:true */
+
+"use strict";
+
+var sequence = function (tasks, names, results, nest) {
+ var i, name, node, e, j;
+ nest = nest || [];
+ for (i = 0; i < names.length; i++) {
+ name = names[i];
+ // de-dup results
+ if (results.indexOf(name) === -1) {
+ node = tasks[name];
+ if (!node) {
+ e = new Error('task "'+name+'" is not defined');
+ e.missingTask = name;
+ e.taskList = [];
+ for (j in tasks) {
+ if (tasks.hasOwnProperty(j)) {
+ e.taskList.push(tasks[j].name);
+ }
+ }
+ throw e;
+ }
+ if (nest.indexOf(name) > -1) {
+ nest.push(name);
+ e = new Error('Recursive dependencies detected: '+nest.join(' -> '));
+ e.recursiveTasks = nest;
+ e.taskList = [];
+ for (j in tasks) {
+ if (tasks.hasOwnProperty(j)) {
+ e.taskList.push(tasks[j].name);
+ }
+ }
+ throw e;
+ }
+ if (node.dep.length) {
+ nest.push(name);
+ sequence(tasks, node.dep, results, nest); // recurse
+ nest.pop(name);
+ }
+ results.push(name);
+ }
+ }
+};
+
+module.exports = sequence;
diff --git a/node_modules/sequencify/package.json b/node_modules/sequencify/package.json new file mode 100644 index 000000000..e1cfbab8f --- /dev/null +++ b/node_modules/sequencify/package.json @@ -0,0 +1,31 @@ +{ + "name": "sequencify", + "description": "A module for sequencing tasks and dependencies", + "version": "0.0.7", + "homepage": "https://github.com/robrich/sequencify", + "repository": "git://github.com/robrich/sequencify.git", + "author": "Rob Richardson (http://robrich.org/)", + "main": "./index.js", + "keywords": [ + "task", + "sequence", + "sequencer", + "compose" + ], + "devDependencies": { + "mocha": "~1.16.1", + "should": "~2.1.1" + }, + "scripts": { + "test": "mocha" + }, + "engines": { + "node": ">= 0.4" + }, + "licenses": [ + { + "type": "MIT", + "url": "http://github.com/robrich/sequencify/raw/master/LICENSE" + } + ] +} |