batman-rails-flo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +29 -0
  3. data/Rakefile +2 -0
  4. data/lib/batman-rails-flo.rb +5 -0
  5. data/lib/batman_rails_flo/railtie.rb +9 -0
  6. data/lib/batman_rails_flo/tasks.rake +14 -0
  7. data/lib/batman_rails_flo/version.rb +3 -0
  8. data/vendor/assets/javascripts/batman_rails_flo/flo_server.js +67 -0
  9. data/vendor/assets/javascripts/batman_rails_flo/live_reload.js.coffee +129 -0
  10. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/CNAME +1 -0
  11. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/CONTRIBUTING.md +9 -0
  12. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/LICENSE +22 -0
  13. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/README +50 -0
  14. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/bin/cake +7 -0
  15. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/bin/coffee +7 -0
  16. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/browser.js +134 -0
  17. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/cake.js +112 -0
  18. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/coffee-script.js +335 -0
  19. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/command.js +569 -0
  20. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/grammar.js +631 -0
  21. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/helpers.js +252 -0
  22. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
  23. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/lexer.js +926 -0
  24. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/nodes.js +3158 -0
  25. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/optparse.js +139 -0
  26. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/parser.js +724 -0
  27. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/register.js +66 -0
  28. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/repl.js +163 -0
  29. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/rewriter.js +475 -0
  30. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
  31. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/lib/coffee-script/sourcemap.js +161 -0
  32. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/LICENSE +21 -0
  33. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/examples/pow.js +6 -0
  34. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/index.js +82 -0
  35. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/package.json +34 -0
  36. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/readme.markdown +63 -0
  37. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/chmod.js +38 -0
  38. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/clobber.js +37 -0
  39. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/mkdirp.js +28 -0
  40. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/perm.js +32 -0
  41. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/perm_sync.js +39 -0
  42. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/race.js +41 -0
  43. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/rel.js +32 -0
  44. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/return.js +25 -0
  45. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/return_sync.js +24 -0
  46. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/root.js +18 -0
  47. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/sync.js +32 -0
  48. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/umask.js +28 -0
  49. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/node_modules/mkdirp/test/umask_sync.js +32 -0
  50. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/package.json +50 -0
  51. data/vendor/assets/javascripts/batman_rails_flo/node_modules/coffee-script/register.js +1 -0
  52. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/LICENSE +30 -0
  53. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/PATENTS +23 -0
  54. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/README.md +124 -0
  55. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/bin/flo +26 -0
  56. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/configure.html +57 -0
  57. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/configure.js +205 -0
  58. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/configure/style.css +334 -0
  59. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/connection.js +235 -0
  60. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/devtools.html +12 -0
  61. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/index.js +323 -0
  62. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/logger.js +42 -0
  63. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/logo.png +0 -0
  64. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/manifest.json +13 -0
  65. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/client/session.js +305 -0
  66. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/index.js +10 -0
  67. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/lib/flo.js +226 -0
  68. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/lib/server.js +94 -0
  69. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/README.md +66 -0
  70. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/index.js +437 -0
  71. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/LICENSE +23 -0
  72. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/README.md +218 -0
  73. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/minimatch.js +1055 -0
  74. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/CONTRIBUTORS +14 -0
  75. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/lru-cache/LICENSE +23 -0
  76. 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
  77. 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
  78. 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
  79. 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
  80. 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
  81. 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
  82. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/LICENSE +27 -0
  83. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/README.md +53 -0
  84. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/bench.js +283 -0
  85. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/package.json +42 -0
  86. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/node_modules/sigmund/sigmund.js +39 -0
  87. 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
  88. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/package.json +40 -0
  89. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/basic.js +399 -0
  90. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/brace-expand.js +33 -0
  91. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/caching.js +14 -0
  92. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/minimatch/test/defaults.js +274 -0
  93. 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
  94. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/lib/walker.js +111 -0
  95. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/license +13 -0
  96. 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
  97. 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
  98. 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
  99. 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
  100. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/package.json +34 -0
  101. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/node_modules/makeerror/readme.md +77 -0
  102. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/package.json +36 -0
  103. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/walker/readme.md +52 -0
  104. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/LICENSE +55 -0
  105. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/main.js +128 -0
  106. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/package.json +34 -0
  107. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/readme.mkd +72 -0
  108. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/d/d/t +0 -0
  109. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/d/t +0 -0
  110. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_monitor.js +31 -0
  111. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_monitorRootDirectory.js +28 -0
  112. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js +20 -0
  113. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/package.json +45 -0
  114. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/test/test.js +243 -0
  115. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/CHANGELOG.md +81 -0
  116. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/LICENSE +177 -0
  117. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/Makefile +11 -0
  118. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/README.md +245 -0
  119. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/binding.gyp +14 -0
  120. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Makefile +355 -0
  121. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/linker.lock +0 -0
  122. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/obj.target/validation/src/validation.o +0 -0
  123. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/obj.target/xor/src/xor.o +0 -0
  124. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/validation.node +0 -0
  125. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/Release/xor.node +0 -0
  126. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/binding.Makefile +6 -0
  127. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/config.gypi +115 -0
  128. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/gyp-mac-tool +512 -0
  129. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/validation.target.mk +154 -0
  130. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/build/xor.target.mk +154 -0
  131. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/index.js +1 -0
  132. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/install.js +31 -0
  133. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Constants.js +23 -0
  134. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Deprecation.js +38 -0
  135. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Validation.fallback.js +12 -0
  136. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/Validation.js +18 -0
  137. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketClient.js +359 -0
  138. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketConnection.js +717 -0
  139. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketFrame.js +282 -0
  140. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRequest.js +478 -0
  141. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRouter.js +154 -0
  142. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketRouterRequest.js +59 -0
  143. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/WebSocketServer.js +216 -0
  144. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/utils.js +7 -0
  145. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/websocket.js +11 -0
  146. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/xor.fallback.js +13 -0
  147. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/lib/xor.js +18 -0
  148. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/package.json +43 -0
  149. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/src/validation.cc +144 -0
  150. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/src/xor.cpp +86 -0
  151. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/FastBufferList.js +192 -0
  152. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/node-ctype/LICENSE +18 -0
  153. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/websocket/vendor/node-ctype/ctio-faster.js +1126 -0
  154. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/package.json +25 -0
  155. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/browser_websocket.js +63 -0
  156. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/connection_test.js +57 -0
  157. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/logger_mock.js +15 -0
  158. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/client/session_test.js +194 -0
  159. data/vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/test/server/flo_test.js +211 -0
  160. data/vendor/assets/javascripts/batman_rails_flo/package.json +15 -0
  161. data/vendor/assets/javascripts/batman_rails_flo/reload_event_handler.js.coffee +56 -0
  162. metadata +232 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "watch",
3
+ "description": "Utilities for watching file trees.",
4
+ "tags": [
5
+ "util",
6
+ "utility",
7
+ "fs",
8
+ "files"
9
+ ],
10
+ "version": "0.10.0",
11
+ "homepage": "https://github.com/mikeal/watch",
12
+ "bugs": {
13
+ "url": "https://github.com/mikeal/watch/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git://github.com/mikeal/watch.git"
18
+ },
19
+ "author": {
20
+ "name": "Mikeal Rogers",
21
+ "email": "mikeal.rogers@gmail.com"
22
+ },
23
+ "directories": {
24
+ "lib": "lib"
25
+ },
26
+ "engines": [
27
+ "node >=0.1.95"
28
+ ],
29
+ "main": "./main",
30
+ "readme": "# watch -- Utilities for watching file trees in node.js\n\n## Install\n\n<pre>\n npm install watch\n</pre>\n\n## Purpose\n\nThe intention of this module is provide tools that make managing the watching of file & directory trees easier.\n\n#### watch.watchTree(root, [options,] callback)\n\nThe first argument is the directory root you want to watch.\n\nThe options object is passed to fs.watchFile but can also be used to provide two additional watchTree specific options:\n\n* `'ignoreDotFiles'` - When true this option means that when the file tree is walked it will ignore files that being with \".\"\n* `'filter'` - You can use this option to provide a function that returns true or false for each file and directory that is walked to decide whether or not that file/directory is included in the watcher.\n\nThe callback takes 3 arguments. The first is the file that was modified. The second is the current stat object for that file and the third is the previous stat object.\n\nWhen a file is new the previous stat object is null.\n\nWhen watchTree is finished walking the tree and adding all the listeners it passes the file hash (keys are the file/directory names and the values are the current stat objects) as the first argument and null as both the previous and current stat object arguments.\n\n<pre>\n watch.watchTree('/home/mikeal', function (f, curr, prev) {\n if (typeof f == \"object\" && prev === null && curr === null) {\n // Finished walking the tree\n } else if (prev === null) {\n // f is a new file\n } else if (curr.nlink === 0) {\n // f was removed\n } else {\n // f was changed\n }\n })\n</pre>\n\n### watch.createMonitor(root, [options,] callback)\n\nThis function creates an EventEmitter that gives notifications for different changes that happen to the file and directory tree under the given root argument.\n\nThe options object is passed to watch.watchTree.\n\nThe callback receives the monitor object.\n\nThe monitor object contains a property, `files`, which is a hash of files and directories as keys with the current stat object as the value.\n\nThe monitor has the following events.\n\n* `'created'` - New file has been created. Two arguments, the filename and the stat object.\n* `'removed'` - A file has been moved or deleted. Two arguments, the filename and the stat object for the fd.\n* `'changed'` - A file has been changed. Three arguments, the filename, the current stat object, and the previous stat object.\n\n<pre>\n var watch = require('watch')\n watch.createMonitor('/home/mikeal', function (monitor) {\n monitor.files['/home/mikeal/.zshrc'] // Stat object for my zshrc.\n monitor.on(\"created\", function (f, stat) {\n // Handle new files\n })\n monitor.on(\"changed\", function (f, curr, prev) {\n // Handle file changes\n })\n monitor.on(\"removed\", function (f, stat) {\n // Handle removed files\n })\n })\n</pre>\n",
31
+ "readmeFilename": "readme.mkd",
32
+ "_id": "watch@0.10.0",
33
+ "_from": "watch@~0.10.0"
34
+ }
@@ -0,0 +1,72 @@
1
+ # watch -- Utilities for watching file trees in node.js
2
+
3
+ ## Install
4
+
5
+ <pre>
6
+ npm install watch
7
+ </pre>
8
+
9
+ ## Purpose
10
+
11
+ The intention of this module is provide tools that make managing the watching of file & directory trees easier.
12
+
13
+ #### watch.watchTree(root, [options,] callback)
14
+
15
+ The first argument is the directory root you want to watch.
16
+
17
+ The options object is passed to fs.watchFile but can also be used to provide two additional watchTree specific options:
18
+
19
+ * `'ignoreDotFiles'` - When true this option means that when the file tree is walked it will ignore files that being with "."
20
+ * `'filter'` - You can use this option to provide a function that returns true or false for each file and directory that is walked to decide whether or not that file/directory is included in the watcher.
21
+
22
+ The callback takes 3 arguments. The first is the file that was modified. The second is the current stat object for that file and the third is the previous stat object.
23
+
24
+ When a file is new the previous stat object is null.
25
+
26
+ When watchTree is finished walking the tree and adding all the listeners it passes the file hash (keys are the file/directory names and the values are the current stat objects) as the first argument and null as both the previous and current stat object arguments.
27
+
28
+ <pre>
29
+ watch.watchTree('/home/mikeal', function (f, curr, prev) {
30
+ if (typeof f == "object" && prev === null && curr === null) {
31
+ // Finished walking the tree
32
+ } else if (prev === null) {
33
+ // f is a new file
34
+ } else if (curr.nlink === 0) {
35
+ // f was removed
36
+ } else {
37
+ // f was changed
38
+ }
39
+ })
40
+ </pre>
41
+
42
+ ### watch.createMonitor(root, [options,] callback)
43
+
44
+ This function creates an EventEmitter that gives notifications for different changes that happen to the file and directory tree under the given root argument.
45
+
46
+ The options object is passed to watch.watchTree.
47
+
48
+ The callback receives the monitor object.
49
+
50
+ The monitor object contains a property, `files`, which is a hash of files and directories as keys with the current stat object as the value.
51
+
52
+ The monitor has the following events.
53
+
54
+ * `'created'` - New file has been created. Two arguments, the filename and the stat object.
55
+ * `'removed'` - A file has been moved or deleted. Two arguments, the filename and the stat object for the fd.
56
+ * `'changed'` - A file has been changed. Three arguments, the filename, the current stat object, and the previous stat object.
57
+
58
+ <pre>
59
+ var watch = require('watch')
60
+ watch.createMonitor('/home/mikeal', function (monitor) {
61
+ monitor.files['/home/mikeal/.zshrc'] // Stat object for my zshrc.
62
+ monitor.on("created", function (f, stat) {
63
+ // Handle new files
64
+ })
65
+ monitor.on("changed", function (f, curr, prev) {
66
+ // Handle file changes
67
+ })
68
+ monitor.on("removed", function (f, stat) {
69
+ // Handle removed files
70
+ })
71
+ })
72
+ </pre>
@@ -0,0 +1,31 @@
1
+ var watch = require('../main')
2
+ , assert = require('assert')
3
+ , path = require('path')
4
+ , fs = require('fs')
5
+ , target = path.join(__dirname, "d/t")
6
+ ;
7
+
8
+ function clearFile() {
9
+ fs.writeFileSync(target, '')
10
+ }
11
+
12
+ clearFile()
13
+
14
+ // test if changed event is fired correctly
15
+ watch.createMonitor(__dirname, { interval: 150 },
16
+ function (monitor) {
17
+ monitor.once('changed', function (f) {
18
+ assert.equal(f, target);
19
+ clearFile();
20
+ process.exit(0)
21
+ })
22
+
23
+ fs.writeFile(target, 'Test Write\n', function (err) {
24
+ if (err) throw err;
25
+
26
+ setTimeout(function () {
27
+ // should have got the other assert done by now
28
+ assert.ok(false);
29
+ }, 300);
30
+ })
31
+ });
@@ -0,0 +1,28 @@
1
+ var fs, watch, watch_original;
2
+ watch = require('../main');
3
+ watch_original = require('watch');
4
+ fs = require('fs');
5
+
6
+ watch.createMonitor(__dirname, function (monitor) {
7
+ monitor.on("created", function (f, stat) {
8
+ console.log(f + " created");
9
+ });
10
+ monitor.on("changed", function (f, curr, prev) {
11
+ console.log(f + " changed");
12
+ });
13
+ monitor.on("removed", function (f, stat) {
14
+ console.log(f + " removed");
15
+ });
16
+ });
17
+
18
+ watch_original.createMonitor(__dirname, function (monitor) {
19
+ monitor.on("created", function (f, stat) {
20
+ console.log("ORIGINAL: " + f + " created");
21
+ });
22
+ monitor.on("changed", function (f, curr, prev) {
23
+ console.log("ORIGINAL: " + f + " changed");
24
+ });
25
+ monitor.on("removed", function (f, stat) {
26
+ console.log("ORIGINAL: " + f + " removed");
27
+ });
28
+ });
@@ -0,0 +1,20 @@
1
+ var fs = require('fs')
2
+ , watch = require('../main')
3
+ , assert = require('assert')
4
+ ;
5
+
6
+ //
7
+ // Demonstrate that the function of 'filter' is semantically inconsistent with
8
+ // usual convention, that returning true means 'keep this'.
9
+ //
10
+ function isDirOrQ(f, stat) { return stat.isDirectory() || f === 'Q'; }
11
+
12
+ watch.watchTree(__dirname, { filter: isDirOrQ }, function (f, curr, prev) {
13
+ if (typeof f == 'object' && prev === null && curr === null) {
14
+ Object.keys(f).forEach(function(name) {
15
+ var stat = f[name];
16
+ assert(isDirOrQ(name, stat));
17
+ fs.unwatchFile(name);
18
+ });
19
+ }
20
+ });
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "sane",
3
+ "version": "0.5.4",
4
+ "description": "Sane aims to be fast, small, and reliable file system watcher.",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/amasad/sane"
9
+ },
10
+ "scripts": {
11
+ "test": "mocha --bail"
12
+ },
13
+ "keywords": [
14
+ "watch",
15
+ "file",
16
+ "fswatcher",
17
+ "watchfile",
18
+ "fs",
19
+ "watching"
20
+ ],
21
+ "author": {
22
+ "name": "amasad"
23
+ },
24
+ "license": "MIT",
25
+ "dependencies": {
26
+ "walker": "~1.0.5",
27
+ "minimatch": "~0.2.14",
28
+ "watch": "~0.10.0"
29
+ },
30
+ "devDependencies": {
31
+ "mocha": "~1.17.1",
32
+ "rimraf": "~2.2.6"
33
+ },
34
+ "engines": {
35
+ "node": ">=0.10.0"
36
+ },
37
+ "bugs": {
38
+ "url": "https://github.com/amasad/sane/issues"
39
+ },
40
+ "homepage": "https://github.com/amasad/sane",
41
+ "readme": "sane\n----\n\nI've been driven to insanity by node filesystem watcher wrappers.\nSane aims to be fast, small, and reliable file system watcher. It does that by:\n\n* Always use fs.watch (unless polling is forced) and sensibly workaround the various issues with it\n* Sane is all JavaScript, no native components\n* Stay away from polling because it's very slow and cpu intensive\n* Support polling for environments like Vagrant shared directory where there are no native filesystem events\n\n## Install\n\nRequires node >= v0.10.0.\n\n```\n$ npm install sane\n```\n\n## API\n\n### sane(dir, globs, options)\n\nWatches a directory and all it's descendant directorys for changes, deletions, and additions on files and directories.\nShortcut for `new sane.Watcher(dir, {glob: globs, ..options})`.\n\n```js\nvar watcher = sane('path/to/dir', ['**/*.js, '**/*.css']);\nwatcher.on('ready', function () { console.log('ready') });\nwatcher.on('change', function (filepath) { console.log('file changed', filepath); });\nwatcher.on('add', function (filepath) { console.log('file added', filepath); });\nwatcher.on('delete', function (filepath) { console.log('file deleted', filepath); });\n// close\nwatcher.close();\n```\n\nFor `options` see `sane.Watcher`.\n\n### sane.Watcher(dir, options)\n\noptions:\n\n* `persistent`: boolean indicating that the process shouldn't die while we're watching files.\n* `glob`: a single string glob pattern or an array of them.\n* `poll`: puts the watcher in polling mode. Under the hood that means `fs.watchFile`.\n* `interval`: indicates how often the files should be polled. (passed to `fs.watchFile`)\n\nFor the glob pattern documentation, see [minimatch](https://github.com/isaacs/minimatch).\n\n### sane.Watcher#close\n\nStops watching.\n\n### sane.Watcher events\n\nEmits the following events:\n\nAll events are passed the file/dir path relative to the root directory\n* `ready` when the program is ready to detect events in the directory\n* `change` when a file changes\n* `add` when a file or directory has been added\n* `delete` when a file or directory has been deleted\n\n## License\n\nMIT\n",
42
+ "readmeFilename": "README.md",
43
+ "_id": "sane@0.5.4",
44
+ "_from": "sane@~0.5.1"
45
+ }
@@ -0,0 +1,243 @@
1
+ var os = require('os');
2
+ var fs = require('fs');
3
+ var sane = require('../');
4
+ var rimraf = require('rimraf');
5
+ var path = require('path');
6
+ var assert = require('assert');
7
+
8
+ var tmpdir = os.tmpdir();
9
+ var jo = path.join.bind(path);
10
+ var testdir = jo(tmpdir, 'sane_test');
11
+
12
+
13
+ describe('sane in polling mode', function() {
14
+ harness.call(this, true);
15
+ });
16
+ describe('sand in normal mode', function() {
17
+ harness.call(this, false);
18
+ });
19
+
20
+ function harness(isPolling) {
21
+ if (isPolling) this.timeout(5000);
22
+ before(function() {
23
+ rimraf.sync(testdir);
24
+ try {
25
+ fs.mkdirSync(testdir);
26
+ } catch (e) {}
27
+ for (var i = 0; i < 10; i++) {
28
+ fs.writeFileSync(jo(testdir, 'file_' + i), 'test_' + i);
29
+ var subdir = jo(testdir, 'sub_' + i);
30
+ try {
31
+ fs.mkdirSync(subdir);
32
+ } catch (e) {}
33
+ for (var j = 0; j < 10; j++) {
34
+ fs.writeFileSync(jo(subdir, 'file_' + j), 'test_' + j);
35
+ }
36
+ }
37
+ });
38
+
39
+ describe('sane(file)', function() {
40
+ beforeEach(function () {
41
+ this.watcher = new sane.Watcher(testdir, { poll: isPolling });
42
+ });
43
+
44
+ afterEach(function() {
45
+ this.watcher.close();
46
+ });
47
+
48
+ it('emits a ready event', function(done) {
49
+ this.watcher.on('ready', done);
50
+ });
51
+
52
+ it('change emits event', function(done) {
53
+ var testfile = jo(testdir, 'file_1');
54
+ this.watcher.on('change', function(filepath) {
55
+ assert.equal(filepath, path.relative(testdir, testfile));
56
+ done();
57
+ });
58
+ this.watcher.on('ready', function() {
59
+ fs.writeFileSync(testfile, 'wow');
60
+ });
61
+ });
62
+
63
+ it('emits change events for subdir files', function(done) {
64
+ var testfile = jo(testdir, 'sub_1', 'file_1');
65
+ this.watcher.on('change', function(filepath) {
66
+ assert.equal(filepath, path.relative(testdir, testfile));
67
+ done();
68
+ });
69
+ this.watcher.on('ready', function() {
70
+ fs.writeFileSync(testfile, 'wow');
71
+ });
72
+ });
73
+
74
+ it('adding a file will trigger a change', function(done) {
75
+ var testfile = jo(testdir, 'file_x' + Math.floor(Math.random() * 10000));
76
+ this.watcher.on('add', function(filepath) {
77
+ assert.equal(filepath, path.relative(testdir, testfile));
78
+ done();
79
+ });
80
+ this.watcher.on('ready', function() {
81
+ fs.writeFileSync(testfile, 'wow');
82
+ });
83
+ });
84
+
85
+ it('removing a file will emit delete event', function(done) {
86
+ var testfile = jo(testdir, 'file_9');
87
+ this.watcher.on('delete', function(filepath) {
88
+ assert.equal(filepath, path.relative(testdir, testfile));
89
+ done();
90
+ });
91
+ this.watcher.on('ready', function() {
92
+ fs.unlinkSync(testfile);
93
+ });
94
+ });
95
+
96
+ it('removing a dir will emit delete event', function(done) {
97
+ var subdir = jo(testdir, 'sub_9');
98
+ this.watcher.on('delete', function(filepath) {
99
+ // Ignore delete events for files in the dir.
100
+ if (path.dirname(filepath) === path.relative(testdir, subdir)) {
101
+ return;
102
+ }
103
+ assert.equal(filepath, path.relative(testdir, subdir));
104
+ done();
105
+ });
106
+ this.watcher.on('ready', function() {
107
+ rimraf.sync(subdir);
108
+ });
109
+ });
110
+
111
+ it('adding a dir will emit an add event', function(done) {
112
+ var subdir = jo(testdir, 'sub_x' + Math.floor(Math.random() * 10000));
113
+ this.watcher.on('add', function(filepath) {
114
+ assert.equal(filepath, path.relative(testdir, subdir));
115
+ done();
116
+ });
117
+ this.watcher.on('ready', function() {
118
+ fs.mkdirSync(subdir);
119
+ });
120
+ });
121
+
122
+ it('adding in a new subdir will trigger an add event', function(done) {
123
+ var subdir = jo(testdir, 'sub_x' + Math.floor(Math.random() * 10000));
124
+ var testfile = jo(subdir, 'file_x' + Math.floor(Math.random() * 10000));
125
+ var i = 0;
126
+ this.watcher.on('add', function(filepath) {
127
+ if (++i === 1) {
128
+ assert.equal(filepath, path.relative(testdir, subdir));
129
+ } else {
130
+ assert.equal(filepath, path.relative(testdir, testfile));
131
+ done();
132
+ }
133
+ });
134
+ this.watcher.on('ready', function() {
135
+ fs.mkdirSync(subdir);
136
+ defer(function() {
137
+ fs.writeFileSync(testfile, 'wow');
138
+ });
139
+ });
140
+ });
141
+
142
+ it('closes watchers when dirs are deleted', function(done) {
143
+ var subdir = jo(testdir, 'sub_1');
144
+ var testfile = jo(subdir, 'file_1');
145
+ var i = 0;
146
+ var actualFiles = {};
147
+ this.watcher.on('ready', function() {
148
+ this.watcher.on('add', function(filepath) {
149
+ actualFiles[filepath] = true;
150
+ if (Object.keys(actualFiles).length === 2) {
151
+ // win32 order is not guaranteed
152
+ var expectedFiles = {};
153
+ expectedFiles[path.relative(testdir, subdir)] = true;
154
+ expectedFiles[path.relative(testdir, testfile)] = true;
155
+ assert.deepEqual(
156
+ expectedFiles,
157
+ actualFiles
158
+ );
159
+ done();
160
+ }
161
+ });
162
+ rimraf.sync(subdir);
163
+ defer(function() {
164
+ fs.mkdirSync(subdir);
165
+ defer(function() {
166
+ fs.writeFileSync(testfile, 'wow');
167
+ });
168
+ });
169
+ }.bind(this));
170
+ });
171
+
172
+ it('should be ok to remove and then add the same file', function(done) {
173
+ var testfile = jo(testdir, 'sub_8', 'file_1');
174
+ var i = 0;
175
+ this.watcher.on('add', function(filepath) {
176
+ assert.equal(filepath, path.relative(testdir, testfile));
177
+ });
178
+ this.watcher.on('delete', function(filepath) {
179
+ assert.equal(filepath, path.relative(testdir, testfile));
180
+ done();
181
+ });
182
+ this.watcher.on('ready', function() {
183
+ fs.unlink(testfile);
184
+ defer(function() {
185
+ fs.writeFileSync(testfile, 'wow');
186
+ });
187
+ });
188
+ });
189
+ });
190
+
191
+ describe('sane(file, glob)', function() {
192
+ beforeEach(function () {
193
+ this.watcher = new sane.Watcher(
194
+ testdir,
195
+ { glob: ['**/file_1', '**/file_2'], poll: isPolling }
196
+ );
197
+ });
198
+
199
+ afterEach(function() {
200
+ this.watcher.close();
201
+ });
202
+
203
+ it('ignore files according to glob', function (done) {
204
+ var i = 0;
205
+ this.watcher.on('change', function(filepath) {
206
+ assert.ok(filepath.match(/file_(1|2)/), 'only file_1 and file_2');
207
+ if (++i == 2) done();
208
+ });
209
+ this.watcher.on('ready', function() {
210
+ fs.writeFileSync(jo(testdir, 'file_1'), 'wow');
211
+ fs.writeFileSync(jo(testdir, 'file_9'), 'wow');
212
+ fs.writeFileSync(jo(testdir, 'file_3'), 'wow');
213
+ fs.writeFileSync(jo(testdir, 'file_2'), 'wow');
214
+ });
215
+ });
216
+ });
217
+
218
+ describe('sane shortcut alias', function () {
219
+
220
+ beforeEach(function () {
221
+ this.watcher = sane(testdir, '**/file_1');
222
+ });
223
+
224
+ afterEach(function() {
225
+ this.watcher.close();
226
+ });
227
+
228
+ it('allows for shortcut mode using just a string as glob', function (done) {
229
+ this.watcher.on('change', function (filepath) {
230
+ assert.ok(filepath.match(/file_1/));
231
+ done();
232
+ });
233
+ this.watcher.on('ready', function() {
234
+ fs.writeFileSync(jo(testdir, 'file_1'), 'wow');
235
+ });
236
+ });
237
+ });
238
+
239
+ function defer(fn) {
240
+ setTimeout(fn, isPolling ? 1000 : 300);
241
+ }
242
+
243
+ }