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:50 UTC
[36/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/jake/node_modules/minimatch/test/basic.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/minimatch/test/basic.js b/blackberry10/node_modules/jake/node_modules/minimatch/test/basic.js
new file mode 100644
index 0000000..ae7ac73
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/minimatch/test/basic.js
@@ -0,0 +1,399 @@
+// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
+//
+// TODO: Some of these tests do very bad things with backslashes, and will
+// most likely fail badly on windows. They should probably be skipped.
+
+var tap = require("tap")
+ , globalBefore = Object.keys(global)
+ , mm = require("../")
+ , files = [ "a", "b", "c", "d", "abc"
+ , "abd", "abe", "bb", "bcd"
+ , "ca", "cb", "dd", "de"
+ , "bdir/", "bdir/cfile"]
+ , next = files.concat([ "a-b", "aXb"
+ , ".x", ".y" ])
+
+
+var patterns =
+ [ "http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test"
+ , ["a*", ["a", "abc", "abd", "abe"]]
+ , ["X*", ["X*"], {nonull: true}]
+
+ // allow null glob expansion
+ , ["X*", []]
+
+ // isaacs: Slightly different than bash/sh/ksh
+ // \\* is not un-escaped to literal "*" in a failed match,
+ // but it does make it get treated as a literal star
+ , ["\\*", ["\\*"], {nonull: true}]
+ , ["\\**", ["\\**"], {nonull: true}]
+ , ["\\*\\*", ["\\*\\*"], {nonull: true}]
+
+ , ["b*/", ["bdir/"]]
+ , ["c*", ["c", "ca", "cb"]]
+ , ["**", files]
+
+ , ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
+ , ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
+
+ , "legendary larry crashes bashes"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
+
+ , "character classes"
+ , ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
+ , ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
+ "bdir/", "ca", "cb", "dd", "de"]]
+ , ["a*[^c]", ["abd", "abe"]]
+ , function () { files.push("a-b", "aXb") }
+ , ["a[X-]b", ["a-b", "aXb"]]
+ , function () { files.push(".x", ".y") }
+ , ["[^a-c]*", ["d", "dd", "de"]]
+ , function () { files.push("a*b/", "a*b/ooo") }
+ , ["a\\*b/*", ["a*b/ooo"]]
+ , ["a\\*?/*", ["a*b/ooo"]]
+ , ["*\\\\!*", [], {null: true}, ["echo !7"]]
+ , ["*\\!*", ["echo !7"], null, ["echo !7"]]
+ , ["*.\\*", ["r.*"], null, ["r.*"]]
+ , ["a[b]c", ["abc"]]
+ , ["a[\\b]c", ["abc"]]
+ , ["a?c", ["abc"]]
+ , ["a\\*c", [], {null: true}, ["abc"]]
+ , ["", [""], { null: true }, [""]]
+
+ , "http://www.opensource.apple.com/source/bash/bash-23/" +
+ "bash/tests/glob-test"
+ , function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
+ , ["*/man*/bash.*", ["man/man1/bash.1"]]
+ , ["man/man1/bash.1", ["man/man1/bash.1"]]
+ , ["a***c", ["abc"], null, ["abc"]]
+ , ["a*****?c", ["abc"], null, ["abc"]]
+ , ["?*****??", ["abc"], null, ["abc"]]
+ , ["*****??", ["abc"], null, ["abc"]]
+ , ["?*****?c", ["abc"], null, ["abc"]]
+ , ["?***?****c", ["abc"], null, ["abc"]]
+ , ["?***?****?", ["abc"], null, ["abc"]]
+ , ["?***?****", ["abc"], null, ["abc"]]
+ , ["*******c", ["abc"], null, ["abc"]]
+ , ["*******?", ["abc"], null, ["abc"]]
+ , ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["[-abc]", ["-"], null, ["-"]]
+ , ["[abc-]", ["-"], null, ["-"]]
+ , ["\\", ["\\"], null, ["\\"]]
+ , ["[\\\\]", ["\\"], null, ["\\"]]
+ , ["[[]", ["["], null, ["["]]
+ , ["[", ["["], null, ["["]]
+ , ["[*", ["[abc"], null, ["[abc"]]
+ , "a right bracket shall lose its special meaning and\n" +
+ "represent itself in a bracket expression if it occurs\n" +
+ "first in the list. -- POSIX.2 2.8.3.2"
+ , ["[]]", ["]"], null, ["]"]]
+ , ["[]-]", ["]"], null, ["]"]]
+ , ["[a-\z]", ["p"], null, ["p"]]
+ , ["??**********?****?", [], { null: true }, ["abc"]]
+ , ["??**********?****c", [], { null: true }, ["abc"]]
+ , ["?************c****?****", [], { null: true }, ["abc"]]
+ , ["*c*?**", [], { null: true }, ["abc"]]
+ , ["a*****c*?**", [], { null: true }, ["abc"]]
+ , ["a********???*******", [], { null: true }, ["abc"]]
+ , ["[]", [], { null: true }, ["a"]]
+ , ["[abc", [], { null: true }, ["["]]
+
+ , "nocase tests"
+ , ["XYZ", ["xYz"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+ , ["ab*", ["ABC"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+ , ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+
+ // [ pattern, [matches], MM opts, files, TAP opts]
+ , "onestar/twostar"
+ , ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
+ , ["{/?,*}", ["/a", "bb"], {null: true}
+ , ["/a", "/b/b", "/a/b/c", "bb"]]
+
+ , "dots should not match unless requested"
+ , ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
+
+ // .. and . can only match patterns starting with .,
+ // even when options.dot is set.
+ , function () {
+ files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
+ }
+ , ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
+ , ["a/*/b", ["a/c/b"], {dot:false}]
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
+
+
+ // this also tests that changing the options needs
+ // to change the cache key, even if the pattern is
+ // the same!
+ , ["**", ["a/b","a/.d",".a/.d"], { dot: true }
+ , [ ".a/.d", "a/.d", "a/b"]]
+
+ , "paren sets cannot contain slashes"
+ , ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
+
+ // brace sets trump all else.
+ //
+ // invalid glob pattern. fails on bash4 and bsdglob.
+ // however, in this implementation, it's easier just
+ // to do the intuitive thing, and let brace-expansion
+ // actually come before parsing any extglob patterns,
+ // like the documentation seems to say.
+ //
+ // XXX: if anyone complains about this, either fix it
+ // or tell them to grow up and stop complaining.
+ //
+ // bash/bsdglob says this:
+ // , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
+ // but we do this instead:
+ , ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
+
+ // test partial parsing in the presence of comment/negation chars
+ , ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
+ , ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
+
+ // like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
+ , ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
+ , {}
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
+
+
+ // crazy nested {,,} and *(||) tests.
+ , function () {
+ files = [ "a", "b", "c", "d"
+ , "ab", "ac", "ad"
+ , "bc", "cb"
+ , "bc,d", "c,db", "c,d"
+ , "d)", "(b|c", "*(b|c"
+ , "b|c", "b|cc", "cb|c"
+ , "x(a|b|c)", "x(a|c)"
+ , "(a|b|c)", "(a|c)"]
+ }
+ , ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
+ , ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
+ // a
+ // *(b|c)
+ // *(b|d)
+ , ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
+ , ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
+
+
+ // test various flag settings.
+ , [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
+ , { noext: true } ]
+ , ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
+ , ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
+ , ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
+
+
+ // begin channelling Boole and deMorgan...
+ , "negation tests"
+ , function () {
+ files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
+ }
+
+ // anything that is NOT a* matches.
+ , ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
+
+ // anything that IS !a* matches.
+ , ["!a*", ["!ab", "!abc"], {nonegate: true}]
+
+ // anything that IS a* matches
+ , ["!!a*", ["a!b"]]
+
+ // anything that is NOT !a* matches
+ , ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
+
+ // negation nestled within a pattern
+ , function () {
+ files = [ "foo.js"
+ , "foo.bar"
+ // can't match this one without negative lookbehind.
+ , "foo.js.js"
+ , "blar.js"
+ , "foo."
+ , "boo.js.boo" ]
+ }
+ , ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
+
+ // https://github.com/isaacs/minimatch/issues/5
+ , function () {
+ files = [ 'a/b/.x/c'
+ , 'a/b/.x/c/d'
+ , 'a/b/.x/c/d/e'
+ , 'a/b/.x'
+ , 'a/b/.x/'
+ , 'a/.x/b'
+ , '.x'
+ , '.x/'
+ , '.x/a'
+ , '.x/a/b'
+ , 'a/.x/b/.x/c'
+ , '.x/.x' ]
+ }
+ , ["**/.x/**", [ '.x/'
+ , '.x/a'
+ , '.x/a/b'
+ , 'a/.x/b'
+ , 'a/b/.x/'
+ , 'a/b/.x/c'
+ , 'a/b/.x/c/d'
+ , 'a/b/.x/c/d/e' ] ]
+
+ ]
+
+var regexps =
+ [ '/^(?:(?=.)a[^/]*?)$/',
+ '/^(?:(?=.)X[^/]*?)$/',
+ '/^(?:(?=.)X[^/]*?)$/',
+ '/^(?:\\*)$/',
+ '/^(?:(?=.)\\*[^/]*?)$/',
+ '/^(?:\\*\\*)$/',
+ '/^(?:(?=.)b[^/]*?\\/)$/',
+ '/^(?:(?=.)c[^/]*?)$/',
+ '/^(?:(?:(?!(?:\\/|^)\\.).)*?)$/',
+ '/^(?:\\.\\.\\/(?!\\.)(?=.)[^/]*?\\/)$/',
+ '/^(?:s\\/(?=.)\\.\\.[^/]*?\\/)$/',
+ '/^(?:\\/\\^root:\\/\\{s\\/(?=.)\\^[^:][^/]*?:[^:][^/]*?:\\([^:]\\)[^/]*?\\.[^/]*?\\$\\/1\\/)$/',
+ '/^(?:\\/\\^root:\\/\\{s\\/(?=.)\\^[^:][^/]*?:[^:][^/]*?:\\([^:]\\)[^/]*?\\.[^/]*?\\$\\/\u0001\\/)$/',
+ '/^(?:(?!\\.)(?=.)[a-c]b[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[a-y][^/]*?[^c])$/',
+ '/^(?:(?=.)a[^/]*?[^c])$/',
+ '/^(?:(?=.)a[X-]b)$/',
+ '/^(?:(?!\\.)(?=.)[^a-c][^/]*?)$/',
+ '/^(?:a\\*b\\/(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?=.)a\\*[^/]\\/(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\\\\\![^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\![^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\.\\*)$/',
+ '/^(?:(?=.)a[b]c)$/',
+ '/^(?:(?=.)a[b]c)$/',
+ '/^(?:(?=.)a[^/]c)$/',
+ '/^(?:a\\*c)$/',
+ 'false',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\/(?=.)man[^/]*?\\/(?=.)bash\\.[^/]*?)$/',
+ '/^(?:man\\/man1\\/bash\\.1)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/])$/',
+ '/^(?:(?=.)a[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/]k)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/]k)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/]k[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/][^/]*?[^/]*?[^/]*?k)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/][^/]*?[^/]*?cd[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/][^/]*?[^/]*?[^/]*?k[^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?c[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[-abc])$/',
+ '/^(?:(?!\\.)(?=.)[abc-])$/',
+ '/^(?:\\\\)$/',
+ '/^(?:(?!\\.)(?=.)[\\\\])$/',
+ '/^(?:(?!\\.)(?=.)[\\[])$/',
+ '/^(?:\\[)$/',
+ '/^(?:(?=.)\\[(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[\\]])$/',
+ '/^(?:(?!\\.)(?=.)[\\]-])$/',
+ '/^(?:(?!\\.)(?=.)[a-z])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/])$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?c)$/',
+ '/^(?:(?!\\.)(?=.)[^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?c[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?c[^/]*?[^/][^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?c[^/]*?[^/][^/]*?[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/][^/][^/][^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?[^/]*?)$/',
+ '/^(?:\\[\\])$/',
+ '/^(?:\\[abc)$/',
+ '/^(?:(?=.)XYZ)$/i',
+ '/^(?:(?=.)ab[^/]*?)$/i',
+ '/^(?:(?!\\.)(?=.)[ia][^/][ck])$/i',
+ '/^(?:\\/(?!\\.)(?=.)[^/]*?|(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:\\/(?!\\.)(?=.)[^/]|(?!\\.)(?=.)[^/]*?)$/',
+ '/^(?:(?:(?!(?:\\/|^)\\.).)*?)$/',
+ '/^(?:a\\/(?!(?:^|\\/)\\.{1,2}(?:$|\\/))(?=.)[^/]*?\\/b)$/',
+ '/^(?:a\\/(?=.)\\.[^/]*?\\/b)$/',
+ '/^(?:a\\/(?!\\.)(?=.)[^/]*?\\/b)$/',
+ '/^(?:a\\/(?=.)\\.[^/]*?\\/b)$/',
+ '/^(?:(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\(a\\/b\\))$/',
+ '/^(?:(?!\\.)(?=.)(?:a|b)*|(?!\\.)(?=.)(?:a|c)*)$/',
+ '/^(?:(?=.)\\[(?=.)\\!a[^/]*?)$/',
+ '/^(?:(?=.)\\[(?=.)#a[^/]*?)$/',
+ '/^(?:(?=.)\\+\\(a\\|[^/]*?\\|c\\\\\\\\\\|d\\\\\\\\\\|e\\\\\\\\\\\\\\\\\\|f\\\\\\\\\\\\\\\\\\|g)$/',
+ '/^(?:(?!\\.)(?=.)(?:a|b)*|(?!\\.)(?=.)(?:a|c)*)$/',
+ '/^(?:a|(?!\\.)(?=.)[^/]*?\\(b\\|c|d\\))$/',
+ '/^(?:a|(?!\\.)(?=.)(?:b|c)*|(?!\\.)(?=.)(?:b|d)*)$/',
+ '/^(?:(?!\\.)(?=.)(?:a|b|c)*|(?!\\.)(?=.)(?:a|c)*)$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\(a\\|b\\|c\\)|(?!\\.)(?=.)[^/]*?\\(a\\|c\\))$/',
+ '/^(?:(?=.)a[^/]b)$/',
+ '/^(?:(?=.)#[^/]*?)$/',
+ '/^(?!^(?:(?=.)a[^/]*?)$).*$/',
+ '/^(?:(?=.)\\!a[^/]*?)$/',
+ '/^(?:(?=.)a[^/]*?)$/',
+ '/^(?!^(?:(?=.)\\!a[^/]*?)$).*$/',
+ '/^(?:(?!\\.)(?=.)[^/]*?\\.(?:(?!js)[^/]*?))$/',
+ '/^(?:(?:(?!(?:\\/|^)\\.).)*?\\/\\.x\\/(?:(?!(?:\\/|^)\\.).)*?)$/' ]
+var re = 0;
+
+tap.test("basic tests", function (t) {
+ var start = Date.now()
+
+ // [ pattern, [matches], MM opts, files, TAP opts]
+ patterns.forEach(function (c) {
+ if (typeof c === "function") return c()
+ if (typeof c === "string") return t.comment(c)
+
+ var pattern = c[0]
+ , expect = c[1].sort(alpha)
+ , options = c[2] || {}
+ , f = c[3] || files
+ , tapOpts = c[4] || {}
+
+ // options.debug = true
+ var m = new mm.Minimatch(pattern, options)
+ var r = m.makeRe()
+ var expectRe = regexps[re++]
+ tapOpts.re = String(r) || JSON.stringify(r)
+ tapOpts.files = JSON.stringify(f)
+ tapOpts.pattern = pattern
+ tapOpts.set = m.set
+ tapOpts.negated = m.negate
+
+ var actual = mm.match(f, pattern, options)
+ actual.sort(alpha)
+
+ t.equivalent( actual, expect
+ , JSON.stringify(pattern) + " " + JSON.stringify(expect)
+ , tapOpts )
+
+ t.equal(tapOpts.re, expectRe, tapOpts)
+ })
+
+ t.comment("time=" + (Date.now() - start) + "ms")
+ t.end()
+})
+
+tap.test("global leak test", function (t) {
+ var globalAfter = Object.keys(global)
+ t.equivalent(globalAfter, globalBefore, "no new globals, please")
+ t.end()
+})
+
+function alpha (a, b) {
+ return a > b ? 1 : -1
+}
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/minimatch/test/brace-expand.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/minimatch/test/brace-expand.js b/blackberry10/node_modules/jake/node_modules/minimatch/test/brace-expand.js
new file mode 100644
index 0000000..7ee278a
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/minimatch/test/brace-expand.js
@@ -0,0 +1,33 @@
+var tap = require("tap")
+ , minimatch = require("../")
+
+tap.test("brace expansion", function (t) {
+ // [ pattern, [expanded] ]
+ ; [ [ "a{b,c{d,e},{f,g}h}x{y,z}"
+ , [ "abxy"
+ , "abxz"
+ , "acdxy"
+ , "acdxz"
+ , "acexy"
+ , "acexz"
+ , "afhxy"
+ , "afhxz"
+ , "aghxy"
+ , "aghxz" ] ]
+ , [ "a{1..5}b"
+ , [ "a1b"
+ , "a2b"
+ , "a3b"
+ , "a4b"
+ , "a5b" ] ]
+ , [ "a{b}c", ["a{b}c"] ]
+ ].forEach(function (tc) {
+ var p = tc[0]
+ , expect = tc[1]
+ t.equivalent(minimatch.braceExpand(p), expect, p)
+ })
+ console.error("ending")
+ t.end()
+})
+
+
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/minimatch/test/caching.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/minimatch/test/caching.js b/blackberry10/node_modules/jake/node_modules/minimatch/test/caching.js
new file mode 100644
index 0000000..0fec4b0
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/minimatch/test/caching.js
@@ -0,0 +1,14 @@
+var Minimatch = require("../minimatch.js").Minimatch
+var tap = require("tap")
+tap.test("cache test", function (t) {
+ var mm1 = new Minimatch("a?b")
+ var mm2 = new Minimatch("a?b")
+ t.equal(mm1, mm2, "should get the same object")
+ // the lru should drop it after 100 entries
+ for (var i = 0; i < 100; i ++) {
+ new Minimatch("a"+i)
+ }
+ mm2 = new Minimatch("a?b")
+ t.notEqual(mm1, mm2, "cache should have dropped")
+ t.end()
+})
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/minimatch/test/defaults.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/minimatch/test/defaults.js b/blackberry10/node_modules/jake/node_modules/minimatch/test/defaults.js
new file mode 100644
index 0000000..25f1f60
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/minimatch/test/defaults.js
@@ -0,0 +1,274 @@
+// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
+//
+// TODO: Some of these tests do very bad things with backslashes, and will
+// most likely fail badly on windows. They should probably be skipped.
+
+var tap = require("tap")
+ , globalBefore = Object.keys(global)
+ , mm = require("../")
+ , files = [ "a", "b", "c", "d", "abc"
+ , "abd", "abe", "bb", "bcd"
+ , "ca", "cb", "dd", "de"
+ , "bdir/", "bdir/cfile"]
+ , next = files.concat([ "a-b", "aXb"
+ , ".x", ".y" ])
+
+tap.test("basic tests", function (t) {
+ var start = Date.now()
+
+ // [ pattern, [matches], MM opts, files, TAP opts]
+ ; [ "http://www.bashcookbook.com/bashinfo" +
+ "/source/bash-1.14.7/tests/glob-test"
+ , ["a*", ["a", "abc", "abd", "abe"]]
+ , ["X*", ["X*"], {nonull: true}]
+
+ // allow null glob expansion
+ , ["X*", []]
+
+ // isaacs: Slightly different than bash/sh/ksh
+ // \\* is not un-escaped to literal "*" in a failed match,
+ // but it does make it get treated as a literal star
+ , ["\\*", ["\\*"], {nonull: true}]
+ , ["\\**", ["\\**"], {nonull: true}]
+ , ["\\*\\*", ["\\*\\*"], {nonull: true}]
+
+ , ["b*/", ["bdir/"]]
+ , ["c*", ["c", "ca", "cb"]]
+ , ["**", files]
+
+ , ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
+ , ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
+
+ , "legendary larry crashes bashes"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
+ , ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
+
+ , "character classes"
+ , ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
+ , ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
+ "bdir/", "ca", "cb", "dd", "de"]]
+ , ["a*[^c]", ["abd", "abe"]]
+ , function () { files.push("a-b", "aXb") }
+ , ["a[X-]b", ["a-b", "aXb"]]
+ , function () { files.push(".x", ".y") }
+ , ["[^a-c]*", ["d", "dd", "de"]]
+ , function () { files.push("a*b/", "a*b/ooo") }
+ , ["a\\*b/*", ["a*b/ooo"]]
+ , ["a\\*?/*", ["a*b/ooo"]]
+ , ["*\\\\!*", [], {null: true}, ["echo !7"]]
+ , ["*\\!*", ["echo !7"], null, ["echo !7"]]
+ , ["*.\\*", ["r.*"], null, ["r.*"]]
+ , ["a[b]c", ["abc"]]
+ , ["a[\\b]c", ["abc"]]
+ , ["a?c", ["abc"]]
+ , ["a\\*c", [], {null: true}, ["abc"]]
+ , ["", [""], { null: true }, [""]]
+
+ , "http://www.opensource.apple.com/source/bash/bash-23/" +
+ "bash/tests/glob-test"
+ , function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
+ , ["*/man*/bash.*", ["man/man1/bash.1"]]
+ , ["man/man1/bash.1", ["man/man1/bash.1"]]
+ , ["a***c", ["abc"], null, ["abc"]]
+ , ["a*****?c", ["abc"], null, ["abc"]]
+ , ["?*****??", ["abc"], null, ["abc"]]
+ , ["*****??", ["abc"], null, ["abc"]]
+ , ["?*****?c", ["abc"], null, ["abc"]]
+ , ["?***?****c", ["abc"], null, ["abc"]]
+ , ["?***?****?", ["abc"], null, ["abc"]]
+ , ["?***?****", ["abc"], null, ["abc"]]
+ , ["*******c", ["abc"], null, ["abc"]]
+ , ["*******?", ["abc"], null, ["abc"]]
+ , ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
+ , ["[-abc]", ["-"], null, ["-"]]
+ , ["[abc-]", ["-"], null, ["-"]]
+ , ["\\", ["\\"], null, ["\\"]]
+ , ["[\\\\]", ["\\"], null, ["\\"]]
+ , ["[[]", ["["], null, ["["]]
+ , ["[", ["["], null, ["["]]
+ , ["[*", ["[abc"], null, ["[abc"]]
+ , "a right bracket shall lose its special meaning and\n" +
+ "represent itself in a bracket expression if it occurs\n" +
+ "first in the list. -- POSIX.2 2.8.3.2"
+ , ["[]]", ["]"], null, ["]"]]
+ , ["[]-]", ["]"], null, ["]"]]
+ , ["[a-\z]", ["p"], null, ["p"]]
+ , ["??**********?****?", [], { null: true }, ["abc"]]
+ , ["??**********?****c", [], { null: true }, ["abc"]]
+ , ["?************c****?****", [], { null: true }, ["abc"]]
+ , ["*c*?**", [], { null: true }, ["abc"]]
+ , ["a*****c*?**", [], { null: true }, ["abc"]]
+ , ["a********???*******", [], { null: true }, ["abc"]]
+ , ["[]", [], { null: true }, ["a"]]
+ , ["[abc", [], { null: true }, ["["]]
+
+ , "nocase tests"
+ , ["XYZ", ["xYz"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+ , ["ab*", ["ABC"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+ , ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
+ , ["xYz", "ABC", "IjK"]]
+
+ // [ pattern, [matches], MM opts, files, TAP opts]
+ , "onestar/twostar"
+ , ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
+ , ["{/?,*}", ["/a", "bb"], {null: true}
+ , ["/a", "/b/b", "/a/b/c", "bb"]]
+
+ , "dots should not match unless requested"
+ , ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
+
+ // .. and . can only match patterns starting with .,
+ // even when options.dot is set.
+ , function () {
+ files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
+ }
+ , ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
+ , ["a/*/b", ["a/c/b"], {dot:false}]
+ , ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
+
+
+ // this also tests that changing the options needs
+ // to change the cache key, even if the pattern is
+ // the same!
+ , ["**", ["a/b","a/.d",".a/.d"], { dot: true }
+ , [ ".a/.d", "a/.d", "a/b"]]
+
+ , "paren sets cannot contain slashes"
+ , ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
+
+ // brace sets trump all else.
+ //
+ // invalid glob pattern. fails on bash4 and bsdglob.
+ // however, in this implementation, it's easier just
+ // to do the intuitive thing, and let brace-expansion
+ // actually come before parsing any extglob patterns,
+ // like the documentation seems to say.
+ //
+ // XXX: if anyone complains about this, either fix it
+ // or tell them to grow up and stop complaining.
+ //
+ // bash/bsdglob says this:
+ // , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
+ // but we do this instead:
+ , ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
+
+ // test partial parsing in the presence of comment/negation chars
+ , ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
+ , ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
+
+ // like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
+ , ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
+ , {}
+ , ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
+
+
+ // crazy nested {,,} and *(||) tests.
+ , function () {
+ files = [ "a", "b", "c", "d"
+ , "ab", "ac", "ad"
+ , "bc", "cb"
+ , "bc,d", "c,db", "c,d"
+ , "d)", "(b|c", "*(b|c"
+ , "b|c", "b|cc", "cb|c"
+ , "x(a|b|c)", "x(a|c)"
+ , "(a|b|c)", "(a|c)"]
+ }
+ , ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
+ , ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
+ // a
+ // *(b|c)
+ // *(b|d)
+ , ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
+ , ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
+
+
+ // test various flag settings.
+ , [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
+ , { noext: true } ]
+ , ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
+ , ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
+ , ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
+
+
+ // begin channelling Boole and deMorgan...
+ , "negation tests"
+ , function () {
+ files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
+ }
+
+ // anything that is NOT a* matches.
+ , ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
+
+ // anything that IS !a* matches.
+ , ["!a*", ["!ab", "!abc"], {nonegate: true}]
+
+ // anything that IS a* matches
+ , ["!!a*", ["a!b"]]
+
+ // anything that is NOT !a* matches
+ , ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
+
+ // negation nestled within a pattern
+ , function () {
+ files = [ "foo.js"
+ , "foo.bar"
+ // can't match this one without negative lookbehind.
+ , "foo.js.js"
+ , "blar.js"
+ , "foo."
+ , "boo.js.boo" ]
+ }
+ , ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
+
+ ].forEach(function (c) {
+ if (typeof c === "function") return c()
+ if (typeof c === "string") return t.comment(c)
+
+ var pattern = c[0]
+ , expect = c[1].sort(alpha)
+ , options = c[2] || {}
+ , f = c[3] || files
+ , tapOpts = c[4] || {}
+
+ // options.debug = true
+ var Class = mm.defaults(options).Minimatch
+ var m = new Class(pattern, {})
+ var r = m.makeRe()
+ tapOpts.re = String(r) || JSON.stringify(r)
+ tapOpts.files = JSON.stringify(f)
+ tapOpts.pattern = pattern
+ tapOpts.set = m.set
+ tapOpts.negated = m.negate
+
+ var actual = mm.match(f, pattern, options)
+ actual.sort(alpha)
+
+ t.equivalent( actual, expect
+ , JSON.stringify(pattern) + " " + JSON.stringify(expect)
+ , tapOpts )
+ })
+
+ t.comment("time=" + (Date.now() - start) + "ms")
+ t.end()
+})
+
+tap.test("global leak test", function (t) {
+ var globalAfter = Object.keys(global)
+ t.equivalent(globalAfter, globalBefore, "no new globals, please")
+ t.end()
+})
+
+function alpha (a, b) {
+ return a > b ? 1 : -1
+}
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/utilities/Jakefile
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/utilities/Jakefile b/blackberry10/node_modules/jake/node_modules/utilities/Jakefile
new file mode 100644
index 0000000..1523f05
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/utilities/Jakefile
@@ -0,0 +1,37 @@
+
+var t = new jake.TestTask('Utilities', function () {
+ this.testFiles.include('test/*.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';
+ console.log('Generating docs ...');
+ jake.exec([cmd], function () {
+ console.log('Done.');
+ complete();
+ });
+ }, {async: true});
+
+ task('clobber', function () {
+ var cmd = 'rm -fr ./doc/**';
+ jake.exec([cmd], function () {
+ console.log('Clobbered old docs.');
+ complete();
+ });
+ }, {async: true});
+
+});
+
+desc('Generate docs for Utilities');
+task('doc', ['doc:generate']);
+
+var p = new jake.NpmPublishTask('utilities', [
+ 'Jakefile'
+, 'README.md'
+, 'package.json'
+, 'lib/**'
+, 'test/**'
+]);
+
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/utilities/README.md
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/utilities/README.md b/blackberry10/node_modules/jake/node_modules/utilities/README.md
new file mode 100644
index 0000000..fbbdf59
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/utilities/README.md
@@ -0,0 +1,6 @@
+utilities
+=========
+
+[![build status](https://secure.travis-ci.org/mde/utilities.png)](http://travis-ci.org/mde/utilities)
+
+A classic collection of JavaScript utilities
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/utilities/lib/array.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/utilities/lib/array.js b/blackberry10/node_modules/jake/node_modules/utilities/lib/array.js
new file mode 100644
index 0000000..836de2c
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/utilities/lib/array.js
@@ -0,0 +1,93 @@
+/*
+ * Utilities: A classic collection of JavaScript utilities
+ * 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.
+ *
+*/
+
+/**
+ @name array
+ @namespace array
+*/
+
+var array = new (function () {
+
+ /**
+ @name array#humanize
+ @public
+ @function
+ @return {String} A string containing the array elements in a readable format
+ @description Creates a string containing the array elements in a readable format
+ @param {Array} array The array to humanize
+ */
+ this.humanize = function (array) {
+ // If array only has one item then just return it
+ if (array.length <= 1) {
+ return String(array);
+ }
+
+ var last = array.pop()
+ , items = array.join(', ');
+
+ return items + ' and ' + last;
+ };
+
+ /**
+ @name array#included
+ @public
+ @function
+ @return {Array/Boolean} If `item` is included the `array` is
+ returned otherwise false
+ @description Checks if an `item` is included in an `array`
+ @param {Any} item The item to look for
+ @param {Array} array The array to check
+ */
+ this.included = function (item, array) {
+ var result = array.indexOf(item);
+
+ if (result === -1) {
+ return false;
+ } else {
+ return array;
+ }
+ };
+
+ /**
+ @name array#include
+ @public
+ @function
+ @return {Boolean} Return true if the item is included in the array
+ @description Checks if an `item` is included in an `array`
+ @param {Array} array The array to check
+ @param {Any} item The item to look for
+ */
+ this.include = function (array, item) {
+ var res = -1;
+ if (typeof array.indexOf == 'function') {
+ res = array.indexOf(item);
+ }
+ else {
+ for (var i = 0, ii = array.length; i < ii; i++) {
+ if (array[i] == item) {
+ res = i;
+ break;
+ }
+ }
+ }
+ return res > -1;
+ };
+
+})();
+
+module.exports = array;
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/utilities/lib/async.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/utilities/lib/async.js b/blackberry10/node_modules/jake/node_modules/utilities/lib/async.js
new file mode 100644
index 0000000..06a7429
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/utilities/lib/async.js
@@ -0,0 +1,291 @@
+/*
+ * Utilities: A classic collection of JavaScript utilities
+ * 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 async = {};
+
+/*
+AsyncChain -- performs a list of asynchronous calls in a desired order.
+Optional "last" method can be set to run after all the items in the
+chain have completed.
+
+ // Example usage
+ var asyncChain = new async.AsyncChain([
+ {
+ func: app.trainToBangkok,
+ args: [geddy, neil, alex],
+ callback: null, // No callback for this action
+ },
+ {
+ func: fs.readdir,
+ args: [geddy.config.dirname + '/thailand/express'],
+ callback: function (err, result) {
+ if (err) {
+ // Bail out completely
+ arguments.callee.chain.abort();
+ }
+ else if (result.theBest) {
+ // Don't run the next item in the chain; go directly
+ // to the 'last' method.
+ arguments.callee.chain.shortCircuit();
+ }
+ else {
+ // Otherwise do some other stuff and
+ // then go to the next link
+ }
+ }
+ },
+ {
+ func: child_process.exec,
+ args: ['ls ./'],
+ callback: this.hitTheStops
+ }
+ ]);
+
+ // Function to exec after all the links in the chain finish
+ asyncChain.last = function () { // Do some final stuff };
+
+ // Start the async-chain
+ asyncChain.run();
+
+*/
+async.execNonBlocking = function (func) {
+ if (typeof process != 'undefined' && typeof process.nextTick == 'function') {
+ process.nextTick(func);
+ }
+ else {
+ setTimeout(func, 0);
+ }
+};
+
+async.AsyncBase = new (function () {
+
+ this.init = function (chain) {
+ var item;
+ this.chain = [];
+ this.currentItem = null;
+ this.shortCircuited = false;
+ this.shortCircuitedArgs = undefined;
+ this.aborted = false;
+
+ for (var i = 0; i < chain.length; i++) {
+ item = chain[i];
+ this.chain.push(new async.AsyncCall(
+ item.func, item.args, item.callback, item.context));
+ }
+ };
+
+ this.runItem = function (item) {
+ // Reference to the current item in the chain -- used
+ // to look up the callback to execute with execCallback
+ this.currentItem = item;
+ // Scopage
+ var _this = this;
+ // Pass the arguments passed to the current async call
+ // to the callback executor, execute it in the correct scope
+ var executor = function () {
+ _this.execCallback.apply(_this, arguments);
+ };
+ // Append the callback executor to the end of the arguments
+ // Node helpfully always has the callback func last
+ var args = item.args.concat(executor);
+ var func = item.func;
+ // Run the async call
+ func.apply(item.context, args);
+ };
+
+ this.next = function () {
+ if (this.chain.length) {
+ this.runItem(this.chain.shift());
+ }
+ else {
+ this.last();
+ }
+ };
+
+ this.execCallback = function () {
+ // Look up the callback, if any, specified for this async call
+ var callback = this.currentItem.callback;
+ // If there's a callback, do it
+ if (callback && typeof callback == 'function') {
+ // Allow access to the chain from inside the callback by setting
+ // callback.chain = this, and then using arguments.callee.chain
+ callback.chain = this;
+ callback.apply(this.currentItem.context, arguments);
+ }
+
+ this.currentItem.finished = true;
+
+ // If one of the async callbacks called chain.shortCircuit,
+ // skip to the 'last' function for the chain
+ if (this.shortCircuited) {
+ this.last.apply(null, this.shortCircuitedArgs);
+ }
+ // If one of the async callbacks called chain.abort,
+ // bail completely out
+ else if (this.aborted) {
+ return;
+ }
+ // Otherwise run the next item, if any, in the chain
+ // Let's try not to block if we don't have to
+ else {
+ // Scopage
+ var _this = this;
+ async.execNonBlocking(function () { _this.next.call(_this); });
+ }
+ }
+
+ // Short-circuit the chain, jump straight to the 'last' function
+ this.shortCircuit = function () {
+ this.shortCircuitedArgs = arguments;
+ this.shortCircuited = true;
+ }
+
+ // Stop execution of the chain, bail completely out
+ this.abort = function () {
+ this.aborted = true;
+ }
+
+ // Kick off the chain by grabbing the first item and running it
+ this.run = this.next;
+
+ // Function to run when the chain is done -- default is a no-op
+ this.last = function () {};
+
+})();
+
+async.AsyncChain = function (chain) {
+ this.init(chain);
+};
+
+async.AsyncChain.prototype = async.AsyncBase;
+
+async.AsyncGroup = function (group) {
+ var item;
+ var callback;
+ var args;
+
+ this.group = [];
+ this.outstandingCount = 0;
+
+ for (var i = 0; i < group.length; i++) {
+ item = group[i];
+ this.group.push(new async.AsyncCall(
+ item.func, item.args, item.callback, item.context));
+ this.outstandingCount++;
+ }
+
+};
+
+/*
+Simpler way to group async calls -- doesn't ensure completion order,
+but still has a "last" method called when the entire group of calls
+have completed.
+*/
+async.AsyncGroup.prototype = new function () {
+ this.run = function () {
+ var _this = this
+ , group = this.group
+ , item
+ , createItem = function (item, args) {
+ return function () {
+ item.func.apply(item.context, args);
+ };
+ }
+ , createCallback = function (item) {
+ return function () {
+ if (item.callback) {
+ item.callback.apply(null, arguments);
+ }
+ _this.finish.call(_this);
+ }
+ };
+
+ for (var i = 0; i < group.length; i++) {
+ item = group[i];
+ callback = createCallback(item);
+ args = item.args.concat(callback);
+ // Run the async call
+ async.execNonBlocking(createItem(item, args));
+ }
+ };
+
+ this.finish = function () {
+ this.outstandingCount--;
+ if (!this.outstandingCount) {
+ this.last();
+ };
+ };
+
+ this.last = function () {};
+
+};
+
+var _createSimpleAsyncCall = function (func, context) {
+ return {
+ func: func
+ , args: []
+ , callback: function () {}
+ , context: context
+ };
+};
+
+async.SimpleAsyncChain = function (funcs, context) {
+ chain = [];
+ for (var i = 0, ii = funcs.length; i < ii; i++) {
+ chain.push(_createSimpleAsyncCall(funcs[i], context));
+ }
+ this.init(chain);
+};
+
+async.SimpleAsyncChain.prototype = async.AsyncBase;
+
+async.AsyncCall = function (func, args, callback, context) {
+ this.func = func;
+ this.args = args;
+ this.callback = callback || null;
+ this.context = context || null;
+};
+
+async.Initializer = function (steps, callback) {
+ var self = this;
+ this.steps = {};
+ this.callback = callback;
+ // Create an object-literal of the steps to tick off
+ steps.forEach(function (step) {
+ self.steps[step] = false;
+ });
+};
+
+async.Initializer.prototype = new (function () {
+ this.complete = function (step) {
+ var steps = this.steps;
+ // Tick this step off
+ steps[step] = true;
+ // Iterate the steps -- if any are not done, bail out
+ for (var p in steps) {
+ if (!steps[p]) {
+ return false;
+ }
+ }
+ // If all steps are done, run the callback
+ this.callback();
+ };
+})();
+
+module.exports = async;
+
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/utilities/lib/core.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/utilities/lib/core.js b/blackberry10/node_modules/jake/node_modules/utilities/lib/core.js
new file mode 100644
index 0000000..6b41ce7
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/utilities/lib/core.js
@@ -0,0 +1,106 @@
+/*
+ * Utilities: A classic collection of JavaScript utilities
+ * 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 core = new (function () {
+
+ var _mix = function (targ, src, merge, includeProto) {
+ for (var p in src) {
+ // Don't copy stuff from the prototype
+ if (src.hasOwnProperty(p) || includeProto) {
+ if (merge &&
+ // Assumes the source property is an Object you can
+ // actually recurse down into
+ (typeof src[p] == 'object') &&
+ (src[p] !== null) &&
+ !(src[p] instanceof Array)) {
+ // Create the source property if it doesn't exist
+ // Double-equal to undefined includes both null and undefined
+ if (targ[p] == undefined) {
+ targ[p] = {};
+ }
+ _mix(targ[p], src[p], merge, includeProto); // Recurse
+ }
+ // If it's not a merge-copy, just set and forget
+ else {
+ targ[p] = src[p];
+ }
+ }
+ }
+ };
+
+ /*
+ * Mix in the properties on an object to another object
+ * yam.mixin(target, source, [source,] [source, etc.] [merge-flag]);
+ * 'merge' recurses, to merge object sub-properties together instead
+ * of just overwriting with the source object.
+ */
+ this.mixin = function () {
+ var args = Array.prototype.slice.apply(arguments),
+ merge = false,
+ targ, sources;
+ if (args.length > 2) {
+ if (typeof args[args.length - 1] == 'boolean') {
+ merge = args.pop();
+ }
+ }
+ targ = args.shift();
+ sources = args;
+ for (var i = 0, ii = sources.length; i < ii; i++) {
+ _mix(targ, sources[i], merge);
+ }
+ return targ;
+ };
+
+ this.enhance = function () {
+ var args = Array.prototype.slice.apply(arguments),
+ merge = false,
+ targ, sources;
+ if (args.length > 2) {
+ if (typeof args[args.length - 1] == 'boolean') {
+ merge = args.pop();
+ }
+ }
+ targ = args.shift();
+ sources = args;
+ for (var i = 0, ii = sources.length; i < ii; i++) {
+ _mix(targ, sources[i], merge, true);
+ }
+ return targ;
+ };
+
+ // Idea to add invalid number & Date from Michael J. Ryan,
+ // http://frugalcoder.us/post/2010/02/15/js-is-empty.aspx
+ this.isEmpty = function (val) {
+ // Empty string, null or undefined (these two are double-equal)
+ if (val === '' || val == undefined) {
+ return true;
+ }
+ // Invalid numerics
+ if (typeof val == 'number' && isNaN(val)) {
+ return true;
+ }
+ // Invalid Dates
+ if (val instanceof Date && isNaN(val.getTime())) {
+ return true;
+ }
+ return false;
+ };
+
+})();
+
+module.exports = core;
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/utilities/lib/date.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/utilities/lib/date.js b/blackberry10/node_modules/jake/node_modules/utilities/lib/date.js
new file mode 100644
index 0000000..7232ce0
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/utilities/lib/date.js
@@ -0,0 +1,903 @@
+/*
+ * Utilities: A classic collection of JavaScript utilities
+ * 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 string = require('./string')
+ , date
+ , log = require('./log');
+
+/**
+ @name date
+ @namespace date
+*/
+
+date = new (function () {
+ var _this = this
+ , _date = new Date();
+
+ var _US_DATE_PAT = /^(\d{1,2})(?:\-|\/|\.)(\d{1,2})(?:\-|\/|\.)(\d{4})/;
+ var _DATETIME_PAT = /^(\d{4})(?:\-|\/|\.)(\d{1,2})(?:\-|\/|\.)(\d{1,2})(?:T| )?(\d{2})?(?::)?(\d{2})?(?::)?(\d{2})?(?:\.)?(\d+)?(?: *)?(Z|[+-]\d{4}|[+-]\d{2}:\d{2}|[+-]\d{2})?/;
+ // TODO Add am/pm parsing instead of dumb, 24-hour clock.
+ var _TIME_PAT = /^(\d{1,2})?(?::)?(\d{2})?(?::)?(\d{2})?(?:\.)?(\d+)?$/;
+
+ var _dateMethods = [
+ 'FullYear'
+ , 'Month'
+ , 'Date'
+ , 'Hours'
+ , 'Minutes'
+ , 'Seconds'
+ , 'Milliseconds'
+ ];
+
+ var _isArray = function (obj) {
+ return obj &&
+ typeof obj === 'object' &&
+ typeof obj.length === 'number' &&
+ typeof obj.splice === 'function' &&
+ !(obj.propertyIsEnumerable('length'));
+ };
+
+ this.weekdayLong = ['Sunday', 'Monday', 'Tuesday',
+ 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
+ this.weekdayShort = ['Sun', 'Mon', 'Tue', 'Wed',
+ 'Thu', 'Fri', 'Sat'];
+ this.monthLong = ['January', 'February', 'March',
+ 'April', 'May', 'June', 'July', 'August', 'September',
+ 'October', 'November', 'December'];
+ this.monthShort = ['Jan', 'Feb', 'Mar', 'Apr',
+ 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
+ this.meridiem = {
+ 'AM': 'AM',
+ 'PM': 'PM'
+ }
+ // compat
+ this.meridian = this.meridiem
+
+ /**
+ @name date#supportedFormats
+ @public
+ @object
+ @description List of supported strftime formats
+ */
+ this.supportedFormats = {
+ // abbreviated weekday name according to the current locale
+ 'a': function (dt) { return _this.weekdayShort[dt.getDay()]; },
+ // full weekday name according to the current locale
+ 'A': function (dt) { return _this.weekdayLong[dt.getDay()]; },
+ // abbreviated month name according to the current locale
+ 'b': function (dt) { return _this.monthShort[dt.getMonth()]; },
+ 'h': function (dt) { return _this.strftime(dt, '%b'); },
+ // full month name according to the current locale
+ 'B': function (dt) { return _this.monthLong[dt.getMonth()]; },
+ // preferred date and time representation for the current locale
+ 'c': function (dt) { return _this.strftime(dt, '%a %b %d %T %Y'); },
+ // century number (the year divided by 100 and truncated
+ // to an integer, range 00 to 99)
+ 'C': function (dt) { return _this.calcCentury(dt.getFullYear());; },
+ // day of the month as a decimal number (range 01 to 31)
+ 'd': function (dt) { return string.lpad(dt.getDate(), '0', 2); },
+ // same as %m/%d/%y
+ 'D': function (dt) { return _this.strftime(dt, '%m/%d/%y') },
+ // day of the month as a decimal number, a single digit is
+ // preceded by a space (range ' 1' to '31')
+ 'e': function (dt) { return string.lpad(dt.getDate(), ' ', 2); },
+ // month as a decimal number, a single digit is
+ // preceded by a space (range ' 1' to '12')
+ 'f': function () { return _this.strftimeNotImplemented('f'); },
+ // same as %Y-%m-%d
+ 'F': function (dt) { return _this.strftime(dt, '%Y-%m-%d'); },
+ // like %G, but without the century.
+ 'g': function () { return _this.strftimeNotImplemented('g'); },
+ // The 4-digit year corresponding to the ISO week number
+ // (see %V). This has the same format and value as %Y,
+ // except that if the ISO week number belongs to the
+ // previous or next year, that year is used instead.
+ 'G': function () { return _this.strftimeNotImplemented('G'); },
+ // hour as a decimal number using a 24-hour clock (range
+ // 00 to 23)
+ 'H': function (dt) { return string.lpad(dt.getHours(), '0', 2); },
+ // hour as a decimal number using a 12-hour clock (range
+ // 01 to 12)
+ 'I': function (dt) { return string.lpad(
+ _this.hrMil2Std(dt.getHours()), '0', 2); },
+ // day of the year as a decimal number (range 001 to 366)
+ 'j': function (dt) { return string.lpad(
+ _this.calcDays(dt), '0', 3); },
+ // Hour as a decimal number using a 24-hour clock (range
+ // 0 to 23 (space-padded))
+ 'k': function (dt) { return string.lpad(dt.getHours(), ' ', 2); },
+ // Hour as a decimal number using a 12-hour clock (range
+ // 1 to 12 (space-padded))
+ 'l': function (dt) { return string.lpad(
+ _this.hrMil2Std(dt.getHours()), ' ', 2); },
+ // month as a decimal number (range 01 to 12)
+ 'm': function (dt) { return string.lpad((dt.getMonth()+1), '0', 2); },
+ // minute as a decimal number
+ 'M': function (dt) { return string.lpad(dt.getMinutes(), '0', 2); },
+ // Linebreak
+ 'n': function () { return '\n'; },
+ // either `am' or `pm' according to the given time value,
+ // or the corresponding strings for the current locale
+ 'p': function (dt) { return _this.getMeridian(dt.getHours()); },
+ // time in a.m. and p.m. notation
+ 'r': function (dt) { return _this.strftime(dt, '%I:%M:%S %p'); },
+ // time in 24 hour notation
+ 'R': function (dt) { return _this.strftime(dt, '%H:%M'); },
+ // second as a decimal number
+ 'S': function (dt) { return string.lpad(dt.getSeconds(), '0', 2); },
+ // Tab char
+ 't': function () { return '\t'; },
+ // current time, equal to %H:%M:%S
+ 'T': function (dt) { return _this.strftime(dt, '%H:%M:%S'); },
+ // weekday as a decimal number [1,7], with 1 representing
+ // Monday
+ 'u': function (dt) { return _this.convertOneBase(dt.getDay()); },
+ // week number of the current year as a decimal number,
+ // starting with the first Sunday as the first day of the
+ // first week
+ 'U': function () { return _this.strftimeNotImplemented('U'); },
+ // week number of the year (Monday as the first day of the
+ // week) as a decimal number [01,53]. If the week containing
+ // 1 January has four or more days in the new year, then it
+ // is considered week 1. Otherwise, it is the last week of
+ // the previous year, and the next week is week 1.
+ 'V': function () { return _this.strftimeNotImplemented('V'); },
+ // week number of the current year as a decimal number,
+ // starting with the first Monday as the first day of the
+ // first week
+ 'W': function () { return _this.strftimeNotImplemented('W'); },
+ // day of the week as a decimal, Sunday being 0
+ 'w': function (dt) { return dt.getDay(); },
+ // preferred date representation for the current locale
+ // without the time
+ 'x': function (dt) { return _this.strftime(dt, '%D'); },
+ // preferred time representation for the current locale
+ // without the date
+ 'X': function (dt) { return _this.strftime(dt, '%T'); },
+ // year as a decimal number without a century (range 00 to
+ // 99)
+ 'y': function (dt) { return _this.getTwoDigitYear(dt.getFullYear()); },
+ // year as a decimal number including the century
+ 'Y': function (dt) { return string.lpad(dt.getFullYear(), '0', 4); },
+ // time zone or name or abbreviation
+ 'z': function () { return _this.strftimeNotImplemented('z'); },
+ 'Z': function () { return _this.strftimeNotImplemented('Z'); },
+ // Literal percent char
+ '%': function (dt) { return '%'; }
+ };
+
+ /**
+ @name date#getSupportedFormats
+ @public
+ @function
+ @description return the list of formats in a string
+ @return {String} The list of supported formats
+ */
+ this.getSupportedFormats = function () {
+ var str = '';
+ for (var i in this.supportedFormats) { str += i; }
+ return str;
+ }
+
+ this.supportedFormatsPat = new RegExp('%[' +
+ this.getSupportedFormats() + ']{1}', 'g');
+
+ /**
+ @name date#strftime
+ @public
+ @function
+ @return {String} The `dt` formated with the given `format`
+ @description Formats the given date with the strftime formated
+ @param {Date} dt the date object to format
+ @param {String} format the format to convert the date to
+ */
+ this.strftime = function (dt, format) {
+ if (!dt) { return '' }
+
+ var d = dt;
+ var pats = [];
+ var dts = [];
+ var str = format;
+
+ // Allow either Date obj or UTC stamp
+ d = typeof dt == 'number' ? new Date(dt) : dt;
+
+ // Grab all instances of expected formats into array
+ while (pats = this.supportedFormatsPat.exec(format)) {
+ dts.push(pats[0]);
+ }
+
+ // Process any hits
+ for (var i = 0; i < dts.length; i++) {
+ key = dts[i].replace(/%/, '');
+ str = str.replace('%' + key,
+ this.supportedFormats[key](d));
+ }
+ return str;
+
+ };
+
+ this.strftimeNotImplemented = function (s) {
+ throw('this.strftime format "' + s + '" not implemented.');
+ };
+
+ /**
+ @name date#calcCentury
+ @public
+ @function
+ @return {String} The century for the given date
+ @description Find the century for the given `year`
+ @param {Number} year The year to find the century for
+ */
+ this.calcCentury = function (year) {
+ if(!year) {
+ year = _date.getFullYear();
+ }
+
+ var ret = parseInt((year / 100) + 1);
+ year = year.toString();
+
+ // If year ends in 00 subtract one, because it's still the century before the one
+ // it divides to
+ if (year.substring(year.length - 2) === '00') {
+ ret--;
+ }
+
+ return ret.toString();
+ };
+
+ /**
+ @name date#calcDays
+ @public
+ @function
+ @return {Number} The number of days so far for the given date
+ @description Calculate the day number in the year a particular date is on
+ @param {Date} dt The date to use
+ */
+ this.calcDays = function (dt) {
+ var first = new Date(dt.getFullYear(), 0, 1);
+ var diff = 0;
+ var ret = 0;
+ first = first.getTime();
+ diff = (dt.getTime() - first);
+ ret = parseInt(((((diff/1000)/60)/60)/24))+1;
+ return ret;
+ };
+
+ /**
+ * Adjust from 0-6 base week to 1-7 base week
+ * @param d integer for day of week
+ * @return Integer day number for 1-7 base week
+ */
+ this.convertOneBase = function (d) {
+ return d == 0 ? 7 : d;
+ };
+
+ this.getTwoDigitYear = function (yr) {
+ // Add a millenium to take care of years before the year 1000,
+ // (e.g, the year 7) since we're only taking the last two digits
+ // If we overshoot, it doesn't matter
+ var millenYear = yr + 1000;
+ var str = millenYear.toString();
+ str = str.substr(2); // Get the last two digits
+ return str
+ };
+
+ /**
+ @name date#getMeridiem
+ @public
+ @function
+ @return {String} Return 'AM' or 'PM' based on hour in 24-hour format
+ @description Return 'AM' or 'PM' based on hour in 24-hour format
+ @param {Number} h The hour to check
+ */
+ this.getMeridiem = function (h) {
+ return h > 11 ? this.meridiem.PM :
+ this.meridiem.AM;
+ };
+ // Compat
+ this.getMeridian = this.getMeridiem;
+
+ /**
+ @name date#hrMil2Std
+ @public
+ @function
+ @return {String} Return a 12 hour version of the given time
+ @description Convert a 24-hour formatted hour to 12-hour format
+ @param {String} hour The hour to convert
+ */
+ this.hrMil2Std = function (hour) {
+ var h = typeof hour == 'number' ? hour : parseInt(hour);
+ var str = h > 12 ? h - 12 : h;
+ str = str == 0 ? 12 : str;
+ return str;
+ };
+
+ /**
+ @name date#hrStd2Mil
+ @public
+ @function
+ @return {String} Return a 24 hour version of the given time
+ @description Convert a 12-hour formatted hour with meridian flag to 24-hour format
+ @param {String} hour The hour to convert
+ @param {Boolean} pm hour is PM then this should be true
+ */
+ this.hrStd2Mil = function (hour, pm) {
+ var h = typeof hour == 'number' ? hour : parseInt(hour);
+ var str = '';
+ // PM
+ if (pm) {
+ str = h < 12 ? (h+12) : h;
+ }
+ // AM
+ else {
+ str = h == 12 ? 0 : h;
+ }
+ return str;
+ };
+
+ // Constants for use in this.add
+ var dateParts = {
+ YEAR: 'year'
+ , MONTH: 'month'
+ , DAY: 'day'
+ , HOUR: 'hour'
+ , MINUTE: 'minute'
+ , SECOND: 'second'
+ , MILLISECOND: 'millisecond'
+ , QUARTER: 'quarter'
+ , WEEK: 'week'
+ , WEEKDAY: 'weekday'
+ };
+ // Create a map for singular/plural lookup, e.g., day/days
+ var datePartsMap = {};
+ for (var p in dateParts) {
+ datePartsMap[dateParts[p]] = dateParts[p];
+ datePartsMap[dateParts[p] + 's'] = dateParts[p];
+ }
+ this.dateParts = dateParts;
+
+ /**
+ @name date#add
+ @public
+ @function
+ @return {Date} Incremented date
+ @description Add to a Date in intervals of different size, from
+ milliseconds to years
+ @param {Date} dt Date (or timestamp Number), date to increment
+ @param {String} interv a constant representing the interval,
+ e.g. YEAR, MONTH, DAY. See this.dateParts
+ @param {Number} incr how much to add to the date
+ */
+ this.add = function (dt, interv, incr) {
+ if (typeof dt == 'number') { dt = new Date(dt); }
+ function fixOvershoot() {
+ if (sum.getDate() < dt.getDate()) {
+ sum.setDate(0);
+ }
+ }
+ var key = datePartsMap[interv];
+ var sum = new Date(dt);
+ switch (key) {
+ case dateParts.YEAR:
+ sum.setFullYear(dt.getFullYear()+incr);
+ // Keep increment/decrement from 2/29 out of March
+ fixOvershoot();
+ break;
+ case dateParts.QUARTER:
+ // Naive quarter is just three months
+ incr*=3;
+ // fallthrough...
+ case dateParts.MONTH:
+ sum.setMonth(dt.getMonth()+incr);
+ // Reset to last day of month if you overshoot
+ fixOvershoot();
+ break;
+ case dateParts.WEEK:
+ incr*=7;
+ // fallthrough...
+ case dateParts.DAY:
+ sum.setDate(dt.getDate() + incr);
+ break;
+ case dateParts.WEEKDAY:
+ //FIXME: assumes Saturday/Sunday weekend, but even this is not fixed.
+ // There are CLDR entries to localize this.
+ var dat = dt.getDate();
+ var weeks = 0;
+ var days = 0;
+ var strt = 0;
+ var trgt = 0;
+ var adj = 0;
+ // Divide the increment time span into weekspans plus leftover days
+ // e.g., 8 days is one 5-day weekspan / and two leftover days
+ // Can't have zero leftover days, so numbers divisible by 5 get
+ // a days value of 5, and the remaining days make up the number of weeks
+ var mod = incr % 5;
+ if (mod == 0) {
+ days = (incr > 0) ? 5 : -5;
+ weeks = (incr > 0) ? ((incr-5)/5) : ((incr+5)/5);
+ }
+ else {
+ days = mod;
+ weeks = parseInt(incr/5);
+ }
+ // Get weekday value for orig date param
+ strt = dt.getDay();
+ // Orig date is Sat / positive incrementer
+ // Jump over Sun
+ if (strt == 6 && incr > 0) {
+ adj = 1;
+ }
+ // Orig date is Sun / negative incrementer
+ // Jump back over Sat
+ else if (strt == 0 && incr < 0) {
+ adj = -1;
+ }
+ // Get weekday val for the new date
+ trgt = strt + days;
+ // New date is on Sat or Sun
+ if (trgt == 0 || trgt == 6) {
+ adj = (incr > 0) ? 2 : -2;
+ }
+ // Increment by number of weeks plus leftover days plus
+ // weekend adjustments
+ sum.setDate(dat + (7*weeks) + days + adj);
+ break;
+ case dateParts.HOUR:
+ sum.setHours(sum.getHours()+incr);
+ break;
+ case dateParts.MINUTE:
+ sum.setMinutes(sum.getMinutes()+incr);
+ break;
+ case dateParts.SECOND:
+ sum.setSeconds(sum.getSeconds()+incr);
+ break;
+ case dateParts.MILLISECOND:
+ sum.setMilliseconds(sum.getMilliseconds()+incr);
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+ return sum; // Date
+ };
+
+ /**
+ @name date#diff
+ @public
+ @function
+ @return {Number} number of (interv) units apart that
+ the two dates are
+ @description Get the difference in a specific unit of time (e.g., number
+ of months, weeks, days, etc.) between two dates.
+ @param {Date} date1 First date to check
+ @param {Date} date2 Date to compate `date1` with
+ @param {String} interv a constant representing the interval,
+ e.g. YEAR, MONTH, DAY. See this.dateParts
+ */
+ this.diff = function (date1, date2, interv) {
+ // date1
+ // Date object or Number equivalent
+ //
+ // date2
+ // Date object or Number equivalent
+ //
+ // interval
+ // A constant representing the interval, e.g. YEAR, MONTH, DAY. See this.dateParts.
+
+ // Accept timestamp input
+ if (typeof date1 == 'number') { date1 = new Date(date1); }
+ if (typeof date2 == 'number') { date2 = new Date(date2); }
+ var yeaDiff = date2.getFullYear() - date1.getFullYear();
+ var monDiff = (date2.getMonth() - date1.getMonth()) + (yeaDiff * 12);
+ var msDiff = date2.getTime() - date1.getTime(); // Millisecs
+ var secDiff = msDiff/1000;
+ var minDiff = secDiff/60;
+ var houDiff = minDiff/60;
+ var dayDiff = houDiff/24;
+ var weeDiff = dayDiff/7;
+ var delta = 0; // Integer return value
+
+ var key = datePartsMap[interv];
+ switch (key) {
+ case dateParts.YEAR:
+ delta = yeaDiff;
+ break;
+ case dateParts.QUARTER:
+ var m1 = date1.getMonth();
+ var m2 = date2.getMonth();
+ // Figure out which quarter the months are in
+ var q1 = Math.floor(m1/3) + 1;
+ var q2 = Math.floor(m2/3) + 1;
+ // Add quarters for any year difference between the dates
+ q2 += (yeaDiff * 4);
+ delta = q2 - q1;
+ break;
+ case dateParts.MONTH:
+ delta = monDiff;
+ break;
+ case dateParts.WEEK:
+ // Truncate instead of rounding
+ // Don't use Math.floor -- value may be negative
+ delta = parseInt(weeDiff);
+ break;
+ case dateParts.DAY:
+ delta = dayDiff;
+ break;
+ case dateParts.WEEKDAY:
+ var days = Math.round(dayDiff);
+ var weeks = parseInt(days/7);
+ var mod = days % 7;
+
+ // Even number of weeks
+ if (mod == 0) {
+ days = weeks*5;
+ }
+ else {
+ // Weeks plus spare change (< 7 days)
+ var adj = 0;
+ var aDay = date1.getDay();
+ var bDay = date2.getDay();
+
+ weeks = parseInt(days/7);
+ mod = days % 7;
+ // Mark the date advanced by the number of
+ // round weeks (may be zero)
+ var dtMark = new Date(date1);
+ dtMark.setDate(dtMark.getDate()+(weeks*7));
+ var dayMark = dtMark.getDay();
+
+ // Spare change days -- 6 or less
+ if (dayDiff > 0) {
+ switch (true) {
+ // Range starts on Sat
+ case aDay == 6:
+ adj = -1;
+ break;
+ // Range starts on Sun
+ case aDay == 0:
+ adj = 0;
+ break;
+ // Range ends on Sat
+ case bDay == 6:
+ adj = -1;
+ break;
+ // Range ends on Sun
+ case bDay == 0:
+ adj = -2;
+ break;
+ // Range contains weekend
+ case (dayMark + mod) > 5:
+ adj = -2;
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+ }
+ else if (dayDiff < 0) {
+ switch (true) {
+ // Range starts on Sat
+ case aDay == 6:
+ adj = 0;
+ break;
+ // Range starts on Sun
+ case aDay == 0:
+ adj = 1;
+ break;
+ // Range ends on Sat
+ case bDay == 6:
+ adj = 2;
+ break;
+ // Range ends on Sun
+ case bDay == 0:
+ adj = 1;
+ break;
+ // Range contains weekend
+ case (dayMark + mod) < 0:
+ adj = 2;
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+ }
+ days += adj;
+ days -= (weeks*2);
+ }
+ delta = days;
+
+ break;
+ case dateParts.HOUR:
+ delta = houDiff;
+ break;
+ case dateParts.MINUTE:
+ delta = minDiff;
+ break;
+ case dateParts.SECOND:
+ delta = secDiff;
+ break;
+ case dateParts.MILLISECOND:
+ delta = msDiff;
+ break;
+ default:
+ // Do nothing
+ break;
+ }
+ // Round for fractional values and DST leaps
+ return Math.round(delta); // Number (integer)
+ };
+
+ /**
+ @name date#parse
+ @public
+ @function
+ @return {Date} a JavaScript Date object
+ @description Convert various sorts of strings to JavaScript
+ Date objects
+ @param {String} val The string to convert to a Date
+ */
+ this.parse = function (val) {
+ var dt
+ , matches
+ , reordered
+ , off
+ , posOff
+ , offHours
+ , offMinutes
+ , curr
+ , stamp
+ , utc;
+
+ // Yay, we have a date, use it as-is
+ if (val instanceof Date || typeof val.getFullYear == 'function') {
+ dt = val;
+ }
+
+ // Timestamp?
+ else if (typeof val == 'number') {
+ dt = new Date(val);
+ }
+
+ // String or Array
+ else {
+ // Value preparsed, looks like [yyyy, mo, dd, hh, mi, ss, ms, (offset?)]
+ if (_isArray(val)) {
+ matches = val;
+ matches.unshift(null);
+ matches[8] = null;
+ }
+
+ // Oh, crap, it's a string -- parse this bitch
+ else if (typeof val == 'string') {
+ matches = val.match(_DATETIME_PAT);
+
+ // Stupid US-only format?
+ if (!matches) {
+ matches = val.match(_US_DATE_PAT);
+ if (matches) {
+ reordered = [matches[0], matches[3], matches[1], matches[2]];
+ // Pad the results to the same length as ISO8601
+ reordered[8] = null;
+ matches = reordered;
+ }
+ }
+
+ // Time-stored-in-Date hack?
+ if (!matches) {
+ matches = val.match(_TIME_PAT);
+ if (matches) {
+ reordered = [matches[0], 0, 1, 0, matches[1],
+ matches[2], matches[3], matches[4], null];
+ matches = reordered;
+ }
+ }
+
+ }
+
+ // Sweet, the regex actually parsed it into something useful
+ if (matches) {
+ matches.shift(); // First match is entire match, DO NOT WANT
+
+ off = matches.pop();
+ // If there's an offset (or the 'Z' non-offset offset), use UTC
+ // methods to set everything
+ if (off) {
+ if (off == 'Z') {
+ utc = true;
+ offMinutes = 0;
+ }
+ else {
+ utc = false;
+ off = off.replace(/\+|-|:/g, '');
+ if (parseInt(off, 10) === 0) {
+ utc = true;
+ }
+ else {
+ posOff = off.indexOf('+') === 0;
+ off = off.substr(1);
+ off = off.split(':');
+ offHours = parseInt(off[0], 10);
+ offMinutes = parseInt(off[1], 10) || 0;
+ offMinutes += (offHours * 60);
+ if (!posOff) {
+ offMinutes = 0 - offMinutes;
+ }
+ }
+ }
+ }
+
+ dt = new Date(0);
+
+ // Stupid zero-based months
+ matches[1] = parseInt(matches[1], 10) - 1;
+
+ // Specific offset, iterate the array and set each date property
+ // using UTC setters, then adjust time using offset
+ if (off) {
+ for (var i = matches.length - 1; i > -1; i--) {
+ curr = parseInt(matches[i], 10) || 0;
+ dt['setUTC' + _dateMethods[i]](curr);
+ }
+ // Add any offset
+ dt.setMinutes(dt.getMinutes() - offMinutes);
+ }
+ // Otherwise we know nothing about the offset, just iterate the
+ // array and set each date property using regular setters
+ else {
+ for (var i = matches.length - 1; i > -1; i--) {
+ curr = parseInt(matches[i], 10) || 0;
+ dt['set' + _dateMethods[i]](curr);
+ }
+ }
+ }
+
+ // Shit, last-ditch effort using Date.parse
+ else {
+ stamp = Date.parse(val);
+ // Failures to parse yield NaN
+ if (!isNaN(stamp)) {
+ dt = new Date(stamp);
+ }
+ }
+
+ }
+
+ return dt || null;
+ };
+
+ /**
+ @name date#relativeTime
+ @public
+ @function
+ @return {String} A string describing the amount of time ago
+ the passed-in Date is
+ @description Convert a Date to an English sentence representing
+ how long ago the Date was
+ @param {Date} dt The Date to to convert to a relative time string
+ @param {Object} [opts]
+ @param {Boolean} [opts.abbreviated=false] Use short strings
+ (e.g., '<1m') for the relative-time string
+ */
+ this.relativeTime = function (dt, options) {
+ var opts = options || {}
+ , now = opts.now || new Date()
+ , abbr = opts.abbreviated || false
+ , format = opts.format || '%F %T'
+ // Diff in seconds
+ , diff = (now.getTime() - dt.getTime()) / 1000
+ , ret
+ , num
+ , hour = 60*60
+ , day = 24*hour
+ , week = 7*day
+ , month = 30*day;
+ switch (true) {
+ case diff < 60:
+ ret = abbr ? '<1m' : 'less than a minute ago';
+ break;
+ case diff < 120:
+ ret = abbr ? '1m' : 'about a minute ago';
+ break;
+ case diff < (45*60):
+ num = parseInt((diff / 60), 10);
+ ret = abbr ? num + 'm' : num + ' minutes ago';
+ break;
+ case diff < (2*hour):
+ ret = abbr ? '1h' : 'about an hour ago';
+ break;
+ case diff < (1*day):
+ num = parseInt((diff / hour), 10);
+ ret = abbr ? num + 'h' : 'about ' + num + ' hours ago';
+ break;
+ case diff < (2*day):
+ ret = abbr ? '1d' : 'one day ago';
+ break;
+ case diff < (7*day):
+ num = parseInt((diff / day), 10);
+ ret = abbr ? num + 'd' : 'about ' + num + ' days ago';
+ break;
+ case diff < (11*day):
+ ret = abbr ? '1w': 'one week ago';
+ break;
+ case diff < (1*month):
+ num = Math.round(diff / week);
+ ret = abbr ? num + 'w' : 'about ' + num + ' weeks ago';
+ break;
+ default:
+ ret = date.strftime(dt, format);
+ break;
+ }
+ return ret;
+ };
+
+ /**
+ @name date#toISO8601
+ @public
+ @function
+ @return {String} A string describing the amount of time ago
+ @description Convert a Date to an ISO8601-formatted string
+ @param {Date} dt The Date to to convert to an ISO8601 string
+ */
+ var _pad = function (n) {
+ return n < 10 ? '0' + n : n;
+ };
+ this.toISO8601 = function (dt, options) {
+ var opts = options || {}
+ , off = dt.getTimezoneOffset()
+ , offHours
+ , offMinutes
+ , str = this.strftime(dt, '%F') + 'T'
+ + this.strftime(dt, '%T') + '.'
+ + string.lpad(dt.getMilliseconds(), '0', 3);
+ // Pos and neg numbers are both truthy; only
+ // zero is falsy
+ if (off && !opts.utc) {
+ str += off > 0 ? '-' : '+';
+ offHours = parseInt(off / 60, 10);
+ str += string.lpad(offHours, '0', 2);
+ offMinutes = off % 60;
+ if (offMinutes) {
+ str += string.lpad(offMinutes, '0', 2);
+ }
+ }
+ else {
+ str += 'Z';
+ }
+ return str;
+ };
+
+ // Alias
+ this.toIso8601 = this.toISO8601;
+
+ this.toUTC = function (dt) {
+ return new Date(
+ dt.getUTCFullYear()
+ , dt.getUTCMonth()
+ , dt.getUTCDate()
+ , dt.getUTCHours()
+ , dt.getUTCMinutes()
+ , dt.getUTCSeconds()
+ , dt.getUTCMilliseconds());
+ };
+
+})();
+
+module.exports = date;
+
+
http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/1139813c/blackberry10/node_modules/jake/node_modules/utilities/lib/event_buffer.js
----------------------------------------------------------------------
diff --git a/blackberry10/node_modules/jake/node_modules/utilities/lib/event_buffer.js b/blackberry10/node_modules/jake/node_modules/utilities/lib/event_buffer.js
new file mode 100644
index 0000000..3e224c8
--- /dev/null
+++ b/blackberry10/node_modules/jake/node_modules/utilities/lib/event_buffer.js
@@ -0,0 +1,109 @@
+/*
+ * Utilities: A classic collection of JavaScript utilities
+ * 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.
+ *
+*/
+
+/*
+This is a very simple buffer for a predetermined set of events. It is unbounded.
+It forwards all arguments to any outlet emitter attached with sync().
+
+Example:
+ var source = new Stream()
+ , dest = new EventEmitter()
+ , buff = new EventBuffer(source)
+ , data = '';
+ dest.on('data', function (d) { data += d; });
+ source.writeable = true;
+ source.readable = true;
+ source.emit('data', 'abcdef');
+ source.emit('data', '123456');
+ buff.sync(dest);
+*/
+
+/**
+ @name EventBuffer
+ @namespace EventBuffer
+ @constructor
+*/
+
+var EventBuffer = function (src, events) {
+ // By default, we service the default stream events
+ var self = this
+ , streamEvents = ['data', 'end', 'error', 'close', 'fd', 'drain', 'pipe'];
+ this.events = events || streamEvents;
+ this.emitter = src;
+ this.eventBuffer = [];
+ this.outlet = null;
+ this.events.forEach(function (name) {
+ self.emitter.addListener(name, function () {
+ self.proxyEmit(name, arguments);
+ });
+ });
+};
+
+EventBuffer.prototype = new (function () {
+ /**
+ @name EventBuffer#proxyEmit
+ @public
+ @function
+ @description Emit an event by name and arguments or add it to the buffer if
+ no outlet is set
+ @param {String} name The name to use for the event
+ @param {Array} args An array of arguments to emit
+ */
+ this.proxyEmit = function (name, args) {
+ if (this.outlet) {
+ this.emit(name, args);
+ }
+ else {
+ this.eventBuffer.push({name: name, args: args});
+ }
+ };
+
+ /**
+ @name EventBuffer#emit
+ @public
+ @function
+ @description Emit an event by name and arguments
+ @param {String} name The name to use for the event
+ @param {Array} args An array of arguments to emit
+ */
+ this.emit = function (name, args) {
+ // Prepend name to args
+ var outlet = this.outlet;
+ Array.prototype.splice.call(args, 0, 0, name);
+ outlet.emit.apply(outlet, args);
+ };
+
+ /**
+ @name EventBuffer#sync
+ @public
+ @function
+ @description Flush the buffer and continue piping new events to the outlet
+ @param {Object} outlet The emitter to send events to
+ */
+ this.sync = function (outlet) {
+ var buffer = this.eventBuffer
+ , bufferItem;
+ this.outlet = outlet;
+ while ((bufferItem = buffer.shift())) {
+ this.emit(bufferItem.name, bufferItem.args);
+ }
+ };
+})();
+EventBuffer.prototype.constructor = EventBuffer;
+
+module.exports.EventBuffer = EventBuffer;