You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bh...@apache.org on 2014/03/27 16:08:53 UTC
[39/51] [partial] CB-6346 - Add node_modules to source control
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jWorkflow/test/vendor/qunit.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jWorkflow/test/vendor/qunit.js b/blackberry10/node_modules/jWorkflow/test/vendor/qunit.js
new file mode 100644
index 0000000..385f1e6
--- /dev/null
+++ b/blackberry10/node_modules/jWorkflow/test/vendor/qunit.js
@@ -0,0 +1,997 @@
+/*
+ * QUnit - A JavaScript Unit Testing Framework
+ *
+ * http://docs.jquery.com/QUnit
+ *
+ * Copyright (c) 2009 John Resig, Jörn Zaefferer
+ * Dual licensed under the MIT (MIT-LICENSE.txt)
+ * and GPL (GPL-LICENSE.txt) licenses.
+ */
+
+(function(window) {
+
+var QUnit = {
+
+ // Initialize the configuration options
+ init: function init() {
+ config = {
+ stats: { all: 0, bad: 0 },
+ moduleStats: { all: 0, bad: 0 },
+ started: +new Date,
+ blocking: false,
+ autorun: false,
+ assertions: [],
+ filters: [],
+ queue: []
+ };
+
+ var tests = id("qunit-tests"),
+ banner = id("qunit-banner"),
+ result = id("qunit-testresult");
+
+ if ( tests ) {
+ tests.innerHTML = "";
+ }
+
+ if ( banner ) {
+ banner.className = "";
+ }
+
+ if ( result ) {
+ result.parentNode.removeChild( result );
+ }
+ },
+
+ // call on start of module test to prepend name to all tests
+ module: function module(name, testEnvironment) {
+
+ synchronize(function() {
+ if ( config.currentModule ) {
+ QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );
+ }
+
+ config.currentModule = name;
+ config.moduleTestEnvironment = testEnvironment;
+ config.moduleStats = { all: 0, bad: 0 };
+
+ QUnit.moduleStart( name, testEnvironment );
+ });
+ },
+
+ asyncTest: function asyncTest(testName, expected, callback) {
+ if ( arguments.length === 2 ) {
+ callback = expected;
+ expected = 0;
+ }
+
+ QUnit.test(testName, expected, callback, true);
+ },
+
+ test: function test(testName, expected, callback, async) {
+ var name = testName, testEnvironment = {};
+
+ if ( arguments.length === 2 ) {
+ callback = expected;
+ expected = null;
+ }
+
+ if ( config.currentModule ) {
+ name = config.currentModule + " module: " + name;
+ }
+
+ if ( !validTest(name) ) {
+ return;
+ }
+
+ synchronize(function() {
+ QUnit.testStart( testName );
+
+ testEnvironment = extend({
+ setup: function() {},
+ teardown: function() {}
+ }, config.moduleTestEnvironment);
+
+ config.assertions = [];
+ config.expected = null;
+
+ if ( arguments.length >= 3 ) {
+ config.expected = callback;
+ callback = arguments[2];
+ }
+
+ try {
+ if ( !config.pollution ) {
+ saveGlobal();
+ }
+
+ testEnvironment.setup.call(testEnvironment);
+ } catch(e) {
+ QUnit.ok( false, "Setup failed on " + name + ": " + e.message );
+ }
+
+ if ( async ) {
+ QUnit.stop();
+ }
+
+ try {
+ callback.call(testEnvironment);
+ } catch(e) {
+ fail("Test " + name + " died, exception and test follows", e, callback);
+ QUnit.ok( false, "Died on test #" + (config.assertions.length + 1) + ": " + e.message );
+ // else next test will carry the responsibility
+ saveGlobal();
+
+ // Restart the tests if they're blocking
+ if ( config.blocking ) {
+ start();
+ }
+ }
+ });
+
+ synchronize(function() {
+ try {
+ checkPollution();
+ testEnvironment.teardown.call(testEnvironment);
+ } catch(e) {
+ QUnit.ok( false, "Teardown failed on " + name + ": " + e.message );
+ }
+
+ try {
+ QUnit.reset();
+ } catch(e) {
+ fail("reset() failed, following Test " + name + ", exception and reset fn follows", e, reset);
+ }
+
+ if ( config.expected && config.expected != config.assertions.length ) {
+ QUnit.ok( false, "Expected " + config.expected + " assertions, but " + config.assertions.length + " were run" );
+ }
+
+ var good = 0, bad = 0,
+ tests = id("qunit-tests");
+
+ config.stats.all += config.assertions.length;
+ config.moduleStats.all += config.assertions.length;
+
+ if ( tests ) {
+ var ol = document.createElement("ol");
+ ol.style.display = "none";
+
+ for ( var i = 0; i < config.assertions.length; i++ ) {
+ var assertion = config.assertions[i];
+
+ var li = document.createElement("li");
+ li.className = assertion.result ? "pass" : "fail";
+ li.innerHTML = assertion.message || "(no message)";
+ ol.appendChild( li );
+
+ if ( assertion.result ) {
+ good++;
+ } else {
+ bad++;
+ config.stats.bad++;
+ config.moduleStats.bad++;
+ }
+ }
+
+ var b = document.createElement("strong");
+ b.innerHTML = name + " <b style='color:black;'>(<b class='fail'>" + bad + "</b>, <b class='pass'>" + good + "</b>, " + config.assertions.length + ")</b>";
+
+ addEvent(b, "click", function() {
+ var next = b.nextSibling, display = next.style.display;
+ next.style.display = display === "none" ? "block" : "none";
+ });
+
+ addEvent(b, "dblclick", function(e) {
+ var target = (e || window.event).target;
+ if ( target.nodeName.toLowerCase() === "strong" ) {
+ var text = "", node = target.firstChild;
+
+ while ( node.nodeType === 3 ) {
+ text += node.nodeValue;
+ node = node.nextSibling;
+ }
+
+ text = text.replace(/(^\s*|\s*$)/g, "");
+
+ if ( window.location ) {
+ window.location.href = window.location.href.match(/^(.+?)(\?.*)?$/)[1] + "?" + encodeURIComponent(text);
+ }
+ }
+ });
+
+ var li = document.createElement("li");
+ li.className = bad ? "fail" : "pass";
+ li.appendChild( b );
+ li.appendChild( ol );
+ tests.appendChild( li );
+
+ if ( bad ) {
+ var toolbar = id("qunit-testrunner-toolbar");
+ if ( toolbar ) {
+ toolbar.style.display = "block";
+ id("qunit-filter-pass").disabled = null;
+ id("qunit-filter-missing").disabled = null;
+ }
+ }
+
+ } else {
+ for ( var i = 0; i < config.assertions.length; i++ ) {
+ if ( !config.assertions[i].result ) {
+ bad++;
+ config.stats.bad++;
+ config.moduleStats.bad++;
+ }
+ }
+ }
+
+ QUnit.testDone( testName, bad, config.assertions.length );
+
+ if ( !window.setTimeout && !config.queue.length ) {
+ done();
+ }
+ });
+
+ if ( window.setTimeout && !config.doneTimer ) {
+ config.doneTimer = window.setTimeout(function(){
+ if ( !config.queue.length ) {
+ done();
+ } else {
+ synchronize( done );
+ }
+ }, 13);
+ }
+ },
+
+ /**
+ * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through.
+ */
+ expect: function expect(asserts) {
+ config.expected = asserts;
+ },
+
+ /**
+ * Asserts true.
+ * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" );
+ */
+ ok: function ok(a, msg) {
+ QUnit.log(a, msg);
+
+ config.assertions.push({
+ result: !!a,
+ message: msg
+ });
+ },
+
+ /**
+ * Checks that the first two arguments are equal, with an optional message.
+ * Prints out both actual and expected values.
+ *
+ * Prefered to ok( actual == expected, message )
+ *
+ * @example equals( format("Received {0} bytes.", 2), "Received 2 bytes." );
+ *
+ * @param Object actual
+ * @param Object expected
+ * @param String message (optional)
+ */
+ equals: function equals(actual, expected, message) {
+ push(expected == actual, actual, expected, message);
+ },
+
+ same: function(a, b, message) {
+ push(QUnit.equiv(a, b), a, b, message);
+ },
+
+ start: function start() {
+ // A slight delay, to avoid any current callbacks
+ if ( window.setTimeout ) {
+ window.setTimeout(function() {
+ if ( config.timeout ) {
+ clearTimeout(config.timeout);
+ }
+
+ config.blocking = false;
+ process();
+ }, 13);
+ } else {
+ config.blocking = false;
+ process();
+ }
+ },
+
+ stop: function stop(timeout) {
+ config.blocking = true;
+
+ if ( timeout && window.setTimeout ) {
+ config.timeout = window.setTimeout(function() {
+ QUnit.ok( false, "Test timed out" );
+ QUnit.start();
+ }, timeout);
+ }
+ },
+
+ /**
+ * Resets the test setup. Useful for tests that modify the DOM.
+ */
+ reset: function reset() {
+ if ( window.jQuery ) {
+ jQuery("#main").html( config.fixture );
+ jQuery.event.global = {};
+ jQuery.ajaxSettings = extend({}, config.ajaxSettings);
+ }
+ },
+
+ /**
+ * Trigger an event on an element.
+ *
+ * @example triggerEvent( document.body, "click" );
+ *
+ * @param DOMElement elem
+ * @param String type
+ */
+ triggerEvent: function triggerEvent( elem, type, event ) {
+ if ( document.createEvent ) {
+ event = document.createEvent("MouseEvents");
+ event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView,
+ 0, 0, 0, 0, 0, false, false, false, false, 0, null);
+ elem.dispatchEvent( event );
+
+ } else if ( elem.fireEvent ) {
+ elem.fireEvent("on"+type);
+ }
+ },
+
+ // Logging callbacks
+ done: function done(failures, total) {},
+ log: function log(result, message) {},
+ testStart: function testStart(name) {},
+ testDone: function testDone(name, failures, total) {},
+ moduleStart: function moduleStart(name, testEnvironment) {},
+ moduleDone: function moduleDone(name, failures, total) {}
+};
+
+// Maintain internal state
+var config = {
+ // The queue of tests to run
+ queue: [],
+
+ // block until document ready
+ blocking: true
+};
+
+// Load paramaters
+(function() {
+ var location = window.location || { search: "", protocol: "file:" },
+ GETParams = location.search.slice(1).split('&');
+
+ for ( var i = 0; i < GETParams.length; i++ ) {
+ GETParams[i] = decodeURIComponent( GETParams[i] );
+ if ( GETParams[i] === "noglobals" ) {
+ GETParams.splice( i, 1 );
+ i--;
+ config.noglobals = true;
+ }
+ }
+
+ // restrict modules/tests by get parameters
+ config.filters = GETParams;
+
+ // Figure out if we're running the tests from a server or not
+ QUnit.isLocal = !!(location.protocol === 'file:');
+})();
+
+// Expose the API as global variables, unless an 'exports'
+// object exists, in that case we assume we're in CommonJS
+if ( typeof exports === "undefined" || typeof require === "undefined" ) {
+ extend(window, QUnit);
+ window.QUnit = QUnit;
+} else {
+ extend(exports, QUnit);
+ exports.QUnit = QUnit;
+}
+
+if ( typeof document === "undefined" || document.readyState === "complete" ) {
+ config.autorun = true;
+}
+
+addEvent(window, "load", function() {
+ // Initialize the config, saving the execution queue
+ var oldconfig = extend({}, config);
+ QUnit.init();
+ extend(config, oldconfig);
+
+ config.blocking = false;
+
+ var userAgent = id("qunit-userAgent");
+ if ( userAgent ) {
+ userAgent.innerHTML = navigator.userAgent;
+ }
+
+ var toolbar = id("qunit-testrunner-toolbar");
+ if ( toolbar ) {
+ toolbar.style.display = "none";
+
+ var filter = document.createElement("input");
+ filter.type = "checkbox";
+ filter.id = "qunit-filter-pass";
+ filter.disabled = true;
+ addEvent( filter, "click", function() {
+ var li = document.getElementsByTagName("li");
+ for ( var i = 0; i < li.length; i++ ) {
+ if ( li[i].className.indexOf("pass") > -1 ) {
+ li[i].style.display = filter.checked ? "none" : "block";
+ }
+ }
+ });
+ toolbar.appendChild( filter );
+
+ var label = document.createElement("label");
+ label.setAttribute("for", "filter-pass");
+ label.innerHTML = "Hide passed tests";
+ toolbar.appendChild( label );
+
+ var missing = document.createElement("input");
+ missing.type = "checkbox";
+ missing.id = "qunit-filter-missing";
+ missing.disabled = true;
+ addEvent( missing, "click", function() {
+ var li = document.getElementsByTagName("li");
+ for ( var i = 0; i < li.length; i++ ) {
+ if ( li[i].className.indexOf("fail") > -1 && li[i].innerHTML.indexOf('missing test - untested code is broken code') > - 1 ) {
+ li[i].parentNode.parentNode.style.display = missing.checked ? "none" : "block";
+ }
+ }
+ });
+ toolbar.appendChild( missing );
+
+ label = document.createElement("label");
+ label.setAttribute("for", "filter-missing");
+ label.innerHTML = "Hide missing tests (untested code is broken code)";
+ toolbar.appendChild( label );
+ }
+
+ var main = id('main');
+ if ( main ) {
+ config.fixture = main.innerHTML;
+ }
+
+ if ( window.jQuery ) {
+ config.ajaxSettings = window.jQuery.ajaxSettings;
+ }
+
+ QUnit.start();
+});
+
+function done() {
+ if ( config.doneTimer && window.clearTimeout ) {
+ window.clearTimeout( config.doneTimer );
+ config.doneTimer = null;
+ }
+
+ if ( config.queue.length ) {
+ config.doneTimer = window.setTimeout(function(){
+ if ( !config.queue.length ) {
+ done();
+ } else {
+ synchronize( done );
+ }
+ }, 13);
+
+ return;
+ }
+
+ config.autorun = true;
+
+ // Log the last module results
+ if ( config.currentModule ) {
+ QUnit.moduleDone( config.currentModule, config.moduleStats.bad, config.moduleStats.all );
+ }
+
+ var banner = id("qunit-banner"),
+ tests = id("qunit-tests"),
+ html = ['Tests completed in ',
+ +new Date - config.started, ' milliseconds.<br/>',
+ '<span class="bad">', config.stats.all - config.stats.bad, '</span> tests of <span class="all">', config.stats.all, '</span> passed, ', config.stats.bad,' failed.'].join('');
+
+ if ( banner ) {
+ banner.className += " " + (config.stats.bad ? "fail" : "pass");
+ }
+
+ if ( tests ) {
+ var result = id("qunit-testresult");
+
+ if ( !result ) {
+ result = document.createElement("p");
+ result.id = "qunit-testresult";
+ result.className = "result";
+ tests.parentNode.insertBefore( result, tests.nextSibling );
+ }
+
+ result.innerHTML = html;
+ }
+
+ QUnit.done( config.stats.bad, config.stats.all );
+}
+
+function validTest( name ) {
+ var i = config.filters.length,
+ run = false;
+
+ if ( !i ) {
+ return true;
+ }
+
+ while ( i-- ) {
+ var filter = config.filters[i],
+ not = filter.charAt(0) == '!';
+
+ if ( not ) {
+ filter = filter.slice(1);
+ }
+
+ if ( name.indexOf(filter) !== -1 ) {
+ return !not;
+ }
+
+ if ( not ) {
+ run = true;
+ }
+ }
+
+ return run;
+}
+
+function push(result, actual, expected, message) {
+ message = message || (result ? "okay" : "failed");
+ QUnit.ok( result, result ? message + ": " + expected : message + ", expected: " + QUnit.jsDump.parse(expected) + " result: " + QUnit.jsDump.parse(actual) );
+}
+
+function synchronize( callback ) {
+ config.queue.push( callback );
+
+ if ( config.autorun && !config.blocking ) {
+ process();
+ }
+}
+
+function process() {
+ while ( config.queue.length && !config.blocking ) {
+ config.queue.shift()();
+ }
+}
+
+function saveGlobal() {
+ config.pollution = [];
+
+ if ( config.noglobals ) {
+ for ( var key in window ) {
+ config.pollution.push( key );
+ }
+ }
+}
+
+function checkPollution( name ) {
+ var old = config.pollution;
+ saveGlobal();
+
+ var newGlobals = diff( old, config.pollution );
+ if ( newGlobals.length > 0 ) {
+ ok( false, "Introduced global variable(s): " + newGlobals.join(", ") );
+ config.expected++;
+ }
+
+ var deletedGlobals = diff( config.pollution, old );
+ if ( deletedGlobals.length > 0 ) {
+ ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") );
+ config.expected++;
+ }
+}
+
+// returns a new Array with the elements that are in a but not in b
+function diff( a, b ) {
+ var result = a.slice();
+ for ( var i = 0; i < result.length; i++ ) {
+ for ( var j = 0; j < b.length; j++ ) {
+ if ( result[i] === b[j] ) {
+ result.splice(i, 1);
+ i--;
+ break;
+ }
+ }
+ }
+ return result;
+}
+
+function fail(message, exception, callback) {
+ if ( typeof console !== "undefined" && console.error && console.warn ) {
+ console.error(message);
+ console.error(exception);
+ console.warn(callback.toString());
+
+ } else if ( window.opera && opera.postError ) {
+ opera.postError(message, exception, callback.toString);
+ }
+}
+
+function extend(a, b) {
+ for ( var prop in b ) {
+ a[prop] = b[prop];
+ }
+
+ return a;
+}
+
+function addEvent(elem, type, fn) {
+ if ( elem.addEventListener ) {
+ elem.addEventListener( type, fn, false );
+ } else if ( elem.attachEvent ) {
+ elem.attachEvent( "on" + type, fn );
+ } else {
+ fn();
+ }
+}
+
+function id(name) {
+ return !!(typeof document !== "undefined" && document && document.getElementById) &&
+ document.getElementById( name );
+}
+
+// Test for equality any JavaScript type.
+// Discussions and reference: http://philrathe.com/articles/equiv
+// Test suites: http://philrathe.com/tests/equiv
+// Author: Philippe Rathé <pr...@gmail.com>
+QUnit.equiv = function () {
+
+ var innerEquiv; // the real equiv function
+ var callers = []; // stack to decide between skip/abort functions
+
+
+ // Determine what is o.
+ function hoozit(o) {
+ if (o.constructor === String) {
+ return "string";
+
+ } else if (o.constructor === Boolean) {
+ return "boolean";
+
+ } else if (o.constructor === Number) {
+
+ if (isNaN(o)) {
+ return "nan";
+ } else {
+ return "number";
+ }
+
+ } else if (typeof o === "undefined") {
+ return "undefined";
+
+ // consider: typeof null === object
+ } else if (o === null) {
+ return "null";
+
+ // consider: typeof [] === object
+ } else if (o instanceof Array) {
+ return "array";
+
+ // consider: typeof new Date() === object
+ } else if (o instanceof Date) {
+ return "date";
+
+ // consider: /./ instanceof Object;
+ // /./ instanceof RegExp;
+ // typeof /./ === "function"; // => false in IE and Opera,
+ // true in FF and Safari
+ } else if (o instanceof RegExp) {
+ return "regexp";
+
+ } else if (typeof o === "object") {
+ return "object";
+
+ } else if (o instanceof Function) {
+ return "function";
+ } else {
+ return undefined;
+ }
+ }
+
+ // Call the o related callback with the given arguments.
+ function bindCallbacks(o, callbacks, args) {
+ var prop = hoozit(o);
+ if (prop) {
+ if (hoozit(callbacks[prop]) === "function") {
+ return callbacks[prop].apply(callbacks, args);
+ } else {
+ return callbacks[prop]; // or undefined
+ }
+ }
+ }
+
+ var callbacks = function () {
+
+ // for string, boolean, number and null
+ function useStrictEquality(b, a) {
+ if (b instanceof a.constructor || a instanceof b.constructor) {
+ // to catch short annotaion VS 'new' annotation of a declaration
+ // e.g. var i = 1;
+ // var j = new Number(1);
+ return a == b;
+ } else {
+ return a === b;
+ }
+ }
+
+ return {
+ "string": useStrictEquality,
+ "boolean": useStrictEquality,
+ "number": useStrictEquality,
+ "null": useStrictEquality,
+ "undefined": useStrictEquality,
+
+ "nan": function (b) {
+ return isNaN(b);
+ },
+
+ "date": function (b, a) {
+ return hoozit(b) === "date" && a.valueOf() === b.valueOf();
+ },
+
+ "regexp": function (b, a) {
+ return hoozit(b) === "regexp" &&
+ a.source === b.source && // the regex itself
+ a.global === b.global && // and its modifers (gmi) ...
+ a.ignoreCase === b.ignoreCase &&
+ a.multiline === b.multiline;
+ },
+
+ // - skip when the property is a method of an instance (OOP)
+ // - abort otherwise,
+ // initial === would have catch identical references anyway
+ "function": function () {
+ var caller = callers[callers.length - 1];
+ return caller !== Object &&
+ typeof caller !== "undefined";
+ },
+
+ "array": function (b, a) {
+ var i;
+ var len;
+
+ // b could be an object literal here
+ if ( ! (hoozit(b) === "array")) {
+ return false;
+ }
+
+ len = a.length;
+ if (len !== b.length) { // safe and faster
+ return false;
+ }
+ for (i = 0; i < len; i++) {
+ if ( ! innerEquiv(a[i], b[i])) {
+ return false;
+ }
+ }
+ return true;
+ },
+
+ "object": function (b, a) {
+ var i;
+ var eq = true; // unless we can proove it
+ var aProperties = [], bProperties = []; // collection of strings
+
+ // comparing constructors is more strict than using instanceof
+ if ( a.constructor !== b.constructor) {
+ return false;
+ }
+
+ // stack constructor before traversing properties
+ callers.push(a.constructor);
+
+ for (i in a) { // be strict: don't ensures hasOwnProperty and go deep
+
+ aProperties.push(i); // collect a's properties
+
+ if ( ! innerEquiv(a[i], b[i])) {
+ eq = false;
+ }
+ }
+
+ callers.pop(); // unstack, we are done
+
+ for (i in b) {
+ bProperties.push(i); // collect b's properties
+ }
+
+ // Ensures identical properties name
+ return eq && innerEquiv(aProperties.sort(), bProperties.sort());
+ }
+ };
+ }();
+
+ innerEquiv = function () { // can take multiple arguments
+ var args = Array.prototype.slice.apply(arguments);
+ if (args.length < 2) {
+ return true; // end transition
+ }
+
+ return (function (a, b) {
+ if (a === b) {
+ return true; // catch the most you can
+ } else if (a === null || b === null || typeof a === "undefined" || typeof b === "undefined" || hoozit(a) !== hoozit(b)) {
+ return false; // don't lose time with error prone cases
+ } else {
+ return bindCallbacks(a, callbacks, [b, a]);
+ }
+
+ // apply transition with (1..n) arguments
+ })(args[0], args[1]) && arguments.callee.apply(this, args.splice(1, args.length -1));
+ };
+
+ return innerEquiv;
+
+}();
+
+/**
+ * jsDump
+ * Copyright (c) 2008 Ariel Flesler - aflesler(at)gmail(dot)com | http://flesler.blogspot.com
+ * Licensed under BSD (http://www.opensource.org/licenses/bsd-license.php)
+ * Date: 5/15/2008
+ * @projectDescription Advanced and extensible data dumping for Javascript.
+ * @version 1.0.0
+ * @author Ariel Flesler
+ * @link {http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html}
+ */
+QUnit.jsDump = (function() {
+ function quote( str ) {
+ return '"' + str.toString().replace(/"/g, '\\"') + '"';
+ };
+ function literal( o ) {
+ return o + '';
+ };
+ function join( pre, arr, post ) {
+ var s = jsDump.separator(),
+ base = jsDump.indent(),
+ inner = jsDump.indent(1);
+ if ( arr.join )
+ arr = arr.join( ',' + s + inner );
+ if ( !arr )
+ return pre + post;
+ return [ pre, inner + arr, base + post ].join(s);
+ };
+ function array( arr ) {
+ var i = arr.length, ret = Array(i);
+ this.up();
+ while ( i-- )
+ ret[i] = this.parse( arr[i] );
+ this.down();
+ return join( '[', ret, ']' );
+ };
+
+ var reName = /^function (\w+)/;
+
+ var jsDump = {
+ parse:function( obj, type ) { //type is used mostly internally, you can fix a (custom)type in advance
+ var parser = this.parsers[ type || this.typeOf(obj) ];
+ type = typeof parser;
+
+ return type == 'function' ? parser.call( this, obj ) :
+ type == 'string' ? parser :
+ this.parsers.error;
+ },
+ typeOf:function( obj ) {
+ var type = typeof obj,
+ f = 'function';//we'll use it 3 times, save it
+ return type != 'object' && type != f ? type :
+ !obj ? 'null' :
+ obj.exec ? 'regexp' :// some browsers (FF) consider regexps functions
+ obj.getHours ? 'date' :
+ obj.scrollBy ? 'window' :
+ obj.nodeName == '#document' ? 'document' :
+ obj.nodeName ? 'node' :
+ obj.item ? 'nodelist' : // Safari reports nodelists as functions
+ obj.callee ? 'arguments' :
+ obj.call || obj.constructor != Array && //an array would also fall on this hack
+ (obj+'').indexOf(f) != -1 ? f : //IE reports functions like alert, as objects
+ 'length' in obj ? 'array' :
+ type;
+ },
+ separator:function() {
+ return this.multiline ? this.HTML ? '<br />' : '\n' : this.HTML ? ' ' : ' ';
+ },
+ indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing
+ if ( !this.multiline )
+ return '';
+ var chr = this.indentChar;
+ if ( this.HTML )
+ chr = chr.replace(/\t/g,' ').replace(/ /g,' ');
+ return Array( this._depth_ + (extra||0) ).join(chr);
+ },
+ up:function( a ) {
+ this._depth_ += a || 1;
+ },
+ down:function( a ) {
+ this._depth_ -= a || 1;
+ },
+ setParser:function( name, parser ) {
+ this.parsers[name] = parser;
+ },
+ // The next 3 are exposed so you can use them
+ quote:quote,
+ literal:literal,
+ join:join,
+ //
+ _depth_: 1,
+ // This is the list of parsers, to modify them, use jsDump.setParser
+ parsers:{
+ window: '[Window]',
+ document: '[Document]',
+ error:'[ERROR]', //when no parser is found, shouldn't happen
+ unknown: '[Unknown]',
+ 'null':'null',
+ undefined:'undefined',
+ 'function':function( fn ) {
+ var ret = 'function',
+ name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE
+ if ( name )
+ ret += ' ' + name;
+ ret += '(';
+
+ ret = [ ret, this.parse( fn, 'functionArgs' ), '){'].join('');
+ return join( ret, this.parse(fn,'functionCode'), '}' );
+ },
+ array: array,
+ nodelist: array,
+ arguments: array,
+ object:function( map ) {
+ var ret = [ ];
+ this.up();
+ for ( var key in map )
+ ret.push( this.parse(key,'key') + ': ' + this.parse(map[key]) );
+ this.down();
+ return join( '{', ret, '}' );
+ },
+ node:function( node ) {
+ var open = this.HTML ? '<' : '<',
+ close = this.HTML ? '>' : '>';
+
+ var tag = node.nodeName.toLowerCase(),
+ ret = open + tag;
+
+ for ( var a in this.DOMAttrs ) {
+ var val = node[this.DOMAttrs[a]];
+ if ( val )
+ ret += ' ' + a + '=' + this.parse( val, 'attribute' );
+ }
+ return ret + close + open + '/' + tag + close;
+ },
+ functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function
+ var l = fn.length;
+ if ( !l ) return '';
+
+ var args = Array(l);
+ while ( l-- )
+ args[l] = String.fromCharCode(97+l);//97 is 'a'
+ return ' ' + args.join(', ') + ' ';
+ },
+ key:quote, //object calls it internally, the key part of an item in a map
+ functionCode:'[code]', //function calls it internally, it's the content of the function
+ attribute:quote, //node calls it internally, it's an html attribute value
+ string:quote,
+ date:quote,
+ regexp:literal, //regex
+ number:literal,
+ 'boolean':literal
+ },
+ DOMAttrs:{//attributes to dump from nodes, name=>realName
+ id:'id',
+ name:'name',
+ 'class':'className'
+ },
+ HTML:true,//if true, entities are escaped ( <, >, \t, space and \n )
+ indentChar:' ',//indentation unit
+ multiline:true //if true, items in a collection, are separated by a \n, else just a space.
+ };
+
+ return jsDump;
+})();
+
+})(this);
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/Jakefile
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/Jakefile b/blackberry10/node_modules/jake/Jakefile
new file mode 100644
index 0000000..b7725cd
--- /dev/null
+++ b/blackberry10/node_modules/jake/Jakefile
@@ -0,0 +1,43 @@
+var fs = require('fs')
+ , path = require('path');
+
+var t = new jake.TestTask('Jake', function () {
+ this.testFiles.include('test/*.js');
+ this.testFiles.exclude('test/helpers.js');
+});
+
+namespace('doc', function () {
+ task('generate', ['doc:clobber'], function () {
+ var cmd = '../node-jsdoc-toolkit/app/run.js -n -r=100 ' +
+ '-t=../node-jsdoc-toolkit/templates/codeview -d=./doc/ ./lib';
+ jake.logger.log('Generating docs ...');
+ jake.exec([cmd], function () {
+ jake.logger.log('Done.');
+ complete();
+ });
+ }, {async: true});
+
+ task('clobber', function () {
+ var cmd = 'rm -fr ./doc/*';
+ jake.exec([cmd], function () {
+ jake.logger.log('Clobbered old docs.');
+ complete();
+ });
+ }, {async: true});
+
+});
+
+desc('Generate docs for Jake');
+task('doc', ['doc:generate']);
+
+var p = new jake.NpmPublishTask('jake', [
+ 'Makefile'
+, 'Jakefile'
+, 'README.md'
+, 'package.json'
+, 'lib/**'
+, 'bin/**'
+, 'test/**'
+]);
+
+
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/Makefile
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/Makefile b/blackberry10/node_modules/jake/Makefile
new file mode 100644
index 0000000..3d0574e
--- /dev/null
+++ b/blackberry10/node_modules/jake/Makefile
@@ -0,0 +1,44 @@
+#
+# Jake JavaScript build tool
+# Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+.PHONY: all build install clean uninstall
+
+PREFIX=/usr/local
+DESTDIR=
+
+all: build
+
+build:
+ @echo 'Jake built.'
+
+install:
+ @mkdir -p $(DESTDIR)$(PREFIX)/bin && \
+ mkdir -p $(DESTDIR)$(PREFIX)/lib/node_modules/jake && \
+ mkdir -p ./node_modules && \
+ npm install utilities minimatch && \
+ cp -R ./* $(DESTDIR)$(PREFIX)/lib/node_modules/jake/ && \
+ ln -snf ../lib/node_modules/jake/bin/cli.js $(DESTDIR)$(PREFIX)/bin/jake && \
+ chmod 755 $(DESTDIR)$(PREFIX)/lib/node_modules/jake/bin/cli.js && \
+ echo 'Jake installed.'
+
+clean:
+ @true
+
+uninstall:
+ @rm -f $(DESTDIR)$(PREFIX)/bin/jake && \
+ rm -fr $(DESTDIR)$(PREFIX)/lib/node_modules/jake/ && \
+ echo 'Jake uninstalled.'
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/README.md
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/README.md b/blackberry10/node_modules/jake/README.md
new file mode 100644
index 0000000..5cb7cc9
--- /dev/null
+++ b/blackberry10/node_modules/jake/README.md
@@ -0,0 +1,946 @@
+### Jake -- JavaScript build tool for Node.js
+
+### Installing with [NPM](http://npmjs.org/)
+
+Install globally with:
+
+ npm install -g jake
+
+Or you may also install it as a development dependency in a package.json file:
+
+ // package.json
+ "devDependencies": {
+ "jake": "latest"
+ }
+
+Then install it with `npm install`
+
+Note Jake is intended to be mostly a command-line tool, but lately there have been
+changes to it so it can be either embedded, or run from inside your project.
+
+### Installing from source
+
+Prerequisites: Jake requires [Node.js](<http://nodejs.org/>), and the
+[utilities](https://npmjs.org/package/utilities) and
+[minimatch](https://npmjs.org/package/minimatch) modules.
+
+Get Jake:
+
+ git clone git://github.com/mde/jake.git
+
+Build Jake:
+
+ cd jake && make && sudo make install
+
+Even if you're installing Jake from source, you'll still need NPM for installing
+the few modules Jake depends on. `make install` will do this automatically for
+you.
+
+By default Jake is installed in "/usr/local." To install it into a different
+directory (e.g., one that doesn't require super-user privilege), pass the PREFIX
+variable to the `make install` command. For example, to install it into a
+"jake" directory in your home directory, you could use this:
+
+ make && make install PREFIX=~/jake
+
+If do you install Jake somewhere special, you'll need to add the "bin" directory
+in the install target to your PATH to get access to the `jake` executable.
+
+### Windows, installing from source
+
+For Windows users installing from source, there are some additional steps.
+
+*Assumed: current directory is the same directory where node.exe is present.*
+
+Get Jake:
+
+ git clone git://github.com/mde/jake.git node_modules/jake
+
+Copy jake.bat and jake to the same directory as node.exe
+
+ copy node_modules/jake/jake.bat jake.bat
+ copy node_modules/jake/jake jake
+
+Add the directory of node.exe to the environment PATH variable.
+
+### Basic usage
+
+ jake [options ...] [env variables ...] target
+
+### Description
+
+ Jake is a simple JavaScript build program with capabilities similar to the
+ regular make or rake command.
+
+ Jake has the following features:
+ * Jakefiles are in standard JavaScript syntax
+ * Tasks with prerequisites
+ * Namespaces for tasks
+ * Async task execution
+
+### Options
+
+ -V/v
+ --version Display the Jake version.
+
+ -h
+ --help Display help message.
+
+ -f *FILE*
+ --jakefile *FILE* Use FILE as the Jakefile.
+
+ -C *DIRECTORY*
+ --directory *DIRECTORY* Change to DIRECTORY before running tasks.
+
+ -q
+ --quiet Do not log messages to standard output.
+
+ -J *JAKELIBDIR*
+ --jakelibdir *JAKELIBDIR* Auto-import any .jake files in JAKELIBDIR.
+ (default is 'jakelib')
+
+ -B
+ --always-make Unconditionally make all targets.
+
+ -t
+ --trace Enable full backtrace.
+
+ -T/ls
+ --tasks Display the tasks (matching optional PATTERN)
+ with descriptions, then exit.
+
+### Jakefile syntax
+
+A Jakefile is just executable JavaScript. You can include whatever JavaScript
+you want in it.
+
+## API Docs
+
+API docs [can be found here](http://mde.github.com/jake/doc/).
+
+## Tasks
+
+Use `task` to define tasks. It has one required argument, the task-name, and
+three optional arguments:
+
+```javascript
+task(name, [prerequisites], [action], [opts]);
+```
+
+The `name` argument is a String with the name of the task, and `prerequisites`
+is an optional Array arg of the list of prerequisite tasks to perform first.
+
+The `action` is a Function defininng the action to take for the task. (Note that
+Object-literal syntax for name/prerequisites in a single argument a la Rake is
+also supported, but JavaScript's lack of support for dynamic keys in Object
+literals makes it not very useful.) The action is invoked with the Task object
+itself as the execution context (i.e, "this" inside the action references the
+Task object).
+
+The `opts` argument is the normal JavaScript-style 'options' object. When a
+task's operations are asynchronous, the `async` property should be set to
+`true`, and the task must call `complete()` to signal to Jake that the task is
+done, and execution can proceed. By default the `async` property is `false`.
+
+Tasks created with `task` are always executed when asked for (or are a
+prerequisite). Tasks created with `file` are only executed if no file with the
+given name exists or if any of its file-prerequisites are more recent than the
+file named by the task. Also, if any prerequisite is a regular task, the file
+task will always be executed.
+
+Use `desc` to add a string description of the task.
+
+Here's an example:
+
+```javascript
+desc('This is the default task.');
+task('default', function (params) {
+ console.log('This is the default task.');
+});
+
+desc('This task has prerequisites.');
+task('hasPrereqs', ['foo', 'bar', 'baz'], function (params) {
+ console.log('Ran some prereqs first.');
+});
+```
+
+And here's an example of an asynchronous task:
+
+```javascript
+desc('This is an asynchronous task.');
+task('asyncTask', {async: true}, function () {
+ setTimeout(complete, 1000);
+});
+```
+
+A Task is also an EventEmitter which emits the 'complete' event when it is
+finished. This allows asynchronous tasks to be run from within other asked via
+either `invoke` or `execute`, and ensure they will complete before the rest of
+the containing task executes. See the section "Running tasks from within other
+tasks," below.
+
+### File-tasks
+
+Create a file-task by calling `file`.
+
+File-tasks create a file from one or more other files. With a file-task, Jake
+checks both that the file exists, and also that it is not older than the files
+specified by any prerequisite tasks. File-tasks are particularly useful for
+compiling something from a tree of source files.
+
+```javascript
+desc('This builds a minified JS file for production.');
+file('foo-minified.js', ['bar', 'foo-bar.js', 'foo-baz.js'], function () {
+ // Code to concat and minify goes here
+});
+```
+
+### Directory-tasks
+
+Create a directory-task by calling `directory`.
+
+Directory-tasks create a directory for use with for file-tasks. Jake checks for
+the existence of the directory, and only creates it if needed.
+
+```javascript
+desc('This creates the bar directory for use with the foo-minified.js file-task.');
+directory('bar');
+```
+
+This task will create the directory when used as a prerequisite for a file-task,
+or when run from the command-line.
+
+### Namespaces
+
+Use `namespace` to create a namespace of tasks to perform. Call it with two arguments:
+
+```javascript
+namespace(name, namespaceTasks);
+```
+
+Where is `name` is the name of the namespace, and `namespaceTasks` is a function
+with calls inside it to `task` or `desc` definining all the tasks for that
+namespace.
+
+Here's an example:
+
+```javascript
+desc('This is the default task.');
+task('default', function () {
+ console.log('This is the default task.');
+});
+
+namespace('foo', function () {
+ desc('This the foo:bar task');
+ task('bar', function () {
+ console.log('doing foo:bar task');
+ });
+
+ desc('This the foo:baz task');
+ task('baz', ['default', 'foo:bar'], function () {
+ console.log('doing foo:baz task');
+ });
+
+});
+```
+
+In this example, the foo:baz task depends on the the default and foo:bar tasks.
+
+### Passing parameters to jake
+
+Parameters can be passed to Jake two ways: plain arguments, and environment
+variables.
+
+To pass positional arguments to the Jake tasks, enclose them in square braces,
+separated by commas, after the name of the task on the command-line. For
+example, with the following Jakefile:
+
+```javascript
+desc('This is an awesome task.');
+task('awesome', function (a, b, c) {
+ console.log(a, b, c);
+});
+```
+
+You could run `jake` like this:
+
+ jake awesome[foo,bar,baz]
+
+And you'd get the following output:
+
+ foo bar baz
+
+Note that you *cannot* uses spaces between the commas separating the parameters.
+
+Any parameters passed after the Jake task that contain an equals sign (=) will
+be added to process.env.
+
+With the following Jakefile:
+
+```javascript
+desc('This is an awesome task.');
+task('awesome', function (a, b, c) {
+ console.log(a, b, c);
+ console.log(process.env.qux, process.env.frang);
+});
+```
+
+You could run `jake` like this:
+
+ jake awesome[foo,bar,baz] qux=zoobie frang=asdf
+
+And you'd get the following output:
+
+ foo bar baz
+ zoobie asdf
+Running `jake` with no arguments runs the default task.
+
+__Note for zsh users__ : you will need to escape the brackets or wrap in single
+quotes like this to pass parameters :
+
+ jake 'awesome[foo,bar,baz]'
+
+An other solution is to desactivate permannently file-globbing for the `jake`
+command. You can do this by adding this line to your `.zshrc` file :
+
+ alias jake="noglob jake"
+
+### Cleanup after all tasks run, jake 'complete' event
+
+The base 'jake' object is an EventEmitter, and fires a 'complete' event after
+running all tasks.
+
+This is sometimes useful when a task starts a process which keeps the Node
+event-loop running (e.g., a database connection). If you know you want to stop
+the running Node process after all tasks have finished, you can set a listener
+for the 'complete' event, like so:
+
+```javascript
+jake.addListener('complete', function () {
+ process.exit();
+});
+```
+
+### Running tasks from within other tasks
+
+Jake supports the ability to run a task from within another task via the
+`invoke` and `execute` methods.
+
+The `invoke` method will run the desired task, along with its prerequisites:
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+The `invoke` method will only run the task once, even if you call it repeatedly.
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+ // Does nothing
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+The `execute` method will run the desired task without its prerequisites:
+
+```javascript
+desc('Calls the foo:bar task without its prerequisites.');
+task('executeFooBar', function () {
+ // Calls foo:bar without its prereqs
+ jake.Task['foo:baz'].execute();
+});
+```
+
+Calling `execute` repeatedly will run the desired task repeatedly.
+
+```javascript
+desc('Calls the foo:bar task without its prerequisites.');
+task('executeFooBar', function () {
+ // Calls foo:bar without its prereqs
+ jake.Task['foo:baz'].execute();
+ // Can keep running this over and over
+ jake.Task['foo:baz'].execute();
+ jake.Task['foo:baz'].execute();
+});
+```
+
+If you want to run the task and its prerequisites more than once, you can use
+`invoke` with the `reenable` method.
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+ // Does nothing
+ jake.Task['foo:bar'].invoke();
+ // Only re-runs foo:bar, but not its prerequisites
+ jake.Task['foo:bar'].reenable();
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+The `reenable` method takes a single Boolean arg, a 'deep' flag, which reenables
+the task's prerequisites if set to true.
+
+```javascript
+desc('Calls the foo:bar task and its prerequisites.');
+task('invokeFooBar', function () {
+ // Calls foo:bar and its prereqs
+ jake.Task['foo:bar'].invoke();
+ // Does nothing
+ jake.Task['foo:bar'].invoke();
+ // Re-runs foo:bar and all of its prerequisites
+ jake.Task['foo:bar'].reenable(true);
+ jake.Task['foo:bar'].invoke();
+});
+```
+
+It's easy to pass params on to a sub-task run via `invoke` or `execute`:
+
+```javascript
+desc('Passes params on to other tasks.');
+task('passParams', function () {
+ var t = jake.Task['foo:bar'];
+ // Calls foo:bar, passing along current args
+ t.invoke.apply(t, arguments);
+});
+```
+
+### Managing asynchrony without prereqs (e.g., when using `invoke`)
+
+You can mix sync and async without problems when using normal prereqs, because
+the Jake execution loop takes care of the difference for you. But when you call
+`invoke` or `execute`, you have to manage the asynchrony yourself.
+
+Here's a correct working example:
+
+```javascript
+task('async1', ['async2'], {async: true}, function () {
+ console.log('-- async1 start ----------------');
+ setTimeout(function () {
+ console.log('-- async1 done ----------------');
+ complete();
+ }, 1000);
+});
+
+task('async2', {async: true}, function () {
+ console.log('-- async2 start ----------------');
+ setTimeout(function () {
+ console.log('-- async2 done ----------------');
+ complete();
+ }, 500);
+});
+
+task('init', ['async1', 'async2'], {async: true}, function () {
+ console.log('-- init start ----------------');
+ setTimeout(function () {
+ console.log('-- init done ----------------');
+ complete();
+ }, 100);
+});
+
+task('default', {async: true}, function () {
+ console.log('-- default start ----------------');
+ var init = jake.Task.init;
+ init.addListener('complete', function () {
+ console.log('-- default done ----------------');
+ complete();
+ });
+ init.invoke();
+});
+```
+
+You have to declare the "default" task as asynchronous as well, and call
+`complete` on it when "init" finishes. Here's the output:
+
+ -- default start ----------------
+ -- async2 start ----------------
+ -- async2 done ----------------
+ -- async1 start ----------------
+ -- async1 done ----------------
+ -- init start ----------------
+ -- init done ----------------
+ -- default done ----------------
+
+You get what you expect -- "default" starts, the rest runs, and finally
+"default" finishes.
+
+### Evented tasks
+
+Tasks are EventEmitters. They can fire 'complete' and 'error' events.
+
+If a task called via `invoke` is asynchronous, you can set a listener on the
+'complete' event to run any code that depends on it.
+
+```javascript
+desc('Calls the async foo:baz task and its prerequisites.');
+task('invokeFooBaz', {async: true}, function () {
+ var t = jake.Task['foo:baz'];
+ t.addListener('complete', function () {
+ console.log('Finished executing foo:baz');
+ // Maybe run some other code
+ // ...
+ // Complete the containing task
+ complete();
+ });
+ // Kick off foo:baz
+ t.invoke();
+});
+```
+
+If you want to handle the errors in a task in some specific way, you can set a
+listener for the 'error' event, like so:
+
+```javascript
+namespace('vronk', function () {
+ task('groo', function () {
+ var t = jake.Task['vronk:zong'];
+ t.addListener('error', function (e) {
+ console.log(e.message);
+ });
+ t.invoke();
+ });
+
+ task('zong', function () {
+ throw new Error('OMFGZONG');
+ });
+});
+```
+
+If no specific listener is set for the "error" event, errors are handled by
+Jake's generic error-handling.
+
+### Aborting a task
+
+You can abort a task by calling the `fail` function, and Jake will abort the
+currently running task. You can pass a customized error message to `fail`:
+
+```javascript
+desc('This task fails.');
+task('failTask', function () {
+ fail('Yikes. Something back happened.');
+});
+```
+
+You can also pass an optional exit status-code to the fail command, like so:
+
+```javascript
+desc('This task fails with an exit-status of 42.');
+task('failTaskQuestionCustomStatus', function () {
+ fail('What is the answer?', 42);
+});
+```
+
+The process will exit with a status of 42.
+
+Uncaught errors will also abort the currently running task.
+
+### Showing the list of tasks
+
+Passing `jake` the -T or --tasks flag will display the full list of tasks
+available in a Jakefile, along with their descriptions:
+
+ $ jake -T
+ jake default # This is the default task.
+ jake asdf # This is the asdf task.
+ jake concat.txt # File task, concating two files together
+ jake failure # Failing task.
+ jake lookup # Jake task lookup by name.
+ jake foo:bar # This the foo:bar task
+ jake foo:fonebone # This the foo:fonebone task
+
+Setting a value for -T/--tasks will filter the list by that value:
+
+ $ jake -T foo
+ jake foo:bar # This the foo:bar task
+ jake foo:fonebone # This the foo:fonebone task
+
+The list displayed will be all tasks whose namespace/name contain the filter-string.
+
+## Breaking things up into multiple files
+
+Jake will automatically look for files with a .jake extension in a 'jakelib'
+directory in your project, and load them (via `require`) after loading your
+Jakefile. (The directory name can be overridden using the -J/--jakelibdir
+command-line option.)
+
+This allows you to break your tasks up over multiple files -- a good way to do
+it is one namespace per file: e.g., a `zardoz` namespace full of tasks in
+'jakelib/zardox.jake'.
+
+Note that these .jake files each run in their own module-context, so they don't
+have access to each others' data. However, the Jake API methods, and the
+task-hierarchy are globally available, so you can use tasks in any file as
+prerequisites for tasks in any other, just as if everything were in a single
+file.
+
+Environment-variables set on the command-line are likewise also naturally
+available to code in all files via process.env.
+
+## File-utils
+
+Since shelling out in Node is an asynchronous operation, Jake comes with a few
+useful file-utilities with a synchronous API, that make scripting easier.
+
+The `jake.mkdirP` utility recursively creates a set of nested directories. It
+will not throw an error if any of the directories already exists. Here's an example:
+
+```javascript
+jake.mkdirP('app/views/layouts');
+```
+
+The `jake.cpR` utility does a recursive copy of a file or directory. It takes
+two arguments, the file/directory to copy, and the destination. Note that this
+command can only copy files and directories; it does not perform globbing (so
+arguments like '*.txt' are not possible).
+
+```javascript
+jake.cpR(path.join(sourceDir, '/templates'), currentDir);
+```
+
+This would copy 'templates' (and all its contents) into `currentDir`.
+
+The `jake.readdirR` utility gives you a recursive directory listing, giving you
+output somewhat similar to the Unix `find` command. It only works with a
+directory name, and does not perform filtering or globbing.
+
+```javascript
+jake.readdirR('pkg');
+```
+
+This would return an array of filepaths for all files in the 'pkg' directory,
+and all its subdirectories.
+
+The `jake.rmRf` utility recursively removes a directory and all its contents.
+
+```javascript
+jake.rmRf('pkg');
+```
+
+This would remove the 'pkg' directory, and all its contents.
+
+## Running shell-commands: `jake.exec` and `jake.createExec`
+
+Jake also provides a more general utility function for running a sequence of
+shell-commands.
+
+### `jake.exec`
+
+The `jake.exec` command takes an array of shell-command strings, and an optional
+callback to run after completing them. Here's an example from Jake's Jakefile,
+that runs the tests:
+
+```javascript
+desc('Runs the Jake tests.');
+task('test', {async: true}, function () {
+ var cmds = [
+ 'node ./tests/parseargs.js'
+ , 'node ./tests/task_base.js'
+ , 'node ./tests/file_task.js'
+ ];
+ jake.exec(cmds, {printStdout: true}, function () {
+ console.log('All tests passed.');
+ complete();
+ });
+
+desc('Runs some apps in interactive mode.');
+task('interactiveTask', {async: true}, function () {
+ var cmds = [
+ 'node' // Node conosle
+ , 'vim' // Open Vim
+ ];
+ jake.exec(cmds, {interactive: true}, function () {
+ complete();
+ });
+});
+```
+
+It also takes an optional options-object, with the following options:
+
+ * `interactive` (tasks are interactive, trumps printStdout and
+ printStderr below, default false)
+
+ * `printStdout` (print to stdout, default false)
+
+ * `printStderr` (print to stderr, default false)
+
+ * `breakOnError` (stop execution on error, default true)
+
+This command doesn't pipe input between commands -- it's for simple execution.
+
+### `jake.createExec` and the evented Exec object
+
+Jake also provides an evented interface for running shell commands. Calling
+`jake.createExec` returns an instance of `jake.Exec`, which is an `EventEmitter`
+that fires events as it executes commands.
+
+It emits the following events:
+
+* 'cmdStart': When a new command begins to run. Passes one arg, the command
+being run.
+
+* 'cmdEnd': When a command finishes. Passes one arg, the command
+being run.
+
+* 'stdout': When the stdout for the child-process recieves data. This streams
+the stdout data. Passes one arg, the chunk of data.
+
+* 'stderr': When the stderr for the child-process recieves data. This streams
+the stderr data. Passes one arg, the chunk of data.
+
+* 'error': When a shell-command exits with a non-zero status-code. Passes two
+args -- the error message, and the status code. If you do not set an error
+handler, and a command exits with an error-code, Jake will throw the unhandled
+error. If `breakOnError` is set to true, the Exec object will emit and 'error'
+event after the first error, and stop any further execution.
+
+To begin running the commands, you have to call the `run` method on it. It also
+has an `append` method for adding new commands to the list of commands to run.
+
+Here's an example:
+
+```javascript
+var ex = jake.createExec(['do_thing.sh'], {printStdout: true});
+ex.addListener('error', function (msg, code) {
+ if (code == 127) {
+ console.log("Couldn't find do_thing script, trying do_other_thing");
+ ex.append('do_other_thing.sh');
+ }
+ else {
+ fail('Fatal error: ' + msg, code);
+ }
+});
+ex.run();
+```
+
+Using the evented Exec object gives you a lot more flexibility in running shell
+commmands. But if you need something more sophisticated, Procstreams
+(<https://github.com/polotek/procstreams>) might be a good option.
+
+## Logging and output
+
+Using the -q/--quiet flag at the command-line will stop Jake from sending its
+normal output to standard output. Note that this only applies to built-in output
+from Jake; anything you output normally from your tasks will still be displayed.
+
+If you want to take advantage of the -q/--quiet flag in your own programs, you
+can use `jake.logger.log` and `jake.logger.error` for displaying output. These
+two commands will respect the flag, and suppress output correctly when the
+quiet-flag is on.
+
+You can check the current value of this flag in your own tasks by using
+`jake.program.opts.quiet`. If you want the output of a `jake.exec` shell-command
+to respect the quiet-flag, set your `printStdout` and `printStderr` options to
+false if the quiet-option is on:
+
+```javascript
+task('echo', {async: true}, function () {
+ jake.exec(['echo "hello"'], function () {
+ jake.logger.log('Done.');
+ complete();
+ }, {printStdout: !jake.program.opts.quiet});
+});
+```
+
+## PackageTask
+
+Instantiating a PackageTask programmically creates a set of tasks for packaging
+up your project for distribution. Here's an example:
+
+```javascript
+var t = new jake.PackageTask('fonebone', 'v0.1.2112', function () {
+ var fileList = [
+ 'Jakefile'
+ , 'README.md'
+ , 'package.json'
+ , 'lib/*'
+ , 'bin/*'
+ , 'tests/*'
+ ];
+ this.packageFiles.include(fileList);
+ this.needTarGz = true;
+ this.needTarBz2 = true;
+});
+```
+
+This will automatically create a 'package' task that will assemble the specified
+files in 'pkg/fonebone-v0.1.2112,' and compress them according to the specified
+options. After running `jake package`, you'll have the following in pkg/:
+
+ fonebone-v0.1.2112
+ fonebone-v0.1.2112.tar.bz2
+ fonebone-v0.1.2112.tar.gz
+
+PackageTask also creates a 'clobber' task that removes the pkg/
+directory.
+
+The [PackageTask API
+docs](http://mde.github.com/jake/doc/symbols/jake.PackageTask.html) include a
+lot more information, including different archiving options.
+
+### FileList
+
+Jake's FileList takes a list of glob-patterns and file-names, and lazy-creates a
+list of files to include. Instead of immediately searching the filesystem to
+find the files, a FileList holds the pattern until it is actually used.
+
+When any of the normal JavaScript Array methods (or the `toArray` method) are
+called on the FileList, the pending patterns are resolved into an actual list of
+file-names. FileList uses the [minimatch](https://github.com/isaacs/minimatch) module.
+
+To build the list of files, use FileList's `include` and `exclude` methods:
+
+```javascript
+var list = new jake.FileList();
+list.include('foo/*.txt');
+list.include(['bar/*.txt', 'README.md']);
+list.include('Makefile', 'package.json');
+list.exclude('foo/zoobie.txt');
+list.exclude(/foo\/src.*.txt/);
+console.log(list.toArray());
+```
+
+The `include` method can be called either with an array of items, or multiple
+single parameters. Items can be either glob-patterns, or individual file-names.
+
+The `exclude` method will prevent files from being included in the list. These
+files must resolve to actual files on the filesystem. It can be called either
+with an array of items, or mutliple single parameters. Items can be
+glob-patterns, individual file-names, string-representations of
+regular-expressions, or regular-expression literals.
+
+## TestTask
+
+Instantiating a TestTask programmically creates a simple task for running tests
+for your project. The first argument of the constructor is the project-name
+(used in the description of the task), and the second argument is a function
+that defines the task. It allows you to specifify what files to run as tests,
+and what to name the task that gets created (defaults to "test" if unset).
+
+```javascript
+var t = new jake.TestTask('fonebone', function () {
+ var fileList = [
+ 'tests/*'
+ , 'lib/adapters/**/test.js'
+ ];
+ this.testFiles.include(fileList);
+ this.testFiles.exclude('tests/helper.js');
+ this.testName = 'testMainAndAdapters';
+});
+```
+
+Tests in the specified file should be in the very simple format of
+test-functions hung off the export. These tests are converted into Jake tasks
+which Jake then runs normally.
+
+If a test needs to run asynchronously, simply define the test-function with a
+single argument, a callback. Jake will define this as an asynchronous task, and
+will wait until the callback is called in the test function to run the next test.
+
+Here's an example test-file:
+
+```javascript
+var assert = require('assert')
+ , tests;
+
+tests = {
+ 'sync test': function () {
+ // Assert something
+ assert.ok(true);
+ }
+, 'async test': function (next) {
+ // Assert something else
+ assert.ok(true);
+ // Won't go next until this is called
+ next();
+ }
+, 'another sync test': function () {
+ // Assert something else
+ assert.ok(true);
+ }
+};
+
+module.exports = tests;
+```
+
+Jake's tests are also a good example of use of a TestTask.
+
+## NpmPublishTask
+
+The NpmPublishTask builds on top of PackageTask to allow you to do a version
+bump of your project, package it, and publish it to NPM. Define the task with
+your project's name, and the list of files you want packaged and published to
+NPM.
+
+Here's an example from Jake's Jakefile:
+
+```javascript
+var p = new jake.NpmPublishTask('jake', [
+ 'Makefile'
+, 'Jakefile'
+, 'README.md'
+, 'package.json'
+, 'lib/*'
+, 'bin/*'
+, 'tests/*'
+]);
+```
+
+The NpmPublishTask will automatically create a `publish` task which performs the
+following steps:
+
+1. Bump the version number in your package.json
+2. Commit change in git, push it to GitHub
+3. Create a git tag for the version
+4. Push the tag to GitHub
+5. Package the new version of your project
+6. Publish it to NPM
+7. Clean up the package
+
+## CoffeeScript Jakefiles
+
+Jake can also handle Jakefiles in CoffeeScript. Be sure to make it
+Jakefile.coffee so Jake knows it's in CoffeeScript.
+
+Here's an example:
+
+```coffeescript
+util = require('util')
+
+desc 'This is the default task.'
+task 'default', (params) ->
+ console.log 'Ths is the default task.'
+ console.log(util.inspect(arguments))
+ jake.Task['new'].invoke []
+
+task 'new', ->
+ console.log 'ello from new'
+ jake.Task['foo:next'].invoke ['param']
+
+namespace 'foo', ->
+ task 'next', (param) ->
+ console.log 'ello from next with param: ' + param
+```
+
+## Related projects
+
+James Coglan's "Jake": <http://github.com/jcoglan/jake>
+
+Confusingly, this is a Ruby tool for building JavaScript packages from source code.
+
+280 North's Jake: <http://github.com/280north/jake>
+
+This is also a JavaScript port of Rake, which runs on the Narwhal platform.
+
+### License
+
+Licensed under the Apache License, Version 2.0
+(<http://www.apache.org/licenses/LICENSE-2.0>)
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/bin/cli.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/bin/cli.js b/blackberry10/node_modules/jake/bin/cli.js
new file mode 100755
index 0000000..e241f2b
--- /dev/null
+++ b/blackberry10/node_modules/jake/bin/cli.js
@@ -0,0 +1,23 @@
+#!/usr/bin/env node
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var args = process.argv.slice(2)
+ , jake = require('../lib/jake');
+
+jake.run.apply(jake, args);
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/lib/api.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/lib/api.js b/blackberry10/node_modules/jake/lib/api.js
new file mode 100644
index 0000000..97d7c78
--- /dev/null
+++ b/blackberry10/node_modules/jake/lib/api.js
@@ -0,0 +1,241 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+var exec = require('child_process').exec;
+
+var api = new (function () {
+ /**
+ @name task
+ @static
+ @function
+ @description Creates a Jake Task
+ `
+ @param {String} name The name of the Task
+ @param {Array} [prereqs] Prerequisites to be run before this task
+ @param {Function} [action] The action to perform for this task
+ @param {Object} [opts]
+ @param {Boolean} [opts.asyc=false] Perform this task asynchronously.
+ If you flag a task with this option, you must call the global
+ `complete` method inside the task's action, for execution to proceed
+ to the next task.
+
+ @example
+ desc('This is the default task.');
+ task('default', function (params) {
+ console.log('This is the default task.');
+ });
+
+ desc('This task has prerequisites.');
+ task('hasPrereqs', ['foo', 'bar', 'baz'], function (params) {
+ console.log('Ran some prereqs first.');
+ });
+
+ desc('This is an asynchronous task.');
+ task('asyncTask', function () {
+ setTimeout(complete, 1000);
+ }, {async: true});
+ */
+ this.task = function (name, prereqs, action, opts) {
+ var args = Array.prototype.slice.call(arguments)
+ , type
+ , createdTask;
+ args.unshift('task');
+ createdTask = jake.createTask.apply(global, args);
+ jake.currentTaskDescription = null;
+ return createdTask;
+ };
+
+ /**
+ @name directory
+ @static
+ @function
+ @description Creates a Jake DirectoryTask. Can be used as a prerequisite
+ for FileTasks, or for simply ensuring a directory exists for use with a
+ Task's action.
+ `
+ @param {String} name The name of the DiretoryTask
+
+ @example
+
+ // Creates the package directory for distribution
+ directory('pkg');
+ */
+ this.directory = function (name) {
+ var args = Array.prototype.slice.call(arguments)
+ , createdTask;
+ args.unshift('directory');
+ createdTask = jake.createTask.apply(global, args);
+ jake.currentTaskDescription = null;
+ return createdTask;
+ };
+
+ /**
+ @name file
+ @static
+ @function
+ @description Creates a Jake FileTask.
+ `
+ @param {String} name The name of the FileTask
+ @param {Array} [prereqs] Prerequisites to be run before this task
+ @param {Function} [action] The action to create this file, if it doesn't
+ exist already.
+ @param {Object} [opts]
+ @param {Array} [opts.asyc=false] Perform this task asynchronously.
+ If you flag a task with this option, you must call the global
+ `complete` method inside the task's action, for execution to proceed
+ to the next task.
+
+ */
+ this.file = function (name, prereqs, action, opts) {
+ var args = Array.prototype.slice.call(arguments)
+ , createdTask;
+ args.unshift('file');
+ createdTask = jake.createTask.apply(global, args);
+ jake.currentTaskDescription = null;
+ return createdTask;
+ };
+
+ /**
+ @name desc
+ @static
+ @function
+ @description Creates a description for a Jake Task (or FileTask,
+ DirectoryTask). When invoked, the description that iscreated will
+ be associated with whatever Task is created next.
+ `
+ @param {String} description The description for the Task
+ */
+ this.desc = function (description) {
+ jake.currentTaskDescription = description;
+ };
+
+ /**
+ @name namespace
+ @static
+ @function
+ @description Creates a namespace which allows logical grouping
+ of tasks, and prevents name-collisions with task-names. Namespaces
+ can be nested inside of other namespaces.
+ `
+ @param {String} name The name of the namespace
+ @param {Function} scope The enclosing scope for the namespaced tasks
+
+ @example
+ namespace('doc', function () {
+ task('generate', ['doc:clobber'], function () {
+ // Generate some docs
+ });
+
+ task('clobber', function () {
+ // Clobber the doc directory first
+ });
+ });
+ */
+ this.namespace = function (name, scope) {
+ var curr = jake.currentNamespace
+ , ns = curr.childNamespaces[name] || new jake.Namespace(name, curr);
+ curr.childNamespaces[name] = ns;
+ jake.currentNamespace = ns;
+ scope();
+ jake.currentNamespace = curr;
+ jake.currentTaskDescription = null;
+ return ns;
+ };
+
+ /**
+ @name complete
+ @static
+ @function
+ @description Complets an asynchronous task, allowing Jake's
+ execution to proceed to the next task
+ `
+ @example
+ task('generate', ['doc:clobber'], function () {
+ exec('./generate_docs.sh', function (err, stdout, stderr) {
+ if (err || stderr) {
+ fail(err || stderr);
+ }
+ else {
+ console.log(stdout);
+ complete();
+ }
+ });
+ }, {async: true});
+ */
+ this.complete = function () {
+ var current = jake._invocationChain.pop();
+ if (current) {
+ current.complete();
+ }
+ };
+
+ /**
+ @name fail
+ @static
+ @function
+ @description Causes Jake execution to abort with an error.
+ Allows passing an optional error code, which will be used to
+ set the exit-code of exiting process.
+ `
+ @param {Error|String} err The error to thow when aborting execution.
+ If this argument is an Error object, it will simply be thrown. If
+ a String, it will be used as the error-message. (If it is a multi-line
+ String, the first line will be used as the Error message, and the
+ remaining lines will be used as the error-stack.)
+
+ @example
+ task('createTests, function () {
+ if (!fs.existsSync('./tests')) {
+ fail('Test directory does not exist.');
+ }
+ else {
+ // Do some testing stuff ...
+ }
+ });
+ */
+ this.fail = function (err, code) {
+ var msg
+ , errObj;
+ if (code) {
+ jake.errorCode = code;
+ }
+ if (err) {
+ if (typeof err == 'string') {
+ // Use the initial or only line of the error as the error-message
+ // If there was a multi-line error, use the rest as the stack
+ msg = err.split('/n');
+ errObj = new Error(msg.shift());
+ if (msg.length) {
+ errObj.stack = msg.join('\n');
+ }
+ throw errObj;
+ }
+ else if (err instanceof Error) {
+ throw err;
+ }
+ else {
+ throw new Error(err.toString());
+ }
+ }
+ else {
+ throw new Error();
+ }
+ };
+
+})();
+
+module.exports = api;
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/lib/file_list.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/lib/file_list.js b/blackberry10/node_modules/jake/lib/file_list.js
new file mode 100644
index 0000000..6bf8401
--- /dev/null
+++ b/blackberry10/node_modules/jake/lib/file_list.js
@@ -0,0 +1,287 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+var fs = require('fs')
+, path = require('path')
+, minimatch = require('minimatch')
+, utils = require('utilities')
+, globSync;
+
+globSync = function (pat) {
+ var dirname = jake.basedir(pat)
+ , files = jake.readdirR(dirname)
+ , matches;
+ pat = path.normalize(pat);
+ // Hack, Minimatch doesn't support backslashes in the pattern
+ // https://github.com/isaacs/minimatch/issues/7
+ pat = pat.replace(/\\/g, '/');
+ matches = minimatch.match(files, pat, {});
+ return matches;
+};
+
+// Constants
+// ---------------
+// List of all the builtin Array methods we want to override
+var ARRAY_METHODS = Object.getOwnPropertyNames(Array.prototype)
+// Array methods that return a copy instead of affecting the original
+ , SPECIAL_RETURN = {
+ 'concat': true
+ , 'slice': true
+ , 'filter': true
+ , 'map': true
+ }
+// Default file-patterns we want to ignore
+ , DEFAULT_IGNORE_PATTERNS = [
+ /(^|[\/\\])CVS([\/\\]|$)/
+ , /(^|[\/\\])\.svn([\/\\]|$)/
+ , /(^|[\/\\])\.git([\/\\]|$)/
+ , /\.bak$/
+ , /~$/
+ ]
+// Ignore core files
+ , DEFAULT_IGNORE_FUNCS = [
+ function (name) {
+ var isDir = false
+ , stats;
+ try {
+ stats = fs.statSync(name);
+ isDir = stats.isDirectory();
+ }
+ catch(e) {}
+ return (/(^|[\/\\])core$/).test(name) && !isDir;
+ }
+ ];
+
+var FileList = function () {
+ var self = this
+ , wrap;
+
+ // List of glob-patterns or specific filenames
+ this.pendingAdd = [];
+ // Switched to false after lazy-eval of files
+ this.pending = true;
+ // Used to calculate exclusions from the list of files
+ this.excludes = {
+ pats: DEFAULT_IGNORE_PATTERNS.slice()
+ , funcs: DEFAULT_IGNORE_FUNCS.slice()
+ , regex: null
+ };
+ this.items = [];
+
+ // Wrap the array methods with the delegates
+ wrap = function (prop) {
+ var arr;
+ self[prop] = function () {
+ if (self.pending) {
+ self.resolve();
+ }
+ if (typeof self.items[prop] == 'function') {
+ // Special method that return a copy
+ if (SPECIAL_RETURN[prop]) {
+ arr = self.items[prop].apply(self.items, arguments);
+ return FileList.clone(self, arr);
+ }
+ else {
+ return self.items[prop].apply(self.items, arguments);
+ }
+ }
+ else {
+ return self.items[prop];
+ }
+ };
+ };
+ for (var i = 0, ii = ARRAY_METHODS.length; i < ii; i++) {
+ wrap(ARRAY_METHODS[i]);
+ }
+
+ // Include whatever files got passed to the constructor
+ this.include.apply(this, arguments);
+
+ // Fix constructor linkage
+ this.constructor = FileList;
+};
+
+FileList.prototype = new (function () {
+ var globPattern = /[*?\[\{]/;
+
+ var _addMatching = function (pat) {
+ var matches = globSync(pat);
+ this.items = this.items.concat(matches);
+ }
+
+ , _resolveAdd = function (name) {
+ if (globPattern.test(name)) {
+ _addMatching.call(this, name);
+ }
+ else {
+ this.push(name);
+ }
+ }
+
+ , _calculateExcludeRe = function () {
+ var pats = this.excludes.pats
+ , pat
+ , excl = []
+ , matches = [];
+
+ for (var i = 0, ii = pats.length; i < ii; i++) {
+ pat = pats[i];
+ if (typeof pat == 'string') {
+ // Glob, look up files
+ if (/[*?]/.test(pat)) {
+ matches = globSync(pat);
+ matches = matches.map(function (m) {
+ return utils.string.escapeRegExpChars(m);
+ });
+ excl = excl.concat(matches);
+ }
+ // String for regex
+ else {
+ excl.push(utils.string.escapeRegExpChars(pat));
+ }
+ }
+ // Regex, grab the string-representation
+ else if (pat instanceof RegExp) {
+ excl.push(pat.toString().replace(/^\/|\/$/g, ''));
+ }
+ }
+ if (excl.length) {
+ this.excludes.regex = new RegExp('(' + excl.join(')|(') + ')');
+ }
+ else {
+ this.excludes.regex = /^$/;
+ }
+ }
+
+ , _resolveExclude = function () {
+ var self = this;
+ _calculateExcludeRe.call(this);
+ // No `reject` method, so use reverse-filter
+ this.items = this.items.filter(function (name) {
+ return !self.shouldExclude(name);
+ });
+ }
+
+ /**
+ * Includes file-patterns in the FileList. Should be called with one or more
+ * pattern for finding file to include in the list. Arguments should be strings
+ * for either a glob-pattern or a specific file-name, or an array of them
+ */
+ this.include = function () {
+ var args = Array.isArray(arguments[0]) ? arguments[0] : arguments;
+ for (var i = 0, ii = args.length; i < ii; i++) {
+ this.pendingAdd.push(args[i]);
+ }
+ return this;
+ };
+
+ /**
+ * Indicates whether a particular file would be filtered out by the current
+ * exclusion rules for this FileList.
+ * @param {String} name The filename to check
+ * @return {Boolean} Whether or not the file should be excluded
+ */
+ this.shouldExclude = function (name) {
+ if (!this.excludes.regex) {
+ _calculateExcludeRe.call(this);
+ }
+ var excl = this.excludes;
+ return excl.regex.test(name) || excl.funcs.some(function (f) {
+ return !!f(name);
+ });
+ };
+
+ /**
+ * Excludes file-patterns from the FileList. Should be called with one or more
+ * pattern for finding file to include in the list. Arguments can be:
+ * 1. Strings for either a glob-pattern or a specific file-name
+ * 2. Regular expression literals
+ * 3. Functions to be run on the filename that return a true/false
+ */
+ this.exclude = function () {
+ var args = Array.isArray(arguments[0]) ? arguments[0] : arguments
+ , arg;
+ for (var i = 0, ii = args.length; i < ii; i++) {
+ arg = args[i];
+ if (typeof arg == 'function' && !(arg instanceof RegExp)) {
+ this.excludes.funcs.push(arg);
+ }
+ else {
+ this.excludes.pats.push(arg);
+ }
+ }
+ if (!this.pending) {
+ _resolveExclude.call(this);
+ }
+ return this;
+ };
+
+ /**
+ * Populates the FileList from the include/exclude rules with a list of
+ * actual files
+ */
+ this.resolve = function () {
+ var name;
+ if (this.pending) {
+ this.pending = false;
+ while ((name = this.pendingAdd.shift())) {
+ _resolveAdd.call(this, name);
+ }
+ _resolveExclude.call(this);
+ }
+ return this;
+ };
+
+ /**
+ * Convert to a plain-jane array
+ */
+ this.toArray = function () {
+ // Call slice to ensure lazy-resolution before slicing items
+ var ret = this.slice().items.slice();
+ return ret;
+ };
+
+ /**
+ * Get rid of any current exclusion rules
+ */
+ this.clearExclude = function () {
+ this.excludes = {
+ pats: []
+ , funcs: []
+ , regex: null
+ };
+ return this;
+ };
+
+})();
+
+// Static method, used to create copy returned by special
+// array methods
+FileList.clone = function (list, items) {
+ var clone = new FileList();
+ if (items) {
+ clone.items = items;
+ }
+ clone.pendingAdd = list.pendingAdd;
+ clone.pending = list.pending;
+ for (var p in list.excludes) {
+ clone.excludes[p] = list.excludes[p];
+ }
+ return clone;
+};
+
+exports.FileList = FileList;
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/lib/jake.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/lib/jake.js b/blackberry10/node_modules/jake/lib/jake.js
new file mode 100644
index 0000000..e271342
--- /dev/null
+++ b/blackberry10/node_modules/jake/lib/jake.js
@@ -0,0 +1,280 @@
+/*
+ * Jake JavaScript build tool
+ * Copyright 2112 Matthew Eernisse (mde@fleegix.org)
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+*/
+
+var jake
+ , EventEmitter = require('events').EventEmitter
+ , fs = require('fs')
+ , path = require('path')
+ , taskNs = require('./task')
+ , Task = taskNs.Task
+ , FileTask = taskNs.FileTask
+ , DirectoryTask = taskNs.DirectoryTask
+ , api = require('./api')
+ , utils = require('./utils')
+ , Program = require('./program').Program
+ , Loader = require('./loader').Loader
+ , pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json').toString());
+
+var Namespace = function (name, parentNamespace) {
+ this.name = name;
+ this.parentNamespace = parentNamespace;
+ this.childNamespaces = {};
+ this.tasks = {};
+
+ this.resolve = function(relativeName) {
+ var parts = relativeName.split(':')
+ , name = parts.pop()
+ , ns = this
+ , task;
+ for(var i = 0, l = parts.length; ns && i < l; i++) {
+ ns = ns.childNamespaces[parts[i]];
+ }
+
+ return (ns && ns.tasks[name]) ||
+ (this.parentNamespace && this.parentNamespace.resolve(relativeName));
+ }
+
+};
+
+var Invocation = function (taskName, args) {
+ this.taskName = taskName;
+ this.args = args;
+};
+
+// And so it begins
+jake = new EventEmitter();
+
+// Globalize jake and top-level API methods (e.g., `task`, `desc`)
+global.jake = jake;
+utils.mixin(global, api);
+
+// Copy utils onto base jake
+utils.mixin(jake, utils);
+// File utils should be aliased directly on base jake as well
+utils.mixin(jake, utils.file);
+
+utils.mixin(jake, new (function () {
+
+ this._invocationChain = [];
+
+ // Private variables
+ // =================
+ // Local reference for scopage
+ var self = this;
+
+ // Public properties
+ // =================
+ this.version = pkg.version;
+ // Used when Jake exits with a specific error-code
+ this.errorCode = undefined;
+ // Loads Jakefiles/jakelibdirs
+ this.loader = new Loader();
+ // Name/value map of all the various tasks defined in a Jakefile.
+ // Non-namespaced tasks are placed into 'default.'
+ this.defaultNamespace = new Namespace('default', null);
+ // For namespaced tasks -- tasks with no namespace are put into the
+ // 'default' namespace so lookup code can work the same for both
+ // namespaced and non-namespaced.
+ this.currentNamespace = this.defaultNamespace;
+ // Saves the description created by a 'desc' call that prefaces a
+ // 'task' call that defines a task.
+ this.currentTaskDescription = null;
+ this.program = new Program()
+ this.FileList = require('./file_list').FileList;
+ this.PackageTask = require('./package_task').PackageTask;
+ this.NpmPublishTask = require('./npm_publish_task').NpmPublishTask;
+ this.TestTask = require('./test_task').TestTask;
+ this.Task = Task;
+ this.FileTask = FileTask;
+ this.DirectoryTask = DirectoryTask;
+ this.Namespace = Namespace;
+
+ this.parseAllTasks = function () {
+ var _parseNs = function (name, ns) {
+ var nsTasks = ns.tasks
+ , task
+ , nsNamespaces = ns.childNamespaces
+ , fullName;
+ // Iterate through the tasks in each namespace
+ for (var q in nsTasks) {
+ task = nsTasks[q];
+ // Preface only the namespaced tasks
+ fullName = name == 'default' ? q : name + ':' + q;
+ // Save with 'taskname' or 'namespace:taskname' key
+ task.fullName = fullName;
+ jake.Task[fullName] = task;
+ }
+ for (var p in nsNamespaces) {
+ fullName = name == 'default' ? p : name + ':' + p;
+ _parseNs(fullName, nsNamespaces[p]);
+ }
+ };
+
+ _parseNs('default', jake.defaultNamespace);
+ };
+
+ /**
+ * Displays the list of descriptions avaliable for tasks defined in
+ * a Jakefile
+ */
+ this.showAllTaskDescriptions = function (f) {
+ var maxTaskNameLength = 0
+ , task
+ , str = ''
+ , padding
+ , name
+ , descr
+ , filter = typeof f == 'string' ? f : null;
+
+ for (var p in jake.Task) {
+ task = jake.Task[p];
+ // Record the length of the longest task name -- used for
+ // pretty alignment of the task descriptions
+ maxTaskNameLength = p.length > maxTaskNameLength ?
+ p.length : maxTaskNameLength;
+ }
+ // Print out each entry with descriptions neatly aligned
+ for (var p in jake.Task) {
+ if (filter && p.indexOf(filter) == -1) {
+ continue;
+ }
+ task = jake.Task[p];
+
+ name = '\033[32m' + p + '\033[39m ';
+
+ // Create padding-string with calculated length
+ padding = (new Array(maxTaskNameLength - p.length + 2)).join(' ');
+
+ descr = task.description
+ if (descr) {
+ descr = '\033[90m # ' + descr + '\033[39m \033[37m \033[39m';
+ console.log('jake ' + name + padding + descr);
+ }
+ }
+ };
+
+ this.createTask = function () {
+ var args = Array.prototype.slice.call(arguments)
+ , arg
+ , task
+ , type
+ , name
+ , action
+ , opts = {}
+ , prereqs = [];
+
+ type = args.shift()
+
+ // name, [deps], [action]
+ // Name (string) + deps (array) format
+ if (typeof args[0] == 'string') {
+ name = args.shift();
+ if (Array.isArray(args[0])) {
+ prereqs = args.shift();
+ }
+ }
+ // name:deps, [action]
+ // Legacy object-literal syntax, e.g.: {'name': ['depA', 'depB']}
+ else {
+ obj = args.shift()
+ for (var p in obj) {
+ prereqs = prereqs.concat(obj[p]);
+ name = p;
+ }
+ }
+
+ // Optional opts/callback or callback/opts
+ while ((arg = args.shift())) {
+ if (typeof arg == 'function') {
+ action = arg;
+ }
+ else {
+ opts = arg;
+ }
+ }
+
+ task = jake.currentNamespace.resolve(name);
+ if (task && !action) {
+ // Task already exists and no action, just update prereqs, and return it.
+ task.prereqs = task.prereqs.concat(prereqs);
+ return task;
+ }
+
+ switch (type) {
+ case 'directory':
+ action = function () {
+ jake.mkdirP(name);
+ };
+ task = new DirectoryTask(name, prereqs, action, opts);
+ break;
+ case 'file':
+ task = new FileTask(name, prereqs, action, opts);
+ break;
+ default:
+ task = new Task(name, prereqs, action, opts);
+ }
+
+ if (jake.currentTaskDescription) {
+ task.description = jake.currentTaskDescription;
+ jake.currentTaskDescription = null;
+ }
+ jake.currentNamespace.tasks[name] = task;
+ task.namespace = jake.currentNamespace;
+
+ // FIXME: Should only need to add a new entry for the current
+ // task-definition, not reparse the entire structure
+ jake.parseAllTasks();
+
+ return task;
+ };
+
+ this.init = function () {
+ var self = this;
+ process.addListener('uncaughtException', function (err) {
+ self.program.handleErr(err);
+ });
+
+ };
+
+ this.run = function () {
+ var args = Array.prototype.slice.call(arguments)
+ , program = this.program
+ , loader = this.loader
+ , preempt
+ , opts;
+
+ program.parseArgs(args);
+ program.init();
+
+ preempt = program.firstPreemptiveOption();
+ if (preempt) {
+ preempt();
+ }
+ else {
+ opts = program.opts;
+ // Load Jakefile and jakelibdir files
+ loader.loadFile(opts.jakefile);
+ loader.loadDirectory(opts.jakelibdir);
+
+ program.run();
+ }
+ };
+
+})());
+
+module.exports = jake;