traceur-rb 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (255) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +1 -0
  4. data/.ruby-gemset +1 -0
  5. data/.ruby-version +1 -0
  6. data/Gemfile +4 -0
  7. data/Guardfile +8 -0
  8. data/LICENSE.txt +22 -0
  9. data/README.md +87 -0
  10. data/Rakefile +2 -0
  11. data/lib/js/compile.js +31 -0
  12. data/lib/traceur-rb.rb +1 -0
  13. data/lib/traceur.rb +43 -0
  14. data/lib/traceur/compilation_options.rb +65 -0
  15. data/lib/traceur/compiler.rb +33 -0
  16. data/lib/traceur/configuration.rb +47 -0
  17. data/lib/traceur/node.rb +26 -0
  18. data/lib/traceur/node/command_result.rb +28 -0
  19. data/lib/traceur/node/runner.rb +40 -0
  20. data/lib/traceur/version.rb +3 -0
  21. data/spec/examples/classes.js +12 -0
  22. data/spec/integration/examples_spec.rb +28 -0
  23. data/spec/spec_helper.rb +1 -0
  24. data/spec/traceur/compilation_options_spec.rb +31 -0
  25. data/spec/traceur/configuration_spec.rb +54 -0
  26. data/spec/traceur/node_spec.rb +15 -0
  27. data/traceur-rb.gemspec +25 -0
  28. data/vendor/node_modules/.bin/traceur +3 -0
  29. data/vendor/node_modules/traceur/README.md +40 -0
  30. data/vendor/node_modules/traceur/bin/traceur-runtime.js +2101 -0
  31. data/vendor/node_modules/traceur/bin/traceur.js +23034 -0
  32. data/vendor/node_modules/traceur/node_modules/.bin/semver +125 -0
  33. data/vendor/node_modules/traceur/node_modules/commander/Readme.md +208 -0
  34. data/vendor/node_modules/traceur/node_modules/commander/index.js +852 -0
  35. data/vendor/node_modules/traceur/node_modules/commander/package.json +40 -0
  36. data/vendor/node_modules/traceur/node_modules/q-io/.npmignore +1 -0
  37. data/vendor/node_modules/traceur/node_modules/q-io/.travis.yml +3 -0
  38. data/vendor/node_modules/traceur/node_modules/q-io/CHANGES.md +122 -0
  39. data/vendor/node_modules/traceur/node_modules/q-io/LICENSE +19 -0
  40. data/vendor/node_modules/traceur/node_modules/q-io/README.md +928 -0
  41. data/vendor/node_modules/traceur/node_modules/q-io/buffer-stream.js +59 -0
  42. data/vendor/node_modules/traceur/node_modules/q-io/coverage-report.js +44 -0
  43. data/vendor/node_modules/traceur/node_modules/q-io/deprecate.js +51 -0
  44. data/vendor/node_modules/traceur/node_modules/q-io/fs-boot.js +307 -0
  45. data/vendor/node_modules/traceur/node_modules/q-io/fs-common.js +499 -0
  46. data/vendor/node_modules/traceur/node_modules/q-io/fs-mock.js +547 -0
  47. data/vendor/node_modules/traceur/node_modules/q-io/fs-root.js +105 -0
  48. data/vendor/node_modules/traceur/node_modules/q-io/fs.js +355 -0
  49. data/vendor/node_modules/traceur/node_modules/q-io/fs2http.js +65 -0
  50. data/vendor/node_modules/traceur/node_modules/q-io/http-apps.js +152 -0
  51. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/chain.js +24 -0
  52. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/content.js +93 -0
  53. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/cookie.js +154 -0
  54. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/decorators.js +178 -0
  55. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/fs.js +417 -0
  56. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/html.js +58 -0
  57. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/json.js +78 -0
  58. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/negotiate.js +120 -0
  59. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/proxy.js +27 -0
  60. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/redirect.js +209 -0
  61. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/route.js +125 -0
  62. data/vendor/node_modules/traceur/node_modules/q-io/http-apps/status.js +175 -0
  63. data/vendor/node_modules/traceur/node_modules/q-io/http-cookie.js +75 -0
  64. data/vendor/node_modules/traceur/node_modules/q-io/http.js +378 -0
  65. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.npmignore +11 -0
  66. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/.travis.yml +4 -0
  67. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/CHANGES.md +78 -0
  68. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/LICENSE.md +21 -0
  69. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/README.md +1285 -0
  70. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/collections.js +22 -0
  71. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/dict.js +142 -0
  72. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-map.js +57 -0
  73. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/fast-set.js +183 -0
  74. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-collection.js +261 -0
  75. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-map.js +186 -0
  76. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-order.js +55 -0
  77. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/generic-set.js +59 -0
  78. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/heap.js +236 -0
  79. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/iterator.js +371 -0
  80. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/list.js +435 -0
  81. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/array-changes.js +247 -0
  82. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/map-changes.js +147 -0
  83. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/property-changes.js +448 -0
  84. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/listen/range-changes.js +139 -0
  85. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-map.js +79 -0
  86. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/lru-set.js +142 -0
  87. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/map.js +60 -0
  88. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/multi-map.js +41 -0
  89. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/package.json +12 -0
  90. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync +7 -0
  91. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/sync.patch +48 -0
  92. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/node_modules/weak-map/weak-map.js +590 -0
  93. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/package.json +49 -0
  94. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/set.js +173 -0
  95. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-array.js +274 -0
  96. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-function.js +59 -0
  97. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-object.js +538 -0
  98. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim-regexp.js +14 -0
  99. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/shim.js +6 -0
  100. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-map.js +49 -0
  101. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array-set.js +51 -0
  102. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-array.js +269 -0
  103. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-map.js +61 -0
  104. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/sorted-set.js +736 -0
  105. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/tree-log.js +40 -0
  106. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/collections/weak-map.js +1 -0
  107. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/LICENSE +19 -0
  108. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/README.md +66 -0
  109. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/mime.js +114 -0
  110. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/package.json +35 -0
  111. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/test.js +84 -0
  112. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/mime.types +1588 -0
  113. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mime/types/node.types +77 -0
  114. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/CHANGES +15 -0
  115. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/LICENSE +19 -0
  116. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/README +96 -0
  117. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/lib/mimeparse.js +166 -0
  118. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/mimeparse/package.json +43 -0
  119. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/CONTRIBUTING.md +40 -0
  120. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/LICENSE +19 -0
  121. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/README.md +813 -0
  122. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/compare-with-callbacks.js +71 -0
  123. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/benchmark/scenarios.js +36 -0
  124. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/package.json +93 -0
  125. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/q.js +1937 -0
  126. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/q/queue.js +35 -0
  127. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/.gitmodules +6 -0
  128. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/History.md +36 -0
  129. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Makefile +7 -0
  130. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/Readme.md +38 -0
  131. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/benchmark.js +32 -0
  132. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/examples.js +39 -0
  133. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/index.js +2 -0
  134. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/lib/querystring.js +123 -0
  135. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/package.json +19 -0
  136. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.gitmodules +3 -0
  137. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/.npmignore +3 -0
  138. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/History.md +128 -0
  139. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Makefile +53 -0
  140. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/Readme.md +61 -0
  141. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/bin/expresso +856 -0
  142. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/api.html +1080 -0
  143. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.html +377 -0
  144. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/index.md +290 -0
  145. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/foot.html +3 -0
  146. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/docs/layout/head.html +42 -0
  147. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/bar.js +4 -0
  148. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/lib/foo.js +16 -0
  149. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/package.json +12 -0
  150. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/assert.test.js +91 -0
  151. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/async.test.js +12 -0
  152. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/bar.test.js +13 -0
  153. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/foo.test.js +14 -0
  154. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/http.test.js +146 -0
  155. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/async.test.js +39 -0
  156. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/expresso/test/serial/http.test.js +48 -0
  157. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/.gitmodules +3 -0
  158. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/History.md +22 -0
  159. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Makefile +6 -0
  160. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/Readme.md +248 -0
  161. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/examples/runner.js +53 -0
  162. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/index.js +2 -0
  163. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/eql.js +91 -0
  164. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/lib/should.js +548 -0
  165. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/package.json +8 -0
  166. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/support/should/test/should.test.js +358 -0
  167. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/qs/test/querystring.test.js +133 -0
  168. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.npmignore +3 -0
  169. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/.travis.yml +4 -0
  170. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/LICENSE.md +20 -0
  171. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/README.md +33 -0
  172. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/package.json +37 -0
  173. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/test/url2-spec.js +125 -0
  174. data/vendor/node_modules/traceur/node_modules/q-io/node_modules/url2/url2.js +151 -0
  175. data/vendor/node_modules/traceur/node_modules/q-io/package.json +51 -0
  176. data/vendor/node_modules/traceur/node_modules/q-io/reader.js +133 -0
  177. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/boot-directory-spec.js +47 -0
  178. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/contains-spec.js +11 -0
  179. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/fixtures/hello.txt +1 -0
  180. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/issues/1-spec.js +33 -0
  181. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/make-tree-spec.js +92 -0
  182. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/append-spec.js +41 -0
  183. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/copy-tree-spec.js +57 -0
  184. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/fixture/hello.txt +1 -0
  185. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/link-spec.js +70 -0
  186. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/make-tree-spec.js +109 -0
  187. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/merge-spec.js +67 -0
  188. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/move-spec.js +219 -0
  189. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/object-spec.js +20 -0
  190. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/range-spec.js +26 -0
  191. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/read-spec.js +40 -0
  192. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-directory-spec.js +37 -0
  193. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/remove-tree-spec.js +39 -0
  194. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/root-spec.js +32 -0
  195. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/stat-spec.js +26 -0
  196. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/symbolic-link-spec.js +86 -0
  197. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/working-directory-spec.js +31 -0
  198. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/mock/write-spec.js +73 -0
  199. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.js +23 -0
  200. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/range-spec.txt +1 -0
  201. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/read-spec.js +22 -0
  202. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/relative-spec.js +25 -0
  203. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/reroot-spec.js +45 -0
  204. data/vendor/node_modules/traceur/node_modules/q-io/spec/fs/write-spec.js +38 -0
  205. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/cookie-spec.js +52 -0
  206. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/directory-list-spec.js +86 -0
  207. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/01234.txt +1 -0
  208. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/1234.txt +1 -0
  209. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/5678.txt +0 -0
  210. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/fixtures/9012/3456.txt +0 -0
  211. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/hosts-spec.js +49 -0
  212. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/interpret-range-spec.js +47 -0
  213. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/partial-range-spec.js +186 -0
  214. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/proxy-spec.js +82 -0
  215. data/vendor/node_modules/traceur/node_modules/q-io/spec/http-apps/symbolic-link-spec.js +110 -0
  216. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/agent-spec.js +96 -0
  217. data/vendor/node_modules/traceur/node_modules/q-io/spec/http/basic-spec.js +96 -0
  218. data/vendor/node_modules/traceur/node_modules/q-io/spec/lib/jasmine-promise.js +42 -0
  219. data/vendor/node_modules/traceur/node_modules/q-io/writer.js +111 -0
  220. data/vendor/node_modules/traceur/node_modules/semver/.npmignore +1 -0
  221. data/vendor/node_modules/traceur/node_modules/semver/LICENSE +27 -0
  222. data/vendor/node_modules/traceur/node_modules/semver/Makefile +24 -0
  223. data/vendor/node_modules/traceur/node_modules/semver/README.md +158 -0
  224. data/vendor/node_modules/traceur/node_modules/semver/bin/semver +125 -0
  225. data/vendor/node_modules/traceur/node_modules/semver/foot.js +6 -0
  226. data/vendor/node_modules/traceur/node_modules/semver/head.js +2 -0
  227. data/vendor/node_modules/traceur/node_modules/semver/package.json +31 -0
  228. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js +1039 -0
  229. data/vendor/node_modules/traceur/node_modules/semver/semver.browser.js.gz +0 -0
  230. data/vendor/node_modules/traceur/node_modules/semver/semver.js +1043 -0
  231. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js +1 -0
  232. data/vendor/node_modules/traceur/node_modules/semver/semver.min.js.gz +0 -0
  233. data/vendor/node_modules/traceur/node_modules/semver/test/amd.js +15 -0
  234. data/vendor/node_modules/traceur/node_modules/semver/test/gtr.js +173 -0
  235. data/vendor/node_modules/traceur/node_modules/semver/test/index.js +584 -0
  236. data/vendor/node_modules/traceur/node_modules/semver/test/ltr.js +174 -0
  237. data/vendor/node_modules/traceur/node_modules/semver/test/no-module.js +19 -0
  238. data/vendor/node_modules/traceur/package.json +64 -0
  239. data/vendor/node_modules/traceur/src/node/System.js +31 -0
  240. data/vendor/node_modules/traceur/src/node/api.js +124 -0
  241. data/vendor/node_modules/traceur/src/node/command.js +141 -0
  242. data/vendor/node_modules/traceur/src/node/compile-single-file.js +69 -0
  243. data/vendor/node_modules/traceur/src/node/compiler.js +116 -0
  244. data/vendor/node_modules/traceur/src/node/deferred.js +110 -0
  245. data/vendor/node_modules/traceur/src/node/file-util.js +73 -0
  246. data/vendor/node_modules/traceur/src/node/getopt.js +147 -0
  247. data/vendor/node_modules/traceur/src/node/inline-module.js +149 -0
  248. data/vendor/node_modules/traceur/src/node/interpreter.js +33 -0
  249. data/vendor/node_modules/traceur/src/node/nodeLoader.js +41 -0
  250. data/vendor/node_modules/traceur/src/node/require.js +85 -0
  251. data/vendor/node_modules/traceur/src/node/to-amd-compiler.js +33 -0
  252. data/vendor/node_modules/traceur/src/node/to-commonjs-compiler.js +33 -0
  253. data/vendor/node_modules/traceur/src/node/traceur.js +32 -0
  254. data/vendor/node_modules/traceur/traceur +3 -0
  255. metadata +359 -0
@@ -0,0 +1,3 @@
1
+ node_modules
2
+ .coverage_data
3
+ cover_html
@@ -0,0 +1,4 @@
1
+ language: node_js
2
+ node_js:
3
+ - 0.6
4
+ - 0.8
@@ -0,0 +1,20 @@
1
+
2
+ Copyright 2009–2012 Kristopher Michael Kowal. All rights reserved.
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to
5
+ deal in the Software without restriction, including without limitation the
6
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7
+ sell copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19
+ IN THE SOFTWARE.
20
+
@@ -0,0 +1,33 @@
1
+
2
+ URL2
3
+ ----
4
+
5
+ This module builds upon the existing URL module in NodeJS, but adds
6
+ `relative(source, target)` which returns the shortest relative path
7
+ between any two equally qualified URL’s. If the paths are not equally
8
+ qualified, it returns the target.
9
+
10
+ In addition, this package augments the URL object definition as returned
11
+ by `parse` and consumed by `format`.
12
+
13
+ - `pathname` is broken down into
14
+ - `root`: whether the path is qualified from the root of the
15
+ domain.
16
+ - `relative`: the relative path, from the root if `pathname` is
17
+ qualified from the domain root.
18
+ - `directories`: an array of path components
19
+ - `file`: the name of the file, or null if the URL points to a
20
+ directory, indicated by a final slash.
21
+
22
+ Additionally, `format` uses the `path` property if it exists, instead of
23
+ `pathname` and `search`.
24
+
25
+ ----
26
+
27
+ Based on my earlier work for [Narwhal][].
28
+
29
+ [Narwhal]: https://github.com/kriskowal/narwhal-lib/blob/master/lib/narwhal/uri.js
30
+
31
+ Copyright 2012 Kristopher Michael Kowal. All rights reserved.
32
+ MIT License
33
+
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "url2",
3
+ "version": "0.0.0",
4
+ "description": "Node's URL module plus relative pathing",
5
+ "author": {
6
+ "name": "Kris Kowal",
7
+ "email": "kris@cixar.com",
8
+ "url": "https://github.com/kriskowal/url2"
9
+ },
10
+ "homepage": "https://github.com/kriskowal/url2",
11
+ "keywords": [
12
+ "url"
13
+ ],
14
+ "main": "url2.js",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git://github.com/kriskowal/url2.git"
18
+ },
19
+ "devDependencies": {
20
+ "jshint": ">=0.9.1",
21
+ "jasmine-node": "*",
22
+ "cover": "*",
23
+ "opener": "*"
24
+ },
25
+ "scripts": {
26
+ "test": "jasmine-node test",
27
+ "lint": "jshint url2.js",
28
+ "cover": "cover run node_modules/jasmine-node/bin/jasmine-node test && cover report html && opener cover_html/index.html"
29
+ },
30
+ "readme": "\nURL2\n----\n\nThis module builds upon the existing URL module in NodeJS, but adds\n`relative(source, target)` which returns the shortest relative path\nbetween any two equally qualified URL’s. If the paths are not equally\nqualified, it returns the target.\n\nIn addition, this package augments the URL object definition as returned\nby `parse` and consumed by `format`.\n\n- `pathname` is broken down into\n - `root`: whether the path is qualified from the root of the\n domain.\n - `relative`: the relative path, from the root if `pathname` is\n qualified from the domain root.\n - `directories`: an array of path components\n - `file`: the name of the file, or null if the URL points to a\n directory, indicated by a final slash.\n\nAdditionally, `format` uses the `path` property if it exists, instead of\n`pathname` and `search`.\n\n----\n\nBased on my earlier work for [Narwhal][].\n\n[Narwhal]: https://github.com/kriskowal/narwhal-lib/blob/master/lib/narwhal/uri.js\n\nCopyright 2012 Kristopher Michael Kowal. All rights reserved.\nMIT License\n\n",
31
+ "readmeFilename": "README.md",
32
+ "bugs": {
33
+ "url": "https://github.com/kriskowal/url2/issues"
34
+ },
35
+ "_id": "url2@0.0.0",
36
+ "_from": "url2@~0.0.0"
37
+ }
@@ -0,0 +1,125 @@
1
+
2
+ var URL = require("../url2");
3
+
4
+ var tests = [
5
+
6
+ {
7
+ source: "",
8
+ target: "",
9
+ relative: ""
10
+ },
11
+
12
+ {
13
+ source: "foo/bar/",
14
+ target: "foo/bar/",
15
+ relative: ""
16
+ },
17
+
18
+ {
19
+ source: "foo/bar/baz",
20
+ target: "foo/bar/",
21
+ relative: "./"
22
+ },
23
+
24
+ {
25
+ source: "foo/bar/",
26
+ target: "/foo/bar/",
27
+ relative: "/foo/bar/"
28
+ },
29
+
30
+ {
31
+ source: "/foo/bar/baz",
32
+ target: "/foo/bar/quux",
33
+ relative: "quux"
34
+ },
35
+
36
+ {
37
+ source: "/foo/bar/baz",
38
+ target: "/foo/bar/quux/asdf",
39
+ relative: "quux/asdf"
40
+ },
41
+
42
+ {
43
+ source: "/foo/bar/baz",
44
+ target: "/foo/bar/quux/baz",
45
+ relative: "quux/baz"
46
+ },
47
+
48
+ {
49
+ source: "/foo/bar/baz",
50
+ target: "/foo/quux/baz",
51
+ relative: "../quux/baz"
52
+ },
53
+
54
+ {
55
+ source: "/foo/bar/baz",
56
+ target: "/foo/quux/baz?a=10",
57
+ relative: "../quux/baz?a=10"
58
+ },
59
+
60
+ {
61
+ source: "/foo/bar/baz?a=10",
62
+ target: "/foo/quux/baz?a=10",
63
+ relative: "../quux/baz?a=10"
64
+ },
65
+
66
+ {
67
+ source: "/foo/bar/baz?b=20",
68
+ target: "/foo/quux/baz?a=10",
69
+ relative: "../quux/baz?a=10"
70
+ },
71
+
72
+ {
73
+ source: "http://example.com",
74
+ target: "/foo/bar",
75
+ relative: "/foo/bar"
76
+ },
77
+
78
+ {
79
+ source: "",
80
+ target: "http://example.com/foo/bar",
81
+ relative: "http://example.com/foo/bar"
82
+ },
83
+
84
+ {
85
+ source: "",
86
+ target: "#foo",
87
+ relative: "#foo"
88
+ },
89
+
90
+ {
91
+ source: "",
92
+ target: "?a=10",
93
+ relative: "?a=10"
94
+ },
95
+
96
+ {
97
+ source: "?a=10",
98
+ target: "#foo",
99
+ relative: "?a=10#foo"
100
+ }
101
+
102
+ ];
103
+
104
+ describe("relative", function () {
105
+
106
+ tests.forEach(function (test) {
107
+ it(
108
+ test.label || (
109
+ "from " + JSON.stringify(test.source) + " " +
110
+ "to " + JSON.stringify(test.target)
111
+ ),
112
+ function () {
113
+ expect(URL.relative(test.source, test.target))
114
+ .toBe(test.relative)
115
+ }
116
+ )
117
+ });
118
+
119
+ it("should format a url with a path property", function () {
120
+ expect(URL.format({path: "a/b"})).toEqual("a/b");
121
+ expect(URL.format({path: "a/b?c=d"})).toEqual("a/b?c=d");
122
+ });
123
+
124
+ });
125
+
@@ -0,0 +1,151 @@
1
+
2
+ var URL = require("url");
3
+
4
+ // Node’s URL parse produces:
5
+ // http://user:password@foo.com:8080/path/to/foo/bar?a=10&c=20&d=30#hash
6
+ // ^ ^^^^- auth ----^ ^-----^ |^- pathname----^^- search-----^^ ^
7
+ // | ||| hostname | ^- query ----^| |
8
+ // proto|| | ^--^^- path ----------------------^| |
9
+ // | slashes | port hash^
10
+ // | ^- host ---^ |
11
+ // ^- href ------------------------------------------------------------^
12
+
13
+ // Node's URL format uses:
14
+ // protocol: gets a colon added if it doesn't have one yet
15
+ // slashes: used
16
+ // auth: used
17
+ // hostname: used if there's no host
18
+ // port: used if there's no host
19
+ // path: NOT USED AT ALL EVER
20
+ // pathname: used
21
+ // search: used
22
+ // query: used if object and no search
23
+ // hash: used
24
+
25
+ exports.resolve = URL.resolve;
26
+ exports.resolveObject = URL.resolveObject;
27
+
28
+ exports.parse = parse;
29
+ function parse(url) {
30
+ var object = URL.parse(url);
31
+ object.pathname = object.pathname || "";
32
+ object.root = !!object.pathname.length && object.pathname[0] === "/";
33
+ if (object.root) {
34
+ object.relative = object.pathname.slice(1);
35
+ } else {
36
+ object.relative = object.pathname;
37
+ }
38
+ if (object.relative.length) {
39
+ object.directories = object.relative.split("/");
40
+ object.file = object.directories.pop();
41
+ } else {
42
+ object.directories = [];
43
+ object.file = null;
44
+ }
45
+ return object;
46
+ }
47
+
48
+ exports.format = format;
49
+ function format(object) {
50
+
51
+ if ("file" in object) {
52
+ object.directories.push(object.file);
53
+ delete object.file;
54
+ }
55
+
56
+ if ("directories" in object) {
57
+ object.relative = object.directories.join("/");
58
+ delete object.directories;
59
+ }
60
+
61
+ if ("relative" in object) {
62
+ if (object.root) {
63
+ object.pathname = "/" + object.relative;
64
+ } else {
65
+ object.pathname = object.relative;
66
+ }
67
+ delete object.relative;
68
+ }
69
+
70
+ if (object.path != null) {
71
+ var index = object.path.indexOf("?");
72
+ if (index == -1) {
73
+ object.pathname = object.path;
74
+ object.search = "";
75
+ } else {
76
+ object.pathname = object.path.slice(0, index);
77
+ object.search = object.path.slice(index);
78
+ }
79
+ }
80
+
81
+ return URL.format(object);
82
+ }
83
+
84
+ exports.relativeObject = relativeObject;
85
+ function relativeObject(source, target) {
86
+ source = parse(source);
87
+ target = parse(target);
88
+
89
+ delete target.href;
90
+
91
+ if (
92
+ target.protocol === source.protocol &&
93
+ target.slashes === source.slashes &&
94
+ target.auth === source.auth &&
95
+ target.host === source.host
96
+ ) {
97
+ delete target.protocol;
98
+ delete target.slashes;
99
+ delete target.auth;
100
+ delete target.hostname;
101
+ delete target.port;
102
+ delete target.host;
103
+
104
+ if (
105
+ !!target.root == !!source.root && !(
106
+ target.root &&
107
+ target.directories[0] != source.directories[0]
108
+ )
109
+ ) {
110
+ delete target.path;
111
+ delete target.root;
112
+ while (
113
+ source.directories.length &&
114
+ target.directories.length &&
115
+ target.directories[0] == source.directories[0]
116
+ ) {
117
+ target.directories.shift();
118
+ source.directories.shift();
119
+ }
120
+ while (source.directories.length) {
121
+ source.directories.shift();
122
+ target.directories.unshift('..');
123
+ }
124
+
125
+ if (
126
+ !target.root &&
127
+ !target.directories.length &&
128
+ !target.file && source.file
129
+ ) {
130
+ target.directories.push('.');
131
+ }
132
+
133
+ if (
134
+ target.directories.length === 0 &&
135
+ target.file === null &&
136
+ source.search
137
+ ) {
138
+ target.search = source.search;
139
+ }
140
+
141
+ }
142
+ }
143
+
144
+ return target;
145
+ }
146
+
147
+ exports.relative = relative;
148
+ function relative(source, target) {
149
+ return format(relativeObject(source, target));
150
+ }
151
+
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "q-io",
3
+ "version": "1.10.9",
4
+ "description": "IO using Q promises",
5
+ "homepage": "http://github.com/kriskowal/q-io/",
6
+ "author": {
7
+ "name": "Kris Kowal",
8
+ "email": "kris@cixar.com",
9
+ "url": "http://github.com/kriskowal/"
10
+ },
11
+ "bugs": {
12
+ "url": "http://github.com/kriskowal/q-io/issues"
13
+ },
14
+ "licenses": [
15
+ {
16
+ "type": "MIT",
17
+ "url": "http://github.com/kriskowal/q-io/raw/master/LICENSE"
18
+ }
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "http://github.com/kriskowal/q-io.git"
23
+ },
24
+ "dependencies": {
25
+ "q": "~0.9.7",
26
+ "qs": "~0.1.0",
27
+ "url2": "~0.0.0",
28
+ "mime": "~1.2.11",
29
+ "mimeparse": "~0.1.4",
30
+ "collections": "~0.2.0"
31
+ },
32
+ "devDependencies": {
33
+ "jshint": "~0.9.1",
34
+ "cover": "~0.2.8",
35
+ "jasmine-node": "~1.7",
36
+ "opener": "~1.3"
37
+ },
38
+ "scripts": {
39
+ "test": "jasmine-node spec",
40
+ "test-browser": "opener spec/q-spec.html",
41
+ "lint": "jshint q.js",
42
+ "cover": "cover run jasmine-node spec && cover report html && opener cover_html/index.html"
43
+ },
44
+ "engines": {
45
+ "node": ">=0.6.0"
46
+ },
47
+ "readme": "\n[![Build Status](https://secure.travis-ci.org/kriskowal/q-io.png)](http://travis-ci.org/kriskowal/q-io)\n\n# Q-IO\n\nInterfaces for IO that make use of promises.\n\nQ-IO now subsumes all of [Q-HTTP][] and [Q-FS][].\n\n[Q-HTTP]: https://github.com/kriskowal/q-http\n[Q-FS]: https://github.com/kriskowal/q-fs\n\nThe Q-IO package does not export a main module. You must reach in\ndirectly for `q-io/fs`, `q-io/http`, and `q-io/http-apps`.\n\n## Filesystem\n\n```javascript\nvar FS = require(\"q-io/fs\");\n```\n\nFile system API for Q promises with method signatures patterned after\n[CommonJS/Fileystem/A](http://wiki.commonjs.org/wiki/Filesystem/A) but\nreturning promises and promise streams.\n\n### open(path, options)\n\nOpen returns a promise for either a buffer or string Reader or a Writer\ndepending on the flags.\n\nThe options can be omitted, abbreviated to a `flags` string, or expanded\nto an `options` object.\n\n- ``flags``: ``r``, ``w``, ``a``, ``b``, default of `r`, not bytewise\n- ``charset``: default of ``utf-8``\n- ``bufferSize``: in bytes\n- ``mode``: UNIX permissions\n- ``begin`` first byte to read (defaults to zero)\n- ``end`` one past the last byte to read. ``end - begin == length``\n\n### read(path, options)\n\n`read` is a shortcut for opening a file and reading the entire contents\ninto memory. It returns a promise for the whole file contents. By\ndefault, `read` provides a string decoded from UTF-8. With the bytewise\nmode flag, provides a `Buffer`.\n\nThe options argument is identical to that of `open`. \n\n```javascript\nreturn FS.read(__filename, \"b\")\n.then(function (content) {\n // ...\n})\n```\n\n```javascript\nreturn FS.read(__filename, {\n flags: \"b\"\n})\n```\n\n### write(path, content, options)\n\n`write` is a shortcut for opening a file and writing its entire content\nfrom a single string or buffer.\n\nThe options are identical to that of `open`, but the \"w\" flag is\nimplied, and the \"b\" flag is implied if the content is a buffer.\n\n```javascript\nreturn FS.write(\"hello.txt\", \"Hello, World!\\n\")\n.then(function () {\n return FS.read(\"hello.txt\")\n})\n.then(function (hello) {\n expect(hello).toBe(\"Hello, World!\\n\")\n})\n```\n\n### append(path, content, options)\n\n`append` is a shorthand for opening a file for writing from the end of\nthe existing content from a single string or buffer.\n\nThe options are identical to that of `open`, but the \"w+\" flags are\nimplied, and the \"b\" flag is implied if the content is a buffer.\n\n### copy(source, target)\n\nCopies a single file from one path to another. The target must be the\nfull path, including the file name. Unlike at the shell, the file name\nis not inferred from the source path if the target turns out to be a\ndirectory.\n\nReturns a promise for the completion of the operation.\n\n### copyTree(source, target)\n\nCopies a file or tree of files from one path to another. Symbolic links\nare copied but not followed.\n\nReturns a promise for the completion of the operation.\n\n### list(path)\n\nReturns a promise for a list of file names in a directory. The file\nnames are relative to the given path.\n\n### listTree(path, guard(path, stat))\n\nReturns a promise for a list of files in a directory and all the\ndirectories it contains. Does not follow symbolic links.\n\nThe second argument is an optional guard function that determines what\nfiles to include and whether to traverse into another directory. It\nreceives the path of the file, relative to the starting path, and also\nthe stats object for that file. The guard must return a value like:\n\n- `true` indicates that the entry should be included\n- `false` indicates that the file should be excluded, but should still\n be traversed if it is a directory.\n- `null` indiciates that a directory should not be traversed.\n\n### listDirectoryTree(path)\n\nReturns a promise for a deep list of directories.\n\n### makeDirectory(path, mode)\n\nMakes a directory at a given path. Fails if the parent directory does\nnot exist. Returns a promise for the completion of the operation.\n\nThe mode is an optional Unix mode as an integer or string of octal\ndigits.\n\n### makeTree(path, mode)\n\nFinishes a path of directories. For any branch of the path that does\nnot exist, creates a directory. Fails if any branch of the path already\nexists but is not a directory.\n\nMakes any directories with the given Unix mode.\n\n### remove(path)\n\nRemoves a file at the given path. Fails if a directory exists at the\ngiven path or if no file exists at the path.\n\n### removeTree(path)\n\nRemoves a file or directory at a given path, recursively removing any\ncontained files and directories, without following symbolic links.\n\n### rename(source, target)\n\nMoves a file or directory from one path to another using the underlying\n`rename(2)` implementation, thus it cannot move a file across devices.\n\n### move(source, target)\n\nMoves a file or directory from one path to another. If the source and\ntarget are on different devices, falls back to copying and removing,\nusing `copyTree(source, target)` and, if completely successful,\n`removeTree(source)`.\n\n### link(source, taget)\n\nCreates a hard link from the source\n\n### symbolicCopy(source, target, type)\n\nCreates a relative symoblic link from the target to the source with an\neffect that resembles copying a file.\n\nThe type is important for Windows. It is \"file\" by default, but may be\n\"directory\" or \"junction\".\n\n### symbolicLink(target, link, type)\n\nCreates a symbolic link at the target path. The link may be absolute or\nrelative. The type *must* be \"file\", \"directory\", or \"junction\" and is\nmandatory to encourage Windows portability.\n\n### chown(path, uid, gid)\n\nChanges the owner for a path using Unix user-id and group-id numbers.\n\n### chmod(path, mode)\n\nChanges the Unix mode for a path. Returns a promise.\n\n### stat(path)\n\nFollows all symoblic links along a path and returns a promise for the\nmetadata about a path as a `Stats` object. The Stats object implements:\n\n- `size` the size of the file in bytes\n- `isDirectory()`: returns whether the path refers to a directory with\n entries for other paths.\n- `isFile()`: returns whether the path refers to a file physically\n stored by the file system.\n- `isBlockDevice()`: returns whether the path refers to a Unix device\n driver, in which case there is no actual data in storage but the\n operating system may allow you to communicate with the driver as a\n blocks of memory.\n- `isCharacterDevice()`: returns whether the path refers to a Unix\n device driver, in which case there is no actual data in storage but\n the operating system may allow you to communicate with the driver as\n a stream.\n- `isSymbolicLink()`: returns whether the path refers to a symbolic\n link or junction. Stats for symbolic links are only discoverable\n through `statLink` since `stat` follows symbolic links.\n- `isFIFO()`: returns whether the path refers to a Unix named pipe.\n- `isSocket()`: returns whether the path refers to a Unix domain\n socket.\n- `lastModified()`: returns the last time the path was opened for\n writing as a `Date`\n- `lastAccessed()`: returns the last time the path was opened for\n reading or writing as a `Date`\n\n### statLink(path)\n\nReturns a promise for the `Stats` for a path without following symbolic\nlinks.\n\n### statFd(fd)\n\nReturns a promise for the `Stats` for a Unix file descriptor number.\n\n### exists(path)\n\nFollows symoblic links and returns a promise for whether an entry exists\nat a given path.\n\n### isFile(path)\n\nFollows symbolic links and returns a promise for whether a file exists\nat a given path and does not cause an exception if nothing exists at\nthat path.\n\n### isDirectory(path)\n\nFollows symbolic links and returns a promise for whether a directory\nexists at a given path and does not cause an exception if nothing exists\nat that path.\n\n### isSymbolicLink(path)\n\nReturns a promise for whether a symbolic link exists at a given path and\ndoes not cause an exception if nothing exists at that path.\n\n### lastModified(path)\n\nFollows symbolic links and returns a promise for the `Date` when the\nentry at the given path was last opened for writing, but causes an\nexception if no file exists at that path.\n\n### lastAccessed(path)\n\nFollows symbolic links and returns a promise for the `Date` when the\nentry at the given path was last opened for reading or writing, but\ncauses an exception if no file exists at that path.\n\n### split(path)\n\nSplits a path into the names of entries along the path. If the path is\nabsolute, the first component is either a drive (with a colon) on\nWindows or an empty string for the root of a Unix file system.\n\n### join(paths) or join(...paths)\n\nJoins a sequence of paths into a single normalized path. All but the\nlast path are assumed to refer to directories.\n\n### resolve(...paths)\n\nLike join but treats each path like a relative URL, so a terminating\nslash indicates that a path is to a directory and the next path begins\nat that directory.\n\n### normal(...paths)\n\nTakes a single path or sequence of paths and joins them into a single\npath, eliminating self `.` and parent `..` entries when possible.\n\n### absolute(path)\n\nJoins and normalizes a path from the current working directory,\nreturning a string.\n\n### canonical(path)\n\nReturns a promise for the absolute, canonical location of a given path,\nfollowing symbolic links and normalizing path components. An entry does\nnot need to exist at the end of the path.\n\n### readLink(path)\n\nReturns a promise for the path string of a symbolic link at a given\npath.\n\n### contains(parent, child)\n\nFor any two absolute or relative paths, computes whether the parent path\nis an ancestor of the child path.\n\n### relative(source, target)\n\nReturns a promise for the relative path from one path to another using\n`..` parent links where necessary. This operation is asynchronous\nbecause it is necessary to determine whether the source path refers to a\ndirectory or a file.\n\n### relativeFromFile(source, target)\n\nAssuming that the source path refers to a file, returns a string for the\nrelative path from the source to the target path.\n\n### relativeFromDirectory(source, target)\n\nAssuming that the source path refers to a directory, returns a string\nfor the relative path from the source to the target path.\n\n### isAbsolute(path)\n\nReturns whether a path begins at the root of a Unix file system or a\nWindows drive.\n\n### isRelative(path)\n\nReturns whether a path does not begin at the root of a Unix file system\nor Windows drive.\n\n### isRoot(path)\n\nReturns whether a path is to the root of a Unix file system or a Windows\ndrive.\n\n### root(path)\n\nReturns the Windows drive that contains a given path, or the root of a\nUnix file system.\n\n### directory(path)\n\nReturns the path to the directory containing the given path.\n\n### base(path, extension)\n\nReturns the last entry of a path. If an extension is provided and\nmatches the extension of the path, removes that extension.\n\n### extension(path)\n\nReturns the extension for a path (everything following the last dot `.`\nin a path, unless that dot is at the beginning of the entry).\n\n### reroot(path)\n\nReturns an attenuated file system that uses the given path as its root.\nThe resulting file system object is identical to the parent except that\nthe child cannot open any file that is not within the root. Hard links\nare effectively inside the root regardless, but symbolic links cannot be\nfollowed outside of the jail.\n\n### toObject(path)\n\nReads every file in the file system under a given path and returns a\npromise for an object that contains the absolute path and a Buffer for\neach of those files.\n\n### glob(pattern)\n\nNot yet implemented\n\n### match(pattern, path)\n\nNot yet implemented\n\n## Mock Filesystem\n\nQ-IO provides a mock filesystem interface. The mock filesystem has the\nsame interface as the real one and has most of the same features, but\noperates on a purely in-memory, in-process, in-javascript filesystem.\n\nA mock filesystem can be created from a data structure. Objects are\ndirectories. Keys are paths. A buffer is a file’s contents. Anything\nelse is coerced to a string, then to a buffer in the UTF-8 encoding.\n\n```javascript\nvar MockFs = require(\"q-io/fs-mock\");\nvar mockFs = MockFs({\n \"a\": {\n \"b\": {\n \"c.txt\": \"Content of a/b/c.txt\"\n }\n },\n \"a/b/d.txt\": new Buffer(\"Content of a/b/d.txt\", \"utf-8\")\n})\n```\n\nYou can also instantiate a mock file system with the content of a\nsubtree of a real file system. You receive a promise for the mock\nfilesystem.\n\n```javascript\nvar FS = require(\"q-io/fs\");\nFS.mock(__dirname)\n.then(function (fs) {\n //\n})\n.done();\n```\n\n## HTTP\n\nThe HTTP module resembles [CommonJS/JSGI][].\n\n```javascript\nvar HTTP = require(\"q-io/http\");\n```\n\n[CommonJS/JSGI]: http://wiki.commonjs.org/wiki/JSGI\n\n### Server(app)\n\nThe `http` module exports a `Server` constructor.\n\n- accepts an application, returns a server.\n- calls the application function when requests are received.\n - if the application returns a response object, sends that\n response.\n- ``listen(port)``\n - accepts a port number.\n - returns a promise for undefined when the server has begun\n listening.\n- ``stop()``\n - returns a promise for undefined when the server has stopped.\n\n### request(request object or url)\n\nThe `http` module exports a `request` function that returns a promise\nfor a response.\n\n- accepts a request or a URL string.\n- returns a promise for a response.\n\n### read(request object or url)\n\nThe `http` module exports a `read` function, analogous to\n`Fs.read(path)`, but returning a promise for the contento of an OK HTTP\nresponse.\n\n- accepts a request or a URL string.\n- returns a promise for the response body as a string provided\n that the request is successful with a 200 status.\n - rejects the promise with the response as the reason for\n failure if the request fails.\n\n### normalizeRequest(request object or url)\n\n- coerces URLs into request objects.\n- completes an incomplete request object based on its `url`.\n\n### normalizeResponse(response)\n\n- coerces strings, arrays, and other objects supporting\n ``forEach`` into proper response objects.\n- if it receives `undefined`, it returns `undefined`. This is used as\n a singal to the requester that the responder has taken control of\n the response stream.\n\n### request\n\nA complete request object has the following properties.\n\n- ``url`` the full URL of the request as a string\n- ``path`` the full path as a string\n- ``scriptName`` the routed portion of the path, like ``\"\"`` for\n ``http://example.com/`` if no routing has occurred.\n- ``pathInfo`` the part of the path that remains to be routed,\n like ``/`` for ``http://example.com`` or ``http://example.com/``\n if no routing has occurred.\n- ``version`` the requested HTTP version as an array of strings.\n- ``method`` like ``\"GET\"``\n- ``scheme`` like ``\"http:\"``\n- ``host`` like ``\"example.com\"``\n- ``port`` the port number, like ``80``\n- ``remoteHost``\n- ``remotePort``\n- ``headers``\n corresponding values, possibly an array for multiple headers\n of the same name.\n- ``agent``\n a custom node [HTTP](http://nodejs.org/api/http.html#http_class_http_agent)\n or [HTTPS](http://nodejs.org/api/https.html#https_class_https_agent)\n agent. HTTP and HTTPS agents can implement custom socket pools,\n allow use of SSL client certificates and self-signed certificates.\n- ``body``\n- ``node`` the wrapped Node request object\n\n### response\n\nA complete response object has the following properties.\n\n- ``status`` the HTTP status code as a number, like ``200``.\n- ``headers``\n- ``body`` an IO reader\n- ``onclose`` is an optional function that this library will call\n when a response concludes.\n- ``node`` the wrapped Node response object.\n\n### headers\n\nHeaders are an object mapping lower-case header-names to corresponding\nvalues, possibly an array for multiple headers of the same name, for\nboth requests and responses.\n\n### body\n\nbody is a representation of a readable stream, either for the content of\na request or a response. It is implemented as a Q-IO reader.\n\n- ``forEach(callback)``\n - accepts a ``callback(chunk)`` function\n - accepts a chunk as either a string or a ``Buffer``\n - returns undefined or a promise for undefined when the\n chunk has been flushed.\n - returns undefined or a promise for undefined when the stream\n is finished writing.\n - the ``forEach`` function for arrays of strings or buffers is\n sufficient for user-provided bodies\n- the ``forEach`` function is the only necessary function for\n bodies provided to this library.\n- in addition to ``forEach``, bodies provided by this library\n support the entire readable stream interface provided by\n ``q-io``.\n- ``read()``\n - returns a promise for the entire body as a string or a\n buffer.\n\n### application\n\nAn HTTP application is a function that accepts a request and returns a\nresponse. The `request` function itself is an application.\nApplications can be chained and combined to make advanced servers and\nclients.\n\n- accepts a request\n- returns a response, a promise for a response, or nothing if no\n response should be sent.\n\n\n## Streams\n\n### Reader\n\nReader instances have the following methods:\n\n- `read()`\n- `forEach(callback)`\n- `close()`\n- `node` the underlying node reader\n\nAdditionally, the `Reader` constructor has the following methods:\n\n- `read(stream, charset)` accepts any foreachable and returns either a\n buffer or a string if given a charset.\n- `join(buffers)` consolidates an array of buffers into a single\n buffer. The buffers array is collapsed in place and the new first\n and only buffer is returned.\n\nThe `reader` module exports a function that accepts a Node reader and\nreturns a Q reader.\n\n### Writer\n\nWriter instances have the following methods:\n\n- `write(content)` writes a chunk of content, either from a string or\n a buffer.\n- `flush()` returns a promise to drain the outbound content all the\n way to its destination.\n- `close()`\n- `destroy()`\n- `node` the underlying node writer\n\nThe `writer` module exports a function that accepts a Node writer and\nreturns a Q writer.\n\n### Buffer\n\n```javascript\nvar BufferStream = require(\"q-io/buffer-stream\");\nvar stream = BufferStream(new Buffer(\"Hello, World!\\n\", \"utf-8\"), \"utf-8\")\n```\n\n## HTTP Applications\n\nThe HTTP applications module provides a comprehensive set of JSGI-alike\napplications and application factories, suitable for use with the `http`\nserver and client.\n\n```javascript\nvar Apps = require(\"q-io/http-apps\");\n```\n\n### ok(content, contentType, status) : Response\n\nCreates an `HTTP 200 Ok` response with the given content, content type,\nand status.\n\nThe content may be a string, buffer, array of strings, array of buffers,\na readable stream of strings or buffers, or (generally) anything that\nimplements `forEach`.\n\nThe default content type is `text/plain`.\n\nThe default status is `200`.\n\n### badRequest(request) : Response\n\nAn application that returns an `HTTP 400 Bad request` response for any\nrequest.\n\n### notFound(request) : Response\n\nAn application that returns an `HTTP 404 Not found` response for any\nrequest.\n\n### methodNotAllowed(request) : Response\n\nAn application that returns an `HTTP 405 Method not allowed` response\nfor any request. This is suitable for any endpoint where there is no\nviable handler for the request method.\n\n### notAcceptable(request) : Response\n\nAn application that returns an `HTTP 406 Not acceptable` response for\nany request. This is suitable for any situation where content\nnegotiation has failed, for example, if you cannot response with any of\nthe accepted encoding, charset, or language.\n\n### redirect(request, location, status, tree) : Response\n\nNot to be confused with an HTTP application, this is a utility that\ngenerates redirect responses.\n\nThe returns response issues a redirect to the given location. The\nutility fully qualifies the location.\n\nThis particular method should be used directly to generate an `HTTP 301\nTemporary redirect` response, but passing `307` in the status argument\nturns it into an `HTTP 307 Permanent redirect` response.\n\nThis particular method should be used to send all requests to a specific\nlocation, but setting the `tree` argument to `true` causes the redirect\nto follow the remaining unrouted path from the redirect location, so if\nyou move an entire directory tree from one location to another, this\nredirect can forward to all of them.\n\n### redirectTree(request, location) : Response\n\nProduces an `HTTP 301 Temporary redirect` from one directory tree to\nanother, using `redirect`.\n\n### permanentRedirect(request, location) : Response\n\nProduces an `HTTP 307 Permanent redirect` to a given location, using\n`redirect`.\n\n### permanentRedirectTree(request, location) : Response\n\nProduces an `HTTP 307 Permanent redirect` from one directory tree to\nanother, using `redirect`.\n\n### file(request, path, contentType) : Response\n\nProduces an HTTP response with the file at a given path. By default, it\ninfers the content type from the extension of the path.\n\nThe file utility produces an `e-tag` header suitable for cache control,\nand may produce an `HTTP 304 Not modified` if the requested resource has\nthe same entity tag.\n\nThe file utility may produce an `HTTP 206 Partial content` response with\na `content-range` header if the request has a `range` header. If the\npartial range request cannot be satisified, it may respond `HTTP 416 Not\nsatisfiable`.\n\nIn all cases, the response body is streamed from the file system.\n\n### etag(stat)\n\nComputes an entity tag for a file system `Stats` object, using the\n`node.ino`, `size`, and last modification time.\n\n### directory(request, path)\n\nThis is not yet implemented.\n\n### json(object, visitor, tabs) : Response\n\nReturns an `HTTP 200 Ok` response from some JSON, using the same\nargumensts as `JSON.stringify`.\n\n### Content(body, contentType, status) : Application\n\nA factory that produces an HTTP application that will always respond\nwith the given content, content type, and status. The default content\ntype is `text/plain` and the default status is `200`.\n\nThe body may be a string, array of strings or buffers, or a readable\nstream of strings or buffers.\n\n### File(path, contentType) : Application\n\nA factory that produces an HTTP application that will always respond\nwith the file at the given path. The content type is inferred from the\npath extension by default, but can be overridden with `contentType`.\n\n### FileTree(path, options) : Application\n\nA factory that produces an HTTP application that responds to all\nrequests with files within a branch of the file system starting at the\ngiven path and using any unprocessed portion of the request location.\n\nOptions include:\n\n- `notFound(request, response)`: alternate 404 responder, defaults to\n `HttpApps.notFound`\n- `file(request, path, contentType, fs)`: alternate file responder,\n defaults to `HttpApps.file`\n- `contentType`: forces the content type of file requests, forwarded\n to the `file` handler.\n- `directory(request, path, contentType, fs)`: alternate directory\n responder, defaults to `HttpApps.directory`.\n- `redirectSymbolicLinks`: directs the client to use a redirect\n response for symbolic links instead of following links internally.\n- `permanent`: symbolic links that are turned into HTTP redirects will\n be permanent.\n- `followInsecureSymbolicLinks`: directs `FileTree` to serve files\n that are outside the root path of the file tree if a symbolic link\n traverses there.\n- `fs`: alternate file system, defaults to the `fs` module.\n\n### Redirect(path) : Application\n\nA factory that produces an HTTP application that temporarily redirects\nto the given path.\n\n### RedirectTree(path) : Application\n\nA factory that produces an HTTP application that redirects all requests\nunder the requested path to parallel locations at the given path.\n\n### PermanentRedirect(path) : Application\n\nA factory that produces an HTTP application that redirects all requests\nto an exact location and instructs the requester's cache never to ask\nagain.\n\n### PermanentRedirectTree(path) : Application\n\nA factory that produces an HTTP application that redirects all requests\nunder the request path to a parallel location under the given path and\ninstructs the requester's cache never to ask again.\n\n### Cap(app, notFound) : Application\n\nA factory that produces an HTTP application that will cause an `HTTP 404\nNot found` response if the request has not reached the end of its route\n(meaning `pathInfo` is not `\"\"` or `\"/\"`), or will forward to the given\napplication.\n\n### Routing\n\nSeveral routing application factories have the same form. They all take\nan object as their first argument and an optional fallback application\nas their second. The object maps each of the supported options for keys\nto an HTTP application for handling that option.\n\n- Branch(paths, notFound) routes the next unprocessed path component\n- Method(methods, notFound) routes the HTTP method. Methods are\n upper-case.\n- ContentType(contentTypes, notAcceptable) routes based on the\n \"accept\" request header and produces a \"content-type\" response\n header.\n- Langauge(languages, notAcceptable) routes based on the\n \"accept-language\" header and produces a \"language\" response header.\n- Charaset(charsets, notAcceptable) routes based on the\n \"accept-charset\" header and produces a \"charset\" response header.\n- Encoding(encodings, notAcceptable) routes based on the\n \"accept-encoding\" request header and produces an \"encoding\" response\n header.\n- Host(hosts, notFound) routes based on the host name of the request\n \"host\" header, which defaults to \"*\". This is equivalent to virtual\n host mapping.\n\n### Select(selector) : Application\n\nProduces an HTTP application that uses a function to determine the next\napplication to route. The `selector` is a function that accepts the\nrequest and returns an HTTP application.\n\n### FirstFound(apps)\n\nReturns an HTTP application that attempts to respond with each of a\nseries of applications and returns the first response that does not have\na `404 Not found` status, or whatever response comes last.\n\n### Error(application, debug) : Application\n\nWraps an application such that any exceptions get converted into `HTTP\n500 Server error` responses. If `debug` is enabled, produces the\nexception and stack traces in the body of the response.\n\n### Log(application, log, stamp) : Application\n\nWraps an application such that request and response times are logged.\nThe `log` function reports to `console.log` by default. The\n`stamp(message)` function prefixes an ISO time stamp by default.\n\n### Time(application) : Application\n\nAdds an `x-response-time` header to the response, with the time from receiving\nstarting the request to starting the response in miliseconds.\n\n### Date(application) : Application\n\nAdds a `date` header to the response with the current date for cache\ncontrol purposes.\n\n### Tap(app, tap) : Application\n\nWraps an application such that the `tap` function receives the request\nfirst. If the tap returns nothing, the request goes to the `app`. If\nthe `tap` returns a response, the `app` never gets called.\n\n### Trap(app, trap) : Application\n\nWraps an application such that the `trap` function receives the\nresponse. If it returns nothing, the response if forwarded. If the\n`trap` returns a response, the original response is discarded.\n\n### ParseQuery(application)\n\nWraps an application such that the query string is parsed and placed in\n`request.parse`.\n\n\n## Coverage\n\nUse `npm run cover` to generate and view a coverage report of Q-IO.\n\n<table>\n <thead>\n <tr>\n <th>File</th>\n <th>Percentage</th>\n <th>Missing</th>\n </tr>\n </thead>\n <tbody>\n <tr>\n <td><code>fs-boot.js</code></td>\n <td>87%</td>\n <td>41</td>\n </tr>\n <tr>\n <td><code>fs.js</code></td>\n <td>72%</td>\n <td>100</td>\n </tr>\n <tr>\n <td><code>reader.js</code></td>\n <td>94%</td>\n <td>8</td>\n </tr>\n <tr>\n <td><code>writer.js</code></td>\n <td>91%</td>\n <td>8</td>\n </tr>\n <tr>\n <td><code>fs-common.js</code></td>\n <td>87%</td>\n <td>52</td>\n </tr>\n <tr>\n <td><code>fs-root.js</code></td>\n <td>88%</td>\n <td>11</td>\n </tr>\n <tr>\n <td><code>fs-mock.js</code></td>\n <td>91%</td>\n <td>46</td>\n </tr>\n <tr>\n <td><code>buffer-stream.js</code></td>\n <td>89%</td>\n <td>6</td>\n </tr>\n <tr>\n <td><code>http.js</code></td>\n <td>93%</td>\n <td>25</td>\n </tr>\n <tr>\n <td><code>http-apps.js</code></td>\n <td>80%</td>\n <td>286</td>\n </tr>\n <tr>\n <td><code>http-cookie.js</code></td>\n <td>79%</td>\n <td>15</td>\n </tr>\n </tbody>\n</table>\n\n---\n\nCopyright 2009–2013 Kristopher Michael Kowal\nMIT License (enclosed)\n\n",
48
+ "readmeFilename": "README.md",
49
+ "_id": "q-io@1.10.9",
50
+ "_from": "q-io@~1.10.6"
51
+ }
@@ -0,0 +1,133 @@
1
+
2
+ var Q = require("q");
3
+
4
+ /**
5
+ * Wraps a Node readable stream, providing an API similar
6
+ * to a Narwhal synchronous `io` stream except returning
7
+ * Q promises for long latency operations.
8
+ * @param stream any Node readable stream
9
+ * @returns {Promise * Reader} a promise for
10
+ * the text stream reader.
11
+ * @constructor
12
+ */
13
+ module.exports = Reader;
14
+ function Reader(_stream, charset) {
15
+ var self = Object.create(Reader.prototype);
16
+
17
+ if (charset && _stream.setEncoding) // TODO complain about inconsistency
18
+ _stream.setEncoding(charset);
19
+
20
+ var begin = Q.defer();
21
+ var end = Q.defer();
22
+
23
+ _stream.on("error", function (reason) {
24
+ begin.reject(reason);
25
+ });
26
+
27
+ var chunks = [];
28
+ var receiver;
29
+
30
+ _stream.on("end", function () {
31
+ begin.resolve(self);
32
+ end.resolve()
33
+ });
34
+
35
+ _stream.on("data", function (chunk) {
36
+ begin.resolve(self);
37
+ if (receiver) {
38
+ receiver(chunk);
39
+ } else {
40
+ chunks.push(chunk);
41
+ }
42
+ });
43
+
44
+ function slurp() {
45
+ var result;
46
+ if (charset) {
47
+ result = chunks.join("");
48
+ } else {
49
+ result = self.constructor.join(chunks);
50
+ }
51
+ chunks.splice(0, chunks.length);
52
+ return result;
53
+ }
54
+
55
+ /***
56
+ * Reads all of the remaining data from the stream.
57
+ * @returns {Promise * String} a promise for a String
58
+ * containing the entirety the remaining stream.
59
+ */
60
+ self.read = function () {
61
+ receiver = undefined;
62
+ var deferred = Q.defer();
63
+ Q.done(end.promise, function () {
64
+ deferred.resolve(slurp());
65
+ });
66
+ return deferred.promise;
67
+ };
68
+
69
+ /***
70
+ * Reads and writes all of the remaining data from the
71
+ * stream in chunks.
72
+ * @param {Function(Promise * String)} write a function
73
+ * to be called on each chunk of input from this stream.
74
+ * @returns {Promise * Undefined} a promise that will
75
+ * be resolved when the input is depleted.
76
+ */
77
+ self.forEach = function (write) {
78
+ if (chunks && chunks.length)
79
+ write(slurp());
80
+ receiver = write;
81
+ return Q.when(end.promise, function () {
82
+ receiver = undefined;
83
+ });
84
+ };
85
+
86
+ self.close = function () {
87
+ _stream.destroy();
88
+ };
89
+
90
+ self.node = _stream;
91
+
92
+ return begin.promise;
93
+ }
94
+
95
+ /*
96
+ Reads an entire forEachable stream of buffers and returns a single buffer.
97
+ */
98
+ Reader.read = read;
99
+ function read(stream, charset) {
100
+ var chunks = [];
101
+ stream.forEach(function (chunk) {
102
+ chunks.push(chunk);
103
+ });
104
+ if (charset) {
105
+ return chunks.join("");
106
+ } else {
107
+ return join(chunks);
108
+ }
109
+ }
110
+
111
+ Reader.join = join;
112
+ function join(buffers) {
113
+ var length = 0;
114
+ var at;
115
+ var i;
116
+ var ii = buffers.length;
117
+ var buffer;
118
+ var result;
119
+ for (i = 0; i < ii; i++) {
120
+ buffer = buffers[i];
121
+ length += buffer.length;
122
+ }
123
+ result = new Buffer(length);
124
+ at = 0;
125
+ for (i = 0; i < ii; i++) {
126
+ buffer = buffers[i];
127
+ buffer.copy(result, at, 0);
128
+ at += buffer.length;
129
+ }
130
+ buffers.splice(0, ii, result);
131
+ return result;
132
+ }
133
+