batman-rails-flo 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +29 -0
- data/Rakefile +2 -0
- data/lib/batman-rails-flo.rb +5 -0
- data/lib/batman_rails_flo/railtie.rb +9 -0
- data/lib/batman_rails_flo/tasks.rake +14 -0
- data/lib/batman_rails_flo/version.rb +3 -0
- data/vendor/assets/javascripts/batman_rails_flo/flo_server.js +67 -0
- data/vendor/assets/javascripts/batman_rails_flo/live_reload.js.coffee +129 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/CNAME +1 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/CONTRIBUTING.md +9 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/LICENSE +22 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/README +50 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/bin/cake +7 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/bin/coffee +7 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/browser.js +134 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/cake.js +112 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/coffee-script.js +335 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/command.js +569 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/grammar.js +631 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/helpers.js +252 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/lexer.js +926 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/nodes.js +3158 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/optparse.js +139 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/parser.js +724 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/register.js +66 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/repl.js +163 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/rewriter.js +475 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/sourcemap.js +161 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/LICENSE +21 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/examples/pow.js +6 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/index.js +82 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/package.json +34 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/readme.markdown +63 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/chmod.js +38 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/clobber.js +37 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/mkdirp.js +28 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/perm.js +32 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/perm_sync.js +39 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/race.js +41 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/rel.js +32 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/return.js +25 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/return_sync.js +24 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/root.js +18 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/sync.js +32 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/umask.js +28 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/umask_sync.js +32 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/package.json +50 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/register.js +1 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/LICENSE +30 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/PATENTS +23 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/README.md +124 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/bin/flo +26 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/configure.html +57 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/configure.js +205 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/style.css +334 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/connection.js +235 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/devtools.html +12 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/index.js +323 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/logger.js +42 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/logo.png +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/manifest.json +13 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/session.js +305 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/index.js +10 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/lib/flo.js +226 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/lib/server.js +94 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/README.md +66 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/index.js +437 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/LICENSE +23 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/README.md +218 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/minimatch.js +1055 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/README.md +97 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/lib/lru-cache.js +252 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/package.json +33 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/test/basic.js +369 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/test/foreach.js +52 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/test/memory-leak.js +50 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/package.json +42 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/test/basic.js +24 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/package.json +40 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/basic.js +399 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/brace-expand.js +33 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/caching.js +14 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/defaults.js +274 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/lib/walker.js +111 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/license +13 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/lib/makeerror.js +87 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/node_modules/tmpl/lib/tmpl.js +17 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/node_modules/tmpl/package.json +31 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/node_modules/tmpl/readme.md +10 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/package.json +34 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/readme.md +77 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/package.json +36 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/readme.md +52 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/LICENSE +55 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/main.js +128 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/package.json +34 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/readme.mkd +72 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/d/d/t +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/d/t +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_monitor.js +31 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_monitorRootDirectory.js +28 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js +20 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/package.json +45 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/test/test.js +243 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/CHANGELOG.md +81 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/LICENSE +177 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/Makefile +11 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/README.md +245 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/binding.gyp +14 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Makefile +355 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/linker.lock +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/obj.target/validation/src/validation.o +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/obj.target/xor/src/xor.o +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/validation.node +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/xor.node +0 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/binding.Makefile +6 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/config.gypi +115 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/gyp-mac-tool +512 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/validation.target.mk +154 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/xor.target.mk +154 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/index.js +1 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/install.js +31 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Constants.js +23 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Deprecation.js +38 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Validation.fallback.js +12 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Validation.js +18 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketClient.js +359 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketConnection.js +717 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketFrame.js +282 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRequest.js +478 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRouter.js +154 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRouterRequest.js +59 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketServer.js +216 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/utils.js +7 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/websocket.js +11 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/xor.fallback.js +13 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/xor.js +18 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/package.json +43 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/src/validation.cc +144 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/src/xor.cpp +86 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/FastBufferList.js +192 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/node-ctype/LICENSE +18 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/node-ctype/ctio-faster.js +1126 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/package.json +25 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/browser_websocket.js +63 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/connection_test.js +57 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/logger_mock.js +15 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/session_test.js +194 -0
- data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/server/flo_test.js +211 -0
- data/vendor/assets/javascripts/batman_rails_flo/package.json +15 -0
- data/vendor/assets/javascripts/batman_rails_flo/reload_event_handler.js.coffee +56 -0
- metadata +232 -0
@@ -0,0 +1,33 @@
|
|
1
|
+
var tap = require("tap")
|
2
|
+
, minimatch = require("../")
|
3
|
+
|
4
|
+
tap.test("brace expansion", function (t) {
|
5
|
+
// [ pattern, [expanded] ]
|
6
|
+
; [ [ "a{b,c{d,e},{f,g}h}x{y,z}"
|
7
|
+
, [ "abxy"
|
8
|
+
, "abxz"
|
9
|
+
, "acdxy"
|
10
|
+
, "acdxz"
|
11
|
+
, "acexy"
|
12
|
+
, "acexz"
|
13
|
+
, "afhxy"
|
14
|
+
, "afhxz"
|
15
|
+
, "aghxy"
|
16
|
+
, "aghxz" ] ]
|
17
|
+
, [ "a{1..5}b"
|
18
|
+
, [ "a1b"
|
19
|
+
, "a2b"
|
20
|
+
, "a3b"
|
21
|
+
, "a4b"
|
22
|
+
, "a5b" ] ]
|
23
|
+
, [ "a{b}c", ["a{b}c"] ]
|
24
|
+
].forEach(function (tc) {
|
25
|
+
var p = tc[0]
|
26
|
+
, expect = tc[1]
|
27
|
+
t.equivalent(minimatch.braceExpand(p), expect, p)
|
28
|
+
})
|
29
|
+
console.error("ending")
|
30
|
+
t.end()
|
31
|
+
})
|
32
|
+
|
33
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
var Minimatch = require("../minimatch.js").Minimatch
|
2
|
+
var tap = require("tap")
|
3
|
+
tap.test("cache test", function (t) {
|
4
|
+
var mm1 = new Minimatch("a?b")
|
5
|
+
var mm2 = new Minimatch("a?b")
|
6
|
+
t.equal(mm1, mm2, "should get the same object")
|
7
|
+
// the lru should drop it after 100 entries
|
8
|
+
for (var i = 0; i < 100; i ++) {
|
9
|
+
new Minimatch("a"+i)
|
10
|
+
}
|
11
|
+
mm2 = new Minimatch("a?b")
|
12
|
+
t.notEqual(mm1, mm2, "cache should have dropped")
|
13
|
+
t.end()
|
14
|
+
})
|
@@ -0,0 +1,274 @@
|
|
1
|
+
// http://www.bashcookbook.com/bashinfo/source/bash-1.14.7/tests/glob-test
|
2
|
+
//
|
3
|
+
// TODO: Some of these tests do very bad things with backslashes, and will
|
4
|
+
// most likely fail badly on windows. They should probably be skipped.
|
5
|
+
|
6
|
+
var tap = require("tap")
|
7
|
+
, globalBefore = Object.keys(global)
|
8
|
+
, mm = require("../")
|
9
|
+
, files = [ "a", "b", "c", "d", "abc"
|
10
|
+
, "abd", "abe", "bb", "bcd"
|
11
|
+
, "ca", "cb", "dd", "de"
|
12
|
+
, "bdir/", "bdir/cfile"]
|
13
|
+
, next = files.concat([ "a-b", "aXb"
|
14
|
+
, ".x", ".y" ])
|
15
|
+
|
16
|
+
tap.test("basic tests", function (t) {
|
17
|
+
var start = Date.now()
|
18
|
+
|
19
|
+
// [ pattern, [matches], MM opts, files, TAP opts]
|
20
|
+
; [ "http://www.bashcookbook.com/bashinfo" +
|
21
|
+
"/source/bash-1.14.7/tests/glob-test"
|
22
|
+
, ["a*", ["a", "abc", "abd", "abe"]]
|
23
|
+
, ["X*", ["X*"], {nonull: true}]
|
24
|
+
|
25
|
+
// allow null glob expansion
|
26
|
+
, ["X*", []]
|
27
|
+
|
28
|
+
// isaacs: Slightly different than bash/sh/ksh
|
29
|
+
// \\* is not un-escaped to literal "*" in a failed match,
|
30
|
+
// but it does make it get treated as a literal star
|
31
|
+
, ["\\*", ["\\*"], {nonull: true}]
|
32
|
+
, ["\\**", ["\\**"], {nonull: true}]
|
33
|
+
, ["\\*\\*", ["\\*\\*"], {nonull: true}]
|
34
|
+
|
35
|
+
, ["b*/", ["bdir/"]]
|
36
|
+
, ["c*", ["c", "ca", "cb"]]
|
37
|
+
, ["**", files]
|
38
|
+
|
39
|
+
, ["\\.\\./*/", ["\\.\\./*/"], {nonull: true}]
|
40
|
+
, ["s/\\..*//", ["s/\\..*//"], {nonull: true}]
|
41
|
+
|
42
|
+
, "legendary larry crashes bashes"
|
43
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"
|
44
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\\1/"], {nonull: true}]
|
45
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"
|
46
|
+
, ["/^root:/{s/^[^:]*:[^:]*:\([^:]*\).*$/\1/"], {nonull: true}]
|
47
|
+
|
48
|
+
, "character classes"
|
49
|
+
, ["[a-c]b*", ["abc", "abd", "abe", "bb", "cb"]]
|
50
|
+
, ["[a-y]*[^c]", ["abd", "abe", "bb", "bcd",
|
51
|
+
"bdir/", "ca", "cb", "dd", "de"]]
|
52
|
+
, ["a*[^c]", ["abd", "abe"]]
|
53
|
+
, function () { files.push("a-b", "aXb") }
|
54
|
+
, ["a[X-]b", ["a-b", "aXb"]]
|
55
|
+
, function () { files.push(".x", ".y") }
|
56
|
+
, ["[^a-c]*", ["d", "dd", "de"]]
|
57
|
+
, function () { files.push("a*b/", "a*b/ooo") }
|
58
|
+
, ["a\\*b/*", ["a*b/ooo"]]
|
59
|
+
, ["a\\*?/*", ["a*b/ooo"]]
|
60
|
+
, ["*\\\\!*", [], {null: true}, ["echo !7"]]
|
61
|
+
, ["*\\!*", ["echo !7"], null, ["echo !7"]]
|
62
|
+
, ["*.\\*", ["r.*"], null, ["r.*"]]
|
63
|
+
, ["a[b]c", ["abc"]]
|
64
|
+
, ["a[\\b]c", ["abc"]]
|
65
|
+
, ["a?c", ["abc"]]
|
66
|
+
, ["a\\*c", [], {null: true}, ["abc"]]
|
67
|
+
, ["", [""], { null: true }, [""]]
|
68
|
+
|
69
|
+
, "http://www.opensource.apple.com/source/bash/bash-23/" +
|
70
|
+
"bash/tests/glob-test"
|
71
|
+
, function () { files.push("man/", "man/man1/", "man/man1/bash.1") }
|
72
|
+
, ["*/man*/bash.*", ["man/man1/bash.1"]]
|
73
|
+
, ["man/man1/bash.1", ["man/man1/bash.1"]]
|
74
|
+
, ["a***c", ["abc"], null, ["abc"]]
|
75
|
+
, ["a*****?c", ["abc"], null, ["abc"]]
|
76
|
+
, ["?*****??", ["abc"], null, ["abc"]]
|
77
|
+
, ["*****??", ["abc"], null, ["abc"]]
|
78
|
+
, ["?*****?c", ["abc"], null, ["abc"]]
|
79
|
+
, ["?***?****c", ["abc"], null, ["abc"]]
|
80
|
+
, ["?***?****?", ["abc"], null, ["abc"]]
|
81
|
+
, ["?***?****", ["abc"], null, ["abc"]]
|
82
|
+
, ["*******c", ["abc"], null, ["abc"]]
|
83
|
+
, ["*******?", ["abc"], null, ["abc"]]
|
84
|
+
, ["a*cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
85
|
+
, ["a**?**cd**?**??k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
86
|
+
, ["a**?**cd**?**??k***", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
87
|
+
, ["a**?**cd**?**??***k", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
88
|
+
, ["a**?**cd**?**??***k**", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
89
|
+
, ["a****c**?**??*****", ["abcdecdhjk"], null, ["abcdecdhjk"]]
|
90
|
+
, ["[-abc]", ["-"], null, ["-"]]
|
91
|
+
, ["[abc-]", ["-"], null, ["-"]]
|
92
|
+
, ["\\", ["\\"], null, ["\\"]]
|
93
|
+
, ["[\\\\]", ["\\"], null, ["\\"]]
|
94
|
+
, ["[[]", ["["], null, ["["]]
|
95
|
+
, ["[", ["["], null, ["["]]
|
96
|
+
, ["[*", ["[abc"], null, ["[abc"]]
|
97
|
+
, "a right bracket shall lose its special meaning and\n" +
|
98
|
+
"represent itself in a bracket expression if it occurs\n" +
|
99
|
+
"first in the list. -- POSIX.2 2.8.3.2"
|
100
|
+
, ["[]]", ["]"], null, ["]"]]
|
101
|
+
, ["[]-]", ["]"], null, ["]"]]
|
102
|
+
, ["[a-\z]", ["p"], null, ["p"]]
|
103
|
+
, ["??**********?****?", [], { null: true }, ["abc"]]
|
104
|
+
, ["??**********?****c", [], { null: true }, ["abc"]]
|
105
|
+
, ["?************c****?****", [], { null: true }, ["abc"]]
|
106
|
+
, ["*c*?**", [], { null: true }, ["abc"]]
|
107
|
+
, ["a*****c*?**", [], { null: true }, ["abc"]]
|
108
|
+
, ["a********???*******", [], { null: true }, ["abc"]]
|
109
|
+
, ["[]", [], { null: true }, ["a"]]
|
110
|
+
, ["[abc", [], { null: true }, ["["]]
|
111
|
+
|
112
|
+
, "nocase tests"
|
113
|
+
, ["XYZ", ["xYz"], { nocase: true, null: true }
|
114
|
+
, ["xYz", "ABC", "IjK"]]
|
115
|
+
, ["ab*", ["ABC"], { nocase: true, null: true }
|
116
|
+
, ["xYz", "ABC", "IjK"]]
|
117
|
+
, ["[ia]?[ck]", ["ABC", "IjK"], { nocase: true, null: true }
|
118
|
+
, ["xYz", "ABC", "IjK"]]
|
119
|
+
|
120
|
+
// [ pattern, [matches], MM opts, files, TAP opts]
|
121
|
+
, "onestar/twostar"
|
122
|
+
, ["{/*,*}", [], {null: true}, ["/asdf/asdf/asdf"]]
|
123
|
+
, ["{/?,*}", ["/a", "bb"], {null: true}
|
124
|
+
, ["/a", "/b/b", "/a/b/c", "bb"]]
|
125
|
+
|
126
|
+
, "dots should not match unless requested"
|
127
|
+
, ["**", ["a/b"], {}, ["a/b", "a/.d", ".a/.d"]]
|
128
|
+
|
129
|
+
// .. and . can only match patterns starting with .,
|
130
|
+
// even when options.dot is set.
|
131
|
+
, function () {
|
132
|
+
files = ["a/./b", "a/../b", "a/c/b", "a/.d/b"]
|
133
|
+
}
|
134
|
+
, ["a/*/b", ["a/c/b", "a/.d/b"], {dot: true}]
|
135
|
+
, ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: true}]
|
136
|
+
, ["a/*/b", ["a/c/b"], {dot:false}]
|
137
|
+
, ["a/.*/b", ["a/./b", "a/../b", "a/.d/b"], {dot: false}]
|
138
|
+
|
139
|
+
|
140
|
+
// this also tests that changing the options needs
|
141
|
+
// to change the cache key, even if the pattern is
|
142
|
+
// the same!
|
143
|
+
, ["**", ["a/b","a/.d",".a/.d"], { dot: true }
|
144
|
+
, [ ".a/.d", "a/.d", "a/b"]]
|
145
|
+
|
146
|
+
, "paren sets cannot contain slashes"
|
147
|
+
, ["*(a/b)", ["*(a/b)"], {nonull: true}, ["a/b"]]
|
148
|
+
|
149
|
+
// brace sets trump all else.
|
150
|
+
//
|
151
|
+
// invalid glob pattern. fails on bash4 and bsdglob.
|
152
|
+
// however, in this implementation, it's easier just
|
153
|
+
// to do the intuitive thing, and let brace-expansion
|
154
|
+
// actually come before parsing any extglob patterns,
|
155
|
+
// like the documentation seems to say.
|
156
|
+
//
|
157
|
+
// XXX: if anyone complains about this, either fix it
|
158
|
+
// or tell them to grow up and stop complaining.
|
159
|
+
//
|
160
|
+
// bash/bsdglob says this:
|
161
|
+
// , ["*(a|{b),c)}", ["*(a|{b),c)}"], {}, ["a", "ab", "ac", "ad"]]
|
162
|
+
// but we do this instead:
|
163
|
+
, ["*(a|{b),c)}", ["a", "ab", "ac"], {}, ["a", "ab", "ac", "ad"]]
|
164
|
+
|
165
|
+
// test partial parsing in the presence of comment/negation chars
|
166
|
+
, ["[!a*", ["[!ab"], {}, ["[!ab", "[ab"]]
|
167
|
+
, ["[#a*", ["[#ab"], {}, ["[#ab", "[ab"]]
|
168
|
+
|
169
|
+
// like: {a,b|c\\,d\\\|e} except it's unclosed, so it has to be escaped.
|
170
|
+
, ["+(a|*\\|c\\\\|d\\\\\\|e\\\\\\\\|f\\\\\\\\\\|g"
|
171
|
+
, ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g"]
|
172
|
+
, {}
|
173
|
+
, ["+(a|b\\|c\\\\|d\\\\|e\\\\\\\\|f\\\\\\\\|g", "a", "b\\c"]]
|
174
|
+
|
175
|
+
|
176
|
+
// crazy nested {,,} and *(||) tests.
|
177
|
+
, function () {
|
178
|
+
files = [ "a", "b", "c", "d"
|
179
|
+
, "ab", "ac", "ad"
|
180
|
+
, "bc", "cb"
|
181
|
+
, "bc,d", "c,db", "c,d"
|
182
|
+
, "d)", "(b|c", "*(b|c"
|
183
|
+
, "b|c", "b|cc", "cb|c"
|
184
|
+
, "x(a|b|c)", "x(a|c)"
|
185
|
+
, "(a|b|c)", "(a|c)"]
|
186
|
+
}
|
187
|
+
, ["*(a|{b,c})", ["a", "b", "c", "ab", "ac"]]
|
188
|
+
, ["{a,*(b|c,d)}", ["a","(b|c", "*(b|c", "d)"]]
|
189
|
+
// a
|
190
|
+
// *(b|c)
|
191
|
+
// *(b|d)
|
192
|
+
, ["{a,*(b|{c,d})}", ["a","b", "bc", "cb", "c", "d"]]
|
193
|
+
, ["*(a|{b|c,c})", ["a", "b", "c", "ab", "ac", "bc", "cb"]]
|
194
|
+
|
195
|
+
|
196
|
+
// test various flag settings.
|
197
|
+
, [ "*(a|{b|c,c})", ["x(a|b|c)", "x(a|c)", "(a|b|c)", "(a|c)"]
|
198
|
+
, { noext: true } ]
|
199
|
+
, ["a?b", ["x/y/acb", "acb/"], {matchBase: true}
|
200
|
+
, ["x/y/acb", "acb/", "acb/d/e", "x/y/acb/d"] ]
|
201
|
+
, ["#*", ["#a", "#b"], {nocomment: true}, ["#a", "#b", "c#d"]]
|
202
|
+
|
203
|
+
|
204
|
+
// begin channelling Boole and deMorgan...
|
205
|
+
, "negation tests"
|
206
|
+
, function () {
|
207
|
+
files = ["d", "e", "!ab", "!abc", "a!b", "\\!a"]
|
208
|
+
}
|
209
|
+
|
210
|
+
// anything that is NOT a* matches.
|
211
|
+
, ["!a*", ["\\!a", "d", "e", "!ab", "!abc"]]
|
212
|
+
|
213
|
+
// anything that IS !a* matches.
|
214
|
+
, ["!a*", ["!ab", "!abc"], {nonegate: true}]
|
215
|
+
|
216
|
+
// anything that IS a* matches
|
217
|
+
, ["!!a*", ["a!b"]]
|
218
|
+
|
219
|
+
// anything that is NOT !a* matches
|
220
|
+
, ["!\\!a*", ["a!b", "d", "e", "\\!a"]]
|
221
|
+
|
222
|
+
// negation nestled within a pattern
|
223
|
+
, function () {
|
224
|
+
files = [ "foo.js"
|
225
|
+
, "foo.bar"
|
226
|
+
// can't match this one without negative lookbehind.
|
227
|
+
, "foo.js.js"
|
228
|
+
, "blar.js"
|
229
|
+
, "foo."
|
230
|
+
, "boo.js.boo" ]
|
231
|
+
}
|
232
|
+
, ["*.!(js)", ["foo.bar", "foo.", "boo.js.boo"] ]
|
233
|
+
|
234
|
+
].forEach(function (c) {
|
235
|
+
if (typeof c === "function") return c()
|
236
|
+
if (typeof c === "string") return t.comment(c)
|
237
|
+
|
238
|
+
var pattern = c[0]
|
239
|
+
, expect = c[1].sort(alpha)
|
240
|
+
, options = c[2] || {}
|
241
|
+
, f = c[3] || files
|
242
|
+
, tapOpts = c[4] || {}
|
243
|
+
|
244
|
+
// options.debug = true
|
245
|
+
var Class = mm.defaults(options).Minimatch
|
246
|
+
var m = new Class(pattern, {})
|
247
|
+
var r = m.makeRe()
|
248
|
+
tapOpts.re = String(r) || JSON.stringify(r)
|
249
|
+
tapOpts.files = JSON.stringify(f)
|
250
|
+
tapOpts.pattern = pattern
|
251
|
+
tapOpts.set = m.set
|
252
|
+
tapOpts.negated = m.negate
|
253
|
+
|
254
|
+
var actual = mm.match(f, pattern, options)
|
255
|
+
actual.sort(alpha)
|
256
|
+
|
257
|
+
t.equivalent( actual, expect
|
258
|
+
, JSON.stringify(pattern) + " " + JSON.stringify(expect)
|
259
|
+
, tapOpts )
|
260
|
+
})
|
261
|
+
|
262
|
+
t.comment("time=" + (Date.now() - start) + "ms")
|
263
|
+
t.end()
|
264
|
+
})
|
265
|
+
|
266
|
+
tap.test("global leak test", function (t) {
|
267
|
+
var globalAfter = Object.keys(global)
|
268
|
+
t.equivalent(globalAfter, globalBefore, "no new globals, please")
|
269
|
+
t.end()
|
270
|
+
})
|
271
|
+
|
272
|
+
function alpha (a, b) {
|
273
|
+
return a > b ? 1 : -1
|
274
|
+
}
|
@@ -0,0 +1,111 @@
|
|
1
|
+
module.exports = Walker
|
2
|
+
|
3
|
+
var path = require('path')
|
4
|
+
, fs = require('fs')
|
5
|
+
, util = require('util')
|
6
|
+
, EventEmitter = require('events').EventEmitter
|
7
|
+
, makeError = require('makeerror')
|
8
|
+
|
9
|
+
/**
|
10
|
+
* To walk a directory. It's complicated (but it's async, so it must be fast).
|
11
|
+
*
|
12
|
+
* @param root {String} the directory to start with
|
13
|
+
*/
|
14
|
+
function Walker(root) {
|
15
|
+
if (!(this instanceof Walker)) return new Walker(root)
|
16
|
+
EventEmitter.call(this)
|
17
|
+
this._pending = 0
|
18
|
+
this._filterDir = function() { return true }
|
19
|
+
this.go(root)
|
20
|
+
}
|
21
|
+
util.inherits(Walker, EventEmitter)
|
22
|
+
|
23
|
+
/**
|
24
|
+
* Errors of this type are thrown when the type of a file could not be
|
25
|
+
* determined.
|
26
|
+
*/
|
27
|
+
UnknownFileTypeError = Walker.UnknownFileTypeError = makeError(
|
28
|
+
'UnknownFileTypeError',
|
29
|
+
'The type of this file could not be determined.'
|
30
|
+
)
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Setup a function to filter out directory entries.
|
34
|
+
*
|
35
|
+
* @param fn {Function} a function that will be given a directory name, which
|
36
|
+
* if returns true will include the directory and it's children
|
37
|
+
*/
|
38
|
+
Walker.prototype.filterDir = function(fn) {
|
39
|
+
this._filterDir = fn
|
40
|
+
return this
|
41
|
+
}
|
42
|
+
|
43
|
+
/**
|
44
|
+
* Process a file or directory.
|
45
|
+
*/
|
46
|
+
Walker.prototype.go = function(entry) {
|
47
|
+
var that = this
|
48
|
+
this._pending++
|
49
|
+
|
50
|
+
fs.lstat(entry, function(er, stat) {
|
51
|
+
if (er) {
|
52
|
+
that.emit('error', er, entry, stat)
|
53
|
+
that.doneOne()
|
54
|
+
return
|
55
|
+
}
|
56
|
+
|
57
|
+
if (stat.isDirectory()) {
|
58
|
+
if (!that._filterDir(entry, stat)) {
|
59
|
+
that.doneOne()
|
60
|
+
} else {
|
61
|
+
fs.readdir(entry, function(er, files) {
|
62
|
+
if (er) {
|
63
|
+
that.emit('error', er, entry, stat)
|
64
|
+
that.doneOne()
|
65
|
+
return
|
66
|
+
}
|
67
|
+
|
68
|
+
that.emit('entry', entry, stat)
|
69
|
+
that.emit('dir', entry, stat)
|
70
|
+
files.forEach(function(part) {
|
71
|
+
that.go(path.join(entry, part))
|
72
|
+
})
|
73
|
+
that.doneOne()
|
74
|
+
})
|
75
|
+
}
|
76
|
+
} else if (stat.isSymbolicLink()) {
|
77
|
+
that.emit('entry', entry, stat)
|
78
|
+
that.emit('symlink', entry, stat)
|
79
|
+
that.doneOne()
|
80
|
+
} else if (stat.isBlockDevice()) {
|
81
|
+
that.emit('entry', entry, stat)
|
82
|
+
that.emit('blockDevice', entry, stat)
|
83
|
+
that.doneOne()
|
84
|
+
} else if (stat.isCharacterDevice()) {
|
85
|
+
that.emit('entry', entry, stat)
|
86
|
+
that.emit('characterDevice', entry, stat)
|
87
|
+
that.doneOne()
|
88
|
+
} else if (stat.isFIFO()) {
|
89
|
+
that.emit('entry', entry, stat)
|
90
|
+
that.emit('fifo', entry, stat)
|
91
|
+
that.doneOne()
|
92
|
+
} else if (stat.isSocket()) {
|
93
|
+
that.emit('entry', entry, stat)
|
94
|
+
that.emit('socket', entry, stat)
|
95
|
+
that.doneOne()
|
96
|
+
} else if (stat.isFile()) {
|
97
|
+
that.emit('entry', entry, stat)
|
98
|
+
that.emit('file', entry, stat)
|
99
|
+
that.doneOne()
|
100
|
+
} else {
|
101
|
+
that.emit('error', UnknownFileTypeError(), entry, stat)
|
102
|
+
that.doneOne()
|
103
|
+
}
|
104
|
+
})
|
105
|
+
return this
|
106
|
+
}
|
107
|
+
|
108
|
+
Walker.prototype.doneOne = function() {
|
109
|
+
if (--this._pending === 0) this.emit('end')
|
110
|
+
return this
|
111
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2013 Naitik Shah
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|