vulcan 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. data/lib/vulcan/cli.rb +20 -10
  2. data/lib/vulcan/version.rb +1 -1
  3. data/server/Procfile +1 -1
  4. data/server/bin/web +10 -0
  5. data/server/lib/cloudant.coffee +20 -0
  6. data/server/lib/logger.coffee +17 -0
  7. data/server/lib/on.coffee +10 -0
  8. data/server/lib/spawner.coffee +65 -0
  9. data/server/node_modules/coffee-script/CNAME +1 -0
  10. data/server/node_modules/coffee-script/LICENSE +22 -0
  11. data/server/node_modules/coffee-script/README +51 -0
  12. data/server/node_modules/coffee-script/Rakefile +78 -0
  13. data/server/node_modules/coffee-script/bin/cake +7 -0
  14. data/server/node_modules/coffee-script/bin/coffee +7 -0
  15. data/server/node_modules/coffee-script/extras/jsl.conf +44 -0
  16. data/server/node_modules/coffee-script/lib/coffee-script/browser.js +92 -0
  17. data/server/node_modules/coffee-script/lib/coffee-script/cake.js +111 -0
  18. data/server/node_modules/coffee-script/lib/coffee-script/coffee-script.js +167 -0
  19. data/server/node_modules/coffee-script/lib/coffee-script/command.js +500 -0
  20. data/server/node_modules/coffee-script/lib/coffee-script/grammar.js +606 -0
  21. data/server/node_modules/coffee-script/lib/coffee-script/helpers.js +77 -0
  22. data/server/node_modules/coffee-script/lib/coffee-script/index.js +11 -0
  23. data/server/node_modules/coffee-script/lib/coffee-script/lexer.js +788 -0
  24. data/server/node_modules/coffee-script/lib/coffee-script/nodes.js +2986 -0
  25. data/server/node_modules/coffee-script/lib/coffee-script/optparse.js +138 -0
  26. data/server/node_modules/coffee-script/lib/coffee-script/parser.js +683 -0
  27. data/server/node_modules/coffee-script/lib/coffee-script/repl.js +261 -0
  28. data/server/node_modules/coffee-script/lib/coffee-script/rewriter.js +349 -0
  29. data/server/node_modules/coffee-script/lib/coffee-script/scope.js +146 -0
  30. data/server/node_modules/coffee-script/package.json +55 -0
  31. data/server/node_modules/connect-form/History.md +0 -6
  32. data/server/node_modules/connect-form/lib/connect-form.js +2 -4
  33. data/server/node_modules/connect-form/node_modules/formidable/Readme.md +64 -36
  34. data/server/node_modules/connect-form/node_modules/formidable/lib/incoming_form.js +5 -1
  35. data/server/node_modules/connect-form/node_modules/formidable/package.json +20 -6
  36. data/server/node_modules/connect-form/node_modules/formidable/test/common.js +5 -6
  37. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/file/funkyfilename.txt +1 -0
  38. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +1 -1
  39. data/server/node_modules/connect-form/node_modules/formidable/test/{slow → integration}/test-fixtures.js +38 -33
  40. data/server/node_modules/connect-form/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
  41. data/server/node_modules/connect-form/node_modules/formidable/test/run.js +1 -6
  42. data/server/node_modules/connect-form/node_modules/formidable/test/unit/test-incoming-form.js +63 -0
  43. data/server/node_modules/connect-form/package.json +27 -5
  44. data/server/node_modules/cradle/README.md +10 -10
  45. data/server/node_modules/cradle/lib/cradle.js +117 -523
  46. data/server/node_modules/cradle/lib/cradle/database/attachments.js +120 -0
  47. data/server/node_modules/cradle/lib/cradle/database/changes.js +56 -0
  48. data/server/node_modules/cradle/lib/cradle/database/documents.js +215 -0
  49. data/server/node_modules/cradle/lib/cradle/database/index.js +65 -0
  50. data/server/node_modules/cradle/lib/cradle/database/views.js +125 -0
  51. data/server/node_modules/cradle/node_modules/follow/LICENSE +202 -0
  52. data/server/node_modules/cradle/node_modules/follow/README.md +164 -0
  53. data/server/node_modules/cradle/node_modules/follow/Rakefile +54 -0
  54. data/server/node_modules/cradle/node_modules/follow/api.js +35 -0
  55. data/server/node_modules/cradle/node_modules/follow/browser/eventemitter2.js +453 -0
  56. data/server/node_modules/cradle/node_modules/follow/browser/export.js +78 -0
  57. data/server/node_modules/cradle/node_modules/follow/browser/index.html +14 -0
  58. data/server/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js +18 -0
  59. data/server/node_modules/cradle/node_modules/follow/browser/log4js.js +46 -0
  60. data/server/node_modules/cradle/node_modules/follow/browser/main.js +92 -0
  61. data/server/node_modules/cradle/node_modules/follow/browser/querystring.js +28 -0
  62. data/server/node_modules/cradle/node_modules/follow/browser/request.jquery.js +237 -0
  63. data/server/node_modules/cradle/node_modules/follow/browser/require.js +33 -0
  64. data/server/node_modules/cradle/node_modules/follow/browser/util.js +28 -0
  65. data/server/node_modules/cradle/node_modules/follow/cli.js +101 -0
  66. data/server/node_modules/cradle/node_modules/follow/lib/feed.js +556 -0
  67. data/server/node_modules/cradle/node_modules/follow/lib/index.js +66 -0
  68. data/server/node_modules/cradle/node_modules/follow/lib/stream.js +305 -0
  69. data/server/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE +55 -0
  70. data/server/node_modules/cradle/node_modules/follow/node_modules/request/README.md +285 -0
  71. data/server/node_modules/cradle/node_modules/follow/node_modules/request/main.js +618 -0
  72. data/server/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js +146 -0
  73. data/server/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js +34 -0
  74. data/server/node_modules/cradle/node_modules/follow/node_modules/request/package.json +42 -0
  75. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png +0 -0
  76. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh +6 -0
  77. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js +57 -0
  78. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js +90 -0
  79. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js +29 -0
  80. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js +90 -0
  81. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js +30 -0
  82. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js +109 -0
  83. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js +167 -0
  84. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js +39 -0
  85. data/server/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js +87 -0
  86. data/server/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js +19 -0
  87. data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js +55 -0
  88. data/server/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js +72 -0
  89. data/server/node_modules/cradle/node_modules/follow/package.json +45 -0
  90. data/server/node_modules/cradle/node_modules/follow/test/couch.js +153 -0
  91. data/server/node_modules/cradle/node_modules/follow/test/follow.js +136 -0
  92. data/server/node_modules/cradle/node_modules/follow/test/issues.js +178 -0
  93. data/server/node_modules/cradle/node_modules/follow/test/issues/10.js +24 -0
  94. data/server/node_modules/cradle/node_modules/follow/test/stream.js +493 -0
  95. data/server/node_modules/cradle/node_modules/request/LICENSE +55 -0
  96. data/server/node_modules/cradle/node_modules/request/README.md +287 -0
  97. data/server/node_modules/cradle/node_modules/request/forever.js +103 -0
  98. data/server/node_modules/cradle/node_modules/request/main.js +913 -0
  99. data/server/node_modules/cradle/node_modules/request/mimetypes.js +152 -0
  100. data/server/node_modules/cradle/node_modules/request/oauth.js +34 -0
  101. data/server/node_modules/cradle/node_modules/request/package.json +42 -0
  102. data/server/node_modules/cradle/node_modules/request/tests/googledoodle.png +0 -0
  103. data/server/node_modules/cradle/node_modules/request/tests/run.js +38 -0
  104. data/server/node_modules/cradle/node_modules/request/tests/server.js +82 -0
  105. data/server/node_modules/cradle/node_modules/request/tests/squid.conf +77 -0
  106. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf +20 -0
  107. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crl +0 -0
  108. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt +17 -0
  109. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr +13 -0
  110. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key +18 -0
  111. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl +1 -0
  112. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf +19 -0
  113. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt +16 -0
  114. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr +11 -0
  115. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js +28 -0
  116. data/server/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key +9 -0
  117. data/server/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt +16 -0
  118. data/server/node_modules/cradle/node_modules/request/tests/ssl/test.crt +15 -0
  119. data/server/node_modules/cradle/node_modules/request/tests/ssl/test.key +15 -0
  120. data/server/node_modules/cradle/node_modules/request/tests/test-body.js +95 -0
  121. data/server/node_modules/cradle/node_modules/request/tests/test-cookie.js +29 -0
  122. data/server/node_modules/cradle/node_modules/request/tests/test-cookiejar.js +90 -0
  123. data/server/node_modules/cradle/node_modules/request/tests/test-defaults.js +68 -0
  124. data/server/node_modules/cradle/node_modules/request/tests/test-errors.js +37 -0
  125. data/server/node_modules/cradle/node_modules/request/tests/test-headers.js +52 -0
  126. data/server/node_modules/cradle/node_modules/request/tests/test-httpModule.js +94 -0
  127. data/server/node_modules/cradle/node_modules/request/tests/test-https-strict.js +97 -0
  128. data/server/node_modules/cradle/node_modules/request/tests/test-https.js +86 -0
  129. data/server/node_modules/cradle/node_modules/request/tests/test-oauth.js +117 -0
  130. data/server/node_modules/cradle/node_modules/request/tests/test-params.js +92 -0
  131. data/server/node_modules/cradle/node_modules/request/tests/test-pipes.js +202 -0
  132. data/server/node_modules/cradle/node_modules/request/tests/test-proxy.js +39 -0
  133. data/server/node_modules/cradle/node_modules/request/tests/test-qs.js +28 -0
  134. data/server/node_modules/cradle/node_modules/request/tests/test-redirect.js +154 -0
  135. data/server/node_modules/cradle/node_modules/request/tests/test-timeout.js +87 -0
  136. data/server/node_modules/cradle/node_modules/request/tests/test-toJSON.js +14 -0
  137. data/server/node_modules/cradle/node_modules/request/tests/test-tunnel.js +61 -0
  138. data/server/node_modules/cradle/node_modules/request/tunnel.js +229 -0
  139. data/server/node_modules/cradle/node_modules/request/uuid.js +19 -0
  140. data/server/node_modules/cradle/node_modules/request/vendor/cookie/index.js +65 -0
  141. data/server/node_modules/cradle/node_modules/request/vendor/cookie/jar.js +72 -0
  142. data/server/node_modules/cradle/node_modules/vargs/package.json +33 -10
  143. data/server/node_modules/cradle/package.json +50 -12
  144. data/server/node_modules/cradle/test/cache-test.js +1 -4
  145. data/server/node_modules/cradle/test/connection-test.js +179 -0
  146. data/server/node_modules/cradle/test/database-attachment-test.js +344 -0
  147. data/server/node_modules/cradle/test/database-cache-test.js +132 -0
  148. data/server/node_modules/cradle/test/database-test.js +219 -0
  149. data/server/node_modules/cradle/test/database-view-test.js +141 -0
  150. data/server/node_modules/cradle/test/fixtures/databases.json +28 -1
  151. data/server/node_modules/cradle/test/helpers/seed.js +14 -5
  152. data/server/node_modules/cradle/test/response-test.js +1 -1
  153. data/server/node_modules/express/History.md +16 -0
  154. data/server/node_modules/express/bin/express +7 -6
  155. data/server/node_modules/express/lib-cov/application.js +510 -0
  156. data/server/node_modules/express/lib-cov/express.js +65 -0
  157. data/server/node_modules/express/lib-cov/middleware.js +54 -0
  158. data/server/node_modules/express/lib-cov/request.js +225 -0
  159. data/server/node_modules/express/lib-cov/response.js +611 -0
  160. data/server/node_modules/express/lib-cov/router/collection.js +40 -0
  161. data/server/node_modules/express/lib-cov/router/index.js +515 -0
  162. data/server/node_modules/express/lib-cov/router/methods.js +9 -0
  163. data/server/node_modules/express/lib-cov/router/route.js +68 -0
  164. data/server/node_modules/express/lib-cov/utils.js +151 -0
  165. data/server/node_modules/express/lib-cov/view.js +81 -0
  166. data/server/node_modules/express/lib/express.js +1 -1
  167. data/server/node_modules/express/lib/http.js +1 -2
  168. data/server/node_modules/express/lib/request.js +2 -2
  169. data/server/node_modules/express/lib/router/methods.js +10 -1
  170. data/server/node_modules/express/node_modules/connect/lib/connect.js +1 -1
  171. data/server/node_modules/express/node_modules/connect/lib/http.js +3 -2
  172. data/server/node_modules/express/node_modules/connect/lib/middleware/limit.js +0 -2
  173. data/server/node_modules/express/node_modules/connect/lib/middleware/session.js +1 -2
  174. data/server/node_modules/express/node_modules/connect/node_modules/formidable/Readme.md +42 -25
  175. data/server/node_modules/express/node_modules/connect/node_modules/formidable/lib/incoming_form.js +1 -0
  176. data/server/node_modules/express/node_modules/connect/node_modules/formidable/package.json +14 -3
  177. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +11 -0
  178. data/server/node_modules/express/node_modules/connect/package.json +35 -7
  179. data/server/node_modules/express/node_modules/mime/package.json +30 -8
  180. data/server/node_modules/express/node_modules/mkdirp/README.markdown +35 -2
  181. data/server/node_modules/express/node_modules/mkdirp/examples/pow.js +1 -1
  182. data/server/node_modules/express/node_modules/mkdirp/index.js +72 -13
  183. data/server/node_modules/express/node_modules/mkdirp/package.json +39 -21
  184. data/server/node_modules/express/node_modules/mkdirp/test/chmod.js +38 -0
  185. data/server/node_modules/express/node_modules/mkdirp/test/clobber.js +37 -0
  186. data/server/node_modules/express/node_modules/mkdirp/test/perm.js +32 -0
  187. data/server/node_modules/express/node_modules/mkdirp/test/perm_sync.js +39 -0
  188. data/server/node_modules/express/node_modules/mkdirp/test/sync.js +27 -0
  189. data/server/node_modules/express/node_modules/mkdirp/test/umask.js +28 -0
  190. data/server/node_modules/express/node_modules/mkdirp/test/umask_sync.js +27 -0
  191. data/server/node_modules/express/node_modules/qs/History.md +10 -0
  192. data/server/node_modules/express/node_modules/qs/Readme.md +9 -2
  193. data/server/node_modules/express/node_modules/qs/examples.js +3 -0
  194. data/server/node_modules/express/node_modules/qs/lib/querystring.js +8 -6
  195. data/server/node_modules/express/node_modules/qs/package.json +26 -8
  196. data/server/node_modules/express/node_modules/qs/test/parse.js +13 -1
  197. data/server/node_modules/express/node_modules/qs/test/stringify.js +45 -37
  198. data/server/node_modules/express/package.json +55 -16
  199. data/server/node_modules/express/test.js +41 -0
  200. data/server/node_modules/knox/package.json +26 -4
  201. data/server/node_modules/node-uuid/package.json +40 -11
  202. data/server/node_modules/node-uuid/test/test.js +1 -1
  203. data/server/node_modules/nodemon/README.md +120 -0
  204. data/server/node_modules/nodemon/nodemon.js +518 -0
  205. data/server/node_modules/nodemon/nodemonignore.example +11 -0
  206. data/server/node_modules/nodemon/package.json +49 -0
  207. data/server/node_modules/restler/README.md +144 -94
  208. data/server/node_modules/restler/lib/multipartform.js +2 -0
  209. data/server/node_modules/restler/lib/restler.js +218 -61
  210. data/server/node_modules/restler/package.json +35 -8
  211. data/server/node_modules/restler/test/all.js +6 -1
  212. data/server/node_modules/restler/test/restler.js +624 -118
  213. data/server/package.json +14 -10
  214. data/server/web.coffee +64 -0
  215. data/server/web.js +15 -3
  216. metadata +170 -57
  217. data/server/index.js +0 -14
  218. data/server/node_modules/connect-form/LICENSE +0 -22
  219. data/server/node_modules/connect-form/index.js +0 -100
  220. data/server/node_modules/connect-form/node_modules/formidable/test/fast/test-incoming-form.js +0 -45
  221. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
  222. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
  223. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
  224. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
  225. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
  226. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
  227. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
  228. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
  229. data/server/node_modules/connect-form/node_modules/formidable/test/fixture/multi_video.upload +0 -0
  230. data/server/node_modules/cradle/Makefile +0 -10
  231. data/server/node_modules/cradle/test/cradle-test.js +0 -650
  232. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/no-filename/generic.http +0 -13
  233. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-chrome-13.http +0 -26
  234. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-firefox-3.6.http +0 -24
  235. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/osx-safari-5.http +0 -23
  236. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-chrome-12.http +0 -24
  237. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-7.http +0 -22
  238. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-ie-8.http +0 -22
  239. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/xp-safari-5.http +0 -22
  240. data/server/node_modules/express/node_modules/connect/node_modules/formidable/test/fixture/multi_video.upload +0 -0
  241. data/server/node_modules/express/node_modules/connect/test.js +0 -52
  242. data/server/node_modules/express/testing/foo/app.js +0 -35
  243. data/server/node_modules/express/testing/foo/package.json +0 -9
  244. data/server/node_modules/express/testing/foo/public/stylesheets/style.css +0 -8
  245. data/server/node_modules/express/testing/foo/routes/index.js +0 -10
  246. data/server/node_modules/express/testing/foo/views/index.jade +0 -2
  247. data/server/node_modules/express/testing/foo/views/layout.jade +0 -6
  248. data/server/node_modules/express/testing/index.js +0 -43
  249. data/server/node_modules/express/testing/public/test.txt +0 -2971
  250. data/server/node_modules/express/testing/views/page.html +0 -1
  251. data/server/node_modules/express/testing/views/page.jade +0 -3
  252. data/server/node_modules/express/testing/views/test.md +0 -1
  253. data/server/node_modules/express/testing/views/user/index.jade +0 -1
  254. data/server/node_modules/express/testing/views/user/list.jade +0 -1
  255. data/server/node_modules/knox/lib/knox/mime/index.js +0 -308
  256. data/server/node_modules/knox/lib/knox/mime/test.js +0 -59
  257. data/server/node_modules/node-uuid/test/benchmark-native +0 -0
  258. data/server/node_modules/on/index.js +0 -13
  259. data/server/node_modules/restler/test/test_helper.js +0 -163
  260. data/server/node_modules/spawner/index.js +0 -106
@@ -19,7 +19,34 @@
19
19
  {
20
20
  "_id": "bill",
21
21
  "color": "blue"
22
+ },
23
+ {
24
+ "_id": "alex",
25
+ "color": "red"
26
+ },
27
+ {
28
+ "_id": "deleteme"
29
+ }
30
+ ],
31
+ "animals/snorlax": [
32
+ {
33
+ "_id": "_design/pigs",
34
+ "views": {
35
+ "all": { "map": "function (doc) { if (doc.color) emit(doc._id, doc) }" }
36
+ }
37
+ },
38
+ {
39
+ "_id": "mike",
40
+ "color": "pink"
41
+ },
42
+ {
43
+ "_id": "bill",
44
+ "color": "blue"
45
+ },
46
+ {
47
+ "_id": "deleteme"
22
48
  }
23
49
  ],
24
- "badgers": null
50
+ "badgers": null,
51
+ "madeup/ewoks": null
25
52
  }
@@ -11,19 +11,20 @@ var seed = exports;
11
11
  seed.createDatabase = function (name, callback) {
12
12
  request({
13
13
  method: 'PUT',
14
- url: 'http://127.0.0.1:5984/' + name
14
+ url: 'http://127.0.0.1:5984/' + encodeURIComponent(name)
15
15
  }, callback);
16
16
  };
17
17
 
18
18
  seed.deleteDatabase = function (name, callback) {
19
19
  request({
20
20
  method: 'DELETE',
21
- url: 'http://127.0.0.1:5984/' + name
21
+ url: 'http://127.0.0.1:5984/' + encodeURIComponent(name)
22
22
  }, callback);
23
23
  };
24
24
 
25
25
  seed.seedDatabase = function (name, callback) {
26
- seed.deleteDatabase(name, function (err) {
26
+ console.log('Seeding ' + name);
27
+ seed.deleteDatabase(name, function (err, res, body) {
27
28
  if (!databases[name]) {
28
29
  return callback(err);
29
30
  }
@@ -31,7 +32,7 @@ seed.seedDatabase = function (name, callback) {
31
32
  function putDoc (doc, next) {
32
33
  request({
33
34
  method: 'PUT',
34
- url: 'http://127.0.0.1:5984/' + name + '/' + doc._id,
35
+ url: 'http://127.0.0.1:5984/' + encodeURIComponent(name) + '/' + doc._id,
35
36
  body: JSON.stringify(doc)
36
37
  }, next);
37
38
  }
@@ -53,4 +54,12 @@ seed.requireSeed = function () {
53
54
  }
54
55
  }
55
56
  }
56
- };
57
+ };
58
+
59
+ if (!module.parent) {
60
+ async.forEachSeries(Object.keys(databases), seed.seedDatabase, function (err) {
61
+ return err
62
+ ? console.log('Error seeding database: ' + err.message)
63
+ : console.log('Database seed completed.');
64
+ });
65
+ }
@@ -8,7 +8,7 @@ var path = require('path'),
8
8
  var cradle = require('../lib/cradle');
9
9
  var document = { _rev: '2-76be', _id: 'f6av8', name: 'buzz', age: 99 };
10
10
 
11
- vows.describe('cradle/Response').addBatch({
11
+ vows.describe('cradle/response').addBatch({
12
12
  'A cradle.Response instance': {
13
13
  'from a document': {
14
14
  topic: new(cradle.Response)(document),
@@ -1,4 +1,20 @@
1
1
 
2
+ 2.5.9/ 2012-04-02
3
+ ==================
4
+
5
+ * Added support for PURGE request method [pbuyle]
6
+ * Fixed `express(1)` generated app `app.address()` before `listening` [mmalecki]
7
+
8
+ 2.5.8 / 2012-02-08
9
+ ==================
10
+
11
+ * Update mkdirp dep. Closes #991
12
+
13
+ 2.5.7 / 2012-02-06
14
+ ==================
15
+
16
+ * Fixed `app.all` duplicate DELETE requests [mscdex]
17
+
2
18
  2.5.6 / 2012-01-13
3
19
  ==================
4
20
 
@@ -13,7 +13,7 @@ var fs = require('fs')
13
13
  * Framework version.
14
14
  */
15
15
 
16
- var version = '2.5.5';
16
+ var version = '2.5.8';
17
17
 
18
18
  /**
19
19
  * Add session support.
@@ -158,7 +158,7 @@ var app = [
158
158
  , ' */'
159
159
  , ''
160
160
  , 'var express = require(\'express\')'
161
- , ' , routes = require(\'./routes\')'
161
+ , ' , routes = require(\'./routes\');'
162
162
  , ''
163
163
  , 'var app = module.exports = express.createServer();'
164
164
  , ''
@@ -174,19 +174,20 @@ var app = [
174
174
  , '});'
175
175
  , ''
176
176
  , 'app.configure(\'development\', function(){'
177
- , ' app.use(express.errorHandler({ dumpExceptions: true, showStack: true })); '
177
+ , ' app.use(express.errorHandler({ dumpExceptions: true, showStack: true }));'
178
178
  , '});'
179
179
  , ''
180
180
  , 'app.configure(\'production\', function(){'
181
- , ' app.use(express.errorHandler()); '
181
+ , ' app.use(express.errorHandler());'
182
182
  , '});'
183
183
  , ''
184
184
  , '// Routes'
185
185
  , ''
186
186
  , 'app.get(\'/\', routes.index);'
187
187
  , ''
188
- , 'app.listen(3000);'
189
- , 'console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);'
188
+ , 'app.listen(3000, function(){'
189
+ , ' console.log("Express server listening on port %d in %s mode", app.address().port, app.settings.env);'
190
+ , '});'
190
191
  , ''
191
192
  ].join(eol);
192
193
 
@@ -0,0 +1,510 @@
1
+ /* automatically generated by JSCoverage - do not edit */
2
+ if (typeof _$jscoverage === 'undefined') _$jscoverage = {};
3
+ if (! _$jscoverage['application.js']) {
4
+ _$jscoverage['application.js'] = [];
5
+ _$jscoverage['application.js'][12] = 0;
6
+ _$jscoverage['application.js'][29] = 0;
7
+ _$jscoverage['application.js'][41] = 0;
8
+ _$jscoverage['application.js'][42] = 0;
9
+ _$jscoverage['application.js'][43] = 0;
10
+ _$jscoverage['application.js'][44] = 0;
11
+ _$jscoverage['application.js'][45] = 0;
12
+ _$jscoverage['application.js'][46] = 0;
13
+ _$jscoverage['application.js'][47] = 0;
14
+ _$jscoverage['application.js'][50] = 0;
15
+ _$jscoverage['application.js'][51] = 0;
16
+ _$jscoverage['application.js'][52] = 0;
17
+ _$jscoverage['application.js'][55] = 0;
18
+ _$jscoverage['application.js'][56] = 0;
19
+ _$jscoverage['application.js'][61] = 0;
20
+ _$jscoverage['application.js'][62] = 0;
21
+ _$jscoverage['application.js'][71] = 0;
22
+ _$jscoverage['application.js'][72] = 0;
23
+ _$jscoverage['application.js'][75] = 0;
24
+ _$jscoverage['application.js'][76] = 0;
25
+ _$jscoverage['application.js'][79] = 0;
26
+ _$jscoverage['application.js'][80] = 0;
27
+ _$jscoverage['application.js'][83] = 0;
28
+ _$jscoverage['application.js'][84] = 0;
29
+ _$jscoverage['application.js'][85] = 0;
30
+ _$jscoverage['application.js'][89] = 0;
31
+ _$jscoverage['application.js'][90] = 0;
32
+ _$jscoverage['application.js'][91] = 0;
33
+ _$jscoverage['application.js'][93] = 0;
34
+ _$jscoverage['application.js'][94] = 0;
35
+ _$jscoverage['application.js'][95] = 0;
36
+ _$jscoverage['application.js'][98] = 0;
37
+ _$jscoverage['application.js'][102] = 0;
38
+ _$jscoverage['application.js'][103] = 0;
39
+ _$jscoverage['application.js'][104] = 0;
40
+ _$jscoverage['application.js'][105] = 0;
41
+ _$jscoverage['application.js'][106] = 0;
42
+ _$jscoverage['application.js'][107] = 0;
43
+ _$jscoverage['application.js'][108] = 0;
44
+ _$jscoverage['application.js'][112] = 0;
45
+ _$jscoverage['application.js'][115] = 0;
46
+ _$jscoverage['application.js'][116] = 0;
47
+ _$jscoverage['application.js'][119] = 0;
48
+ _$jscoverage['application.js'][120] = 0;
49
+ _$jscoverage['application.js'][132] = 0;
50
+ _$jscoverage['application.js'][133] = 0;
51
+ _$jscoverage['application.js'][145] = 0;
52
+ _$jscoverage['application.js'][146] = 0;
53
+ _$jscoverage['application.js'][159] = 0;
54
+ _$jscoverage['application.js'][160] = 0;
55
+ _$jscoverage['application.js'][163] = 0;
56
+ _$jscoverage['application.js'][166] = 0;
57
+ _$jscoverage['application.js'][169] = 0;
58
+ _$jscoverage['application.js'][170] = 0;
59
+ _$jscoverage['application.js'][171] = 0;
60
+ _$jscoverage['application.js'][172] = 0;
61
+ _$jscoverage['application.js'][173] = 0;
62
+ _$jscoverage['application.js'][174] = 0;
63
+ _$jscoverage['application.js'][175] = 0;
64
+ _$jscoverage['application.js'][180] = 0;
65
+ _$jscoverage['application.js'][181] = 0;
66
+ _$jscoverage['application.js'][184] = 0;
67
+ _$jscoverage['application.js'][185] = 0;
68
+ _$jscoverage['application.js'][186] = 0;
69
+ _$jscoverage['application.js'][189] = 0;
70
+ _$jscoverage['application.js'][209] = 0;
71
+ _$jscoverage['application.js'][210] = 0;
72
+ _$jscoverage['application.js'][211] = 0;
73
+ _$jscoverage['application.js'][212] = 0;
74
+ _$jscoverage['application.js'][274] = 0;
75
+ _$jscoverage['application.js'][275] = 0;
76
+ _$jscoverage['application.js'][279] = 0;
77
+ _$jscoverage['application.js'][280] = 0;
78
+ _$jscoverage['application.js'][281] = 0;
79
+ _$jscoverage['application.js'][282] = 0;
80
+ _$jscoverage['application.js'][286] = 0;
81
+ _$jscoverage['application.js'][287] = 0;
82
+ _$jscoverage['application.js'][290] = 0;
83
+ _$jscoverage['application.js'][291] = 0;
84
+ _$jscoverage['application.js'][292] = 0;
85
+ _$jscoverage['application.js'][296] = 0;
86
+ _$jscoverage['application.js'][309] = 0;
87
+ _$jscoverage['application.js'][310] = 0;
88
+ _$jscoverage['application.js'][311] = 0;
89
+ _$jscoverage['application.js'][312] = 0;
90
+ _$jscoverage['application.js'][313] = 0;
91
+ _$jscoverage['application.js'][314] = 0;
92
+ _$jscoverage['application.js'][317] = 0;
93
+ _$jscoverage['application.js'][318] = 0;
94
+ _$jscoverage['application.js'][331] = 0;
95
+ _$jscoverage['application.js'][332] = 0;
96
+ _$jscoverage['application.js'][345] = 0;
97
+ _$jscoverage['application.js'][346] = 0;
98
+ _$jscoverage['application.js'][357] = 0;
99
+ _$jscoverage['application.js'][358] = 0;
100
+ _$jscoverage['application.js'][369] = 0;
101
+ _$jscoverage['application.js'][370] = 0;
102
+ _$jscoverage['application.js'][381] = 0;
103
+ _$jscoverage['application.js'][382] = 0;
104
+ _$jscoverage['application.js'][411] = 0;
105
+ _$jscoverage['application.js'][412] = 0;
106
+ _$jscoverage['application.js'][414] = 0;
107
+ _$jscoverage['application.js'][415] = 0;
108
+ _$jscoverage['application.js'][416] = 0;
109
+ _$jscoverage['application.js'][417] = 0;
110
+ _$jscoverage['application.js'][430] = 0;
111
+ _$jscoverage['application.js'][431] = 0;
112
+ _$jscoverage['application.js'][432] = 0;
113
+ _$jscoverage['application.js'][439] = 0;
114
+ _$jscoverage['application.js'][440] = 0;
115
+ _$jscoverage['application.js'][441] = 0;
116
+ _$jscoverage['application.js'][442] = 0;
117
+ _$jscoverage['application.js'][443] = 0;
118
+ _$jscoverage['application.js'][444] = 0;
119
+ _$jscoverage['application.js'][458] = 0;
120
+ _$jscoverage['application.js'][459] = 0;
121
+ _$jscoverage['application.js'][460] = 0;
122
+ _$jscoverage['application.js'][461] = 0;
123
+ _$jscoverage['application.js'][462] = 0;
124
+ _$jscoverage['application.js'][464] = 0;
125
+ _$jscoverage['application.js'][469] = 0;
126
+ _$jscoverage['application.js'][482] = 0;
127
+ _$jscoverage['application.js'][483] = 0;
128
+ _$jscoverage['application.js'][490] = 0;
129
+ _$jscoverage['application.js'][491] = 0;
130
+ _$jscoverage['application.js'][495] = 0;
131
+ _$jscoverage['application.js'][498] = 0;
132
+ _$jscoverage['application.js'][501] = 0;
133
+ _$jscoverage['application.js'][504] = 0;
134
+ _$jscoverage['application.js'][509] = 0;
135
+ _$jscoverage['application.js'][512] = 0;
136
+ _$jscoverage['application.js'][513] = 0;
137
+ _$jscoverage['application.js'][520] = 0;
138
+ _$jscoverage['application.js'][524] = 0;
139
+ _$jscoverage['application.js'][525] = 0;
140
+ _$jscoverage['application.js'][527] = 0;
141
+ }
142
+ _$jscoverage['application.js'][12]++;
143
+ var connect = require("connect"), Router = require("./router"), methods = Router.methods.concat("del", "all"), middleware = require("./middleware"), debug = require("debug")("express:application"), View = require("./view"), url = require("url"), utils = connect.utils, path = require("path"), http = require("http"), join = path.join, fs = require("fs");
144
+ _$jscoverage['application.js'][29]++;
145
+ var app = exports = module.exports = {};
146
+ _$jscoverage['application.js'][41]++;
147
+ app.init = (function () {
148
+ _$jscoverage['application.js'][42]++;
149
+ var self = this;
150
+ _$jscoverage['application.js'][43]++;
151
+ this.cache = {};
152
+ _$jscoverage['application.js'][44]++;
153
+ this.settings = {};
154
+ _$jscoverage['application.js'][45]++;
155
+ this.engines = {};
156
+ _$jscoverage['application.js'][46]++;
157
+ this.viewCallbacks = [];
158
+ _$jscoverage['application.js'][47]++;
159
+ this.defaultConfiguration();
160
+ _$jscoverage['application.js'][50]++;
161
+ methods.forEach((function (method) {
162
+ _$jscoverage['application.js'][51]++;
163
+ self.lookup[method] = (function (path) {
164
+ _$jscoverage['application.js'][52]++;
165
+ return self._router.lookup(method, path);
166
+ });
167
+ _$jscoverage['application.js'][55]++;
168
+ self.remove[method] = (function (path) {
169
+ _$jscoverage['application.js'][56]++;
170
+ return self._router.lookup(method, path).remove();
171
+ });
172
+ }));
173
+ _$jscoverage['application.js'][61]++;
174
+ self.lookup.del = self.lookup["delete"];
175
+ _$jscoverage['application.js'][62]++;
176
+ self.remove.del = self.remove["delete"];
177
+ });
178
+ _$jscoverage['application.js'][71]++;
179
+ app.defaultConfiguration = (function () {
180
+ _$jscoverage['application.js'][72]++;
181
+ var self = this;
182
+ _$jscoverage['application.js'][75]++;
183
+ this.set("env", process.env.NODE_ENV || "development");
184
+ _$jscoverage['application.js'][76]++;
185
+ debug("booting in %s mode", this.get("env"));
186
+ _$jscoverage['application.js'][79]++;
187
+ this.use(connect.query());
188
+ _$jscoverage['application.js'][80]++;
189
+ this.use(middleware.init(this));
190
+ _$jscoverage['application.js'][83]++;
191
+ this.locals = (function (obj) {
192
+ _$jscoverage['application.js'][84]++;
193
+ for (var key in obj) {
194
+ _$jscoverage['application.js'][84]++;
195
+ self.locals[key] = obj[key];
196
+ }
197
+ _$jscoverage['application.js'][85]++;
198
+ return self;
199
+ });
200
+ _$jscoverage['application.js'][89]++;
201
+ this.locals.use = (function (fn) {
202
+ _$jscoverage['application.js'][90]++;
203
+ if (3 == fn.length) {
204
+ _$jscoverage['application.js'][91]++;
205
+ self.viewCallbacks.push(fn);
206
+ }
207
+ else {
208
+ _$jscoverage['application.js'][93]++;
209
+ self.viewCallbacks.push((function (req, res, done) {
210
+ _$jscoverage['application.js'][94]++;
211
+ fn(req, res);
212
+ _$jscoverage['application.js'][95]++;
213
+ done();
214
+ }));
215
+ }
216
+ _$jscoverage['application.js'][98]++;
217
+ return this;
218
+ });
219
+ _$jscoverage['application.js'][102]++;
220
+ this._router = new Router(this);
221
+ _$jscoverage['application.js'][103]++;
222
+ this.routes = this._router.routes;
223
+ _$jscoverage['application.js'][104]++;
224
+ this.__defineGetter__("router", (function () {
225
+ _$jscoverage['application.js'][105]++;
226
+ this._usedRouter = true;
227
+ _$jscoverage['application.js'][106]++;
228
+ this._router.caseSensitive = this.enabled("case sensitive routing");
229
+ _$jscoverage['application.js'][107]++;
230
+ this._router.strict = this.enabled("strict routing");
231
+ _$jscoverage['application.js'][108]++;
232
+ return this._router.middleware;
233
+ }));
234
+ _$jscoverage['application.js'][112]++;
235
+ this.locals.settings = this.settings;
236
+ _$jscoverage['application.js'][115]++;
237
+ this.configure("development", (function () {
238
+ _$jscoverage['application.js'][116]++;
239
+ this.set("json spaces", 2);
240
+ }));
241
+ _$jscoverage['application.js'][119]++;
242
+ this.configure("production", (function () {
243
+ _$jscoverage['application.js'][120]++;
244
+ this.enable("view cache");
245
+ }));
246
+ });
247
+ _$jscoverage['application.js'][132]++;
248
+ app.remove = (function (path) {
249
+ _$jscoverage['application.js'][133]++;
250
+ return this._router.lookup("all", path).remove();
251
+ });
252
+ _$jscoverage['application.js'][145]++;
253
+ app.lookup = (function (path) {
254
+ _$jscoverage['application.js'][146]++;
255
+ return this._router.lookup("all", path);
256
+ });
257
+ _$jscoverage['application.js'][159]++;
258
+ app.use = (function (route, fn) {
259
+ _$jscoverage['application.js'][160]++;
260
+ var app, home, handle;
261
+ _$jscoverage['application.js'][163]++;
262
+ if ("string" != typeof route) {
263
+ _$jscoverage['application.js'][163]++;
264
+ fn = route, route = "/";
265
+ }
266
+ _$jscoverage['application.js'][166]++;
267
+ if (fn.handle && fn.set) {
268
+ _$jscoverage['application.js'][166]++;
269
+ app = fn;
270
+ }
271
+ _$jscoverage['application.js'][169]++;
272
+ if (app) {
273
+ _$jscoverage['application.js'][170]++;
274
+ app.route = route;
275
+ _$jscoverage['application.js'][171]++;
276
+ fn = (function (req, res, next) {
277
+ _$jscoverage['application.js'][172]++;
278
+ var orig = req.app;
279
+ _$jscoverage['application.js'][173]++;
280
+ app.handle(req, res, (function (err) {
281
+ _$jscoverage['application.js'][174]++;
282
+ req.app = res.app = orig;
283
+ _$jscoverage['application.js'][175]++;
284
+ next(err);
285
+ }));
286
+ });
287
+ }
288
+ _$jscoverage['application.js'][180]++;
289
+ debug("use %s %s", route, fn.name || "unnamed");
290
+ _$jscoverage['application.js'][181]++;
291
+ connect.proto.use.call(this, route, fn);
292
+ _$jscoverage['application.js'][184]++;
293
+ if (app) {
294
+ _$jscoverage['application.js'][185]++;
295
+ app.parent = this;
296
+ _$jscoverage['application.js'][186]++;
297
+ app.emit("mount", this);
298
+ }
299
+ _$jscoverage['application.js'][189]++;
300
+ return this;
301
+ });
302
+ _$jscoverage['application.js'][209]++;
303
+ app.engine = (function (ext, fn) {
304
+ _$jscoverage['application.js'][210]++;
305
+ if ("." != ext[0]) {
306
+ _$jscoverage['application.js'][210]++;
307
+ ext = "." + ext;
308
+ }
309
+ _$jscoverage['application.js'][211]++;
310
+ this.engines[ext] = fn;
311
+ _$jscoverage['application.js'][212]++;
312
+ return this;
313
+ });
314
+ _$jscoverage['application.js'][274]++;
315
+ app.param = (function (name, fn) {
316
+ _$jscoverage['application.js'][275]++;
317
+ var self = this, fns = [].slice.call(arguments, 1);
318
+ _$jscoverage['application.js'][279]++;
319
+ if (Array.isArray(name)) {
320
+ _$jscoverage['application.js'][280]++;
321
+ name.forEach((function (name) {
322
+ _$jscoverage['application.js'][281]++;
323
+ fns.forEach((function (fn) {
324
+ _$jscoverage['application.js'][282]++;
325
+ self.param(name, fn);
326
+ }));
327
+ }));
328
+ }
329
+ else {
330
+ _$jscoverage['application.js'][286]++;
331
+ if ("function" == typeof name) {
332
+ _$jscoverage['application.js'][287]++;
333
+ this._router.param(name);
334
+ }
335
+ else {
336
+ _$jscoverage['application.js'][290]++;
337
+ if (":" == name[0]) {
338
+ _$jscoverage['application.js'][290]++;
339
+ name = name.substr(1);
340
+ }
341
+ _$jscoverage['application.js'][291]++;
342
+ fns.forEach((function (fn) {
343
+ _$jscoverage['application.js'][292]++;
344
+ self._router.param(name, fn);
345
+ }));
346
+ }
347
+ }
348
+ _$jscoverage['application.js'][296]++;
349
+ return this;
350
+ });
351
+ _$jscoverage['application.js'][309]++;
352
+ app.set = (function (setting, val) {
353
+ _$jscoverage['application.js'][310]++;
354
+ if (1 == arguments.length) {
355
+ _$jscoverage['application.js'][311]++;
356
+ if (this.settings.hasOwnProperty(setting)) {
357
+ _$jscoverage['application.js'][312]++;
358
+ return this.settings[setting];
359
+ }
360
+ else {
361
+ _$jscoverage['application.js'][313]++;
362
+ if (this.parent) {
363
+ _$jscoverage['application.js'][314]++;
364
+ return this.parent.set(setting);
365
+ }
366
+ }
367
+ }
368
+ else {
369
+ _$jscoverage['application.js'][317]++;
370
+ this.settings[setting] = val;
371
+ _$jscoverage['application.js'][318]++;
372
+ return this;
373
+ }
374
+ });
375
+ _$jscoverage['application.js'][331]++;
376
+ app.path = (function () {
377
+ _$jscoverage['application.js'][332]++;
378
+ return this.parent? this.parent.path() + this.route: "";
379
+ });
380
+ _$jscoverage['application.js'][345]++;
381
+ app.enabled = (function (setting) {
382
+ _$jscoverage['application.js'][346]++;
383
+ return ! ! this.set(setting);
384
+ });
385
+ _$jscoverage['application.js'][357]++;
386
+ app.disabled = (function (setting) {
387
+ _$jscoverage['application.js'][358]++;
388
+ return ! this.set(setting);
389
+ });
390
+ _$jscoverage['application.js'][369]++;
391
+ app.enable = (function (setting) {
392
+ _$jscoverage['application.js'][370]++;
393
+ return this.set(setting, true);
394
+ });
395
+ _$jscoverage['application.js'][381]++;
396
+ app.disable = (function (setting) {
397
+ _$jscoverage['application.js'][382]++;
398
+ return this.set(setting, false);
399
+ });
400
+ _$jscoverage['application.js'][411]++;
401
+ app.configure = (function (env, fn) {
402
+ _$jscoverage['application.js'][412]++;
403
+ var envs = "all", args = [].slice.call(arguments);
404
+ _$jscoverage['application.js'][414]++;
405
+ fn = args.pop();
406
+ _$jscoverage['application.js'][415]++;
407
+ if (args.length) {
408
+ _$jscoverage['application.js'][415]++;
409
+ envs = args;
410
+ }
411
+ _$jscoverage['application.js'][416]++;
412
+ if ("all" == envs || ~ envs.indexOf(this.settings.env)) {
413
+ _$jscoverage['application.js'][416]++;
414
+ fn.call(this);
415
+ }
416
+ _$jscoverage['application.js'][417]++;
417
+ return this;
418
+ });
419
+ _$jscoverage['application.js'][430]++;
420
+ app.listen = (function () {
421
+ _$jscoverage['application.js'][431]++;
422
+ var server = http.createServer(this);
423
+ _$jscoverage['application.js'][432]++;
424
+ return server.listen.apply(server, arguments);
425
+ });
426
+ _$jscoverage['application.js'][439]++;
427
+ methods.forEach((function (method) {
428
+ _$jscoverage['application.js'][440]++;
429
+ app[method] = (function (path) {
430
+ _$jscoverage['application.js'][441]++;
431
+ if ("get" == method && 1 == arguments.length) {
432
+ _$jscoverage['application.js'][441]++;
433
+ return this.set(path);
434
+ }
435
+ _$jscoverage['application.js'][442]++;
436
+ var args = [method].concat([].slice.call(arguments));
437
+ _$jscoverage['application.js'][443]++;
438
+ if (! this._usedRouter) {
439
+ _$jscoverage['application.js'][443]++;
440
+ this.use(this.router);
441
+ }
442
+ _$jscoverage['application.js'][444]++;
443
+ return this._router.route.apply(this._router, args);
444
+ });
445
+ }));
446
+ _$jscoverage['application.js'][458]++;
447
+ app.all = (function (path) {
448
+ _$jscoverage['application.js'][459]++;
449
+ var args = arguments;
450
+ _$jscoverage['application.js'][460]++;
451
+ methods.forEach((function (method) {
452
+ _$jscoverage['application.js'][461]++;
453
+ if ("all" == method || "del" == method) {
454
+ _$jscoverage['application.js'][461]++;
455
+ return;
456
+ }
457
+ _$jscoverage['application.js'][462]++;
458
+ app[method].apply(this, args);
459
+ }), this);
460
+ _$jscoverage['application.js'][464]++;
461
+ return this;
462
+ });
463
+ _$jscoverage['application.js'][469]++;
464
+ app.del = app["delete"];
465
+ _$jscoverage['application.js'][482]++;
466
+ app.render = (function (name, options, fn) {
467
+ _$jscoverage['application.js'][483]++;
468
+ var self = this, opts = {}, cache = this.cache, engines = this.engines, view;
469
+ _$jscoverage['application.js'][490]++;
470
+ if ("function" == typeof options) {
471
+ _$jscoverage['application.js'][491]++;
472
+ fn = options, options = {};
473
+ }
474
+ _$jscoverage['application.js'][495]++;
475
+ utils.merge(opts, this.locals);
476
+ _$jscoverage['application.js'][498]++;
477
+ if (options.locals) {
478
+ _$jscoverage['application.js'][498]++;
479
+ utils.merge(opts, options.locals);
480
+ }
481
+ _$jscoverage['application.js'][501]++;
482
+ utils.merge(opts, options);
483
+ _$jscoverage['application.js'][504]++;
484
+ opts.cache = null == opts.cache? this.enabled("view cache"): opts.cache;
485
+ _$jscoverage['application.js'][509]++;
486
+ if (opts.cache) {
487
+ _$jscoverage['application.js'][509]++;
488
+ view = cache[name];
489
+ }
490
+ _$jscoverage['application.js'][512]++;
491
+ if (! view) {
492
+ _$jscoverage['application.js'][513]++;
493
+ view = new View(name, {defaultEngine: this.get("view engine"), root: this.get("views") || process.cwd() + "/views", engines: engines});
494
+ _$jscoverage['application.js'][520]++;
495
+ if (opts.cache) {
496
+ _$jscoverage['application.js'][520]++;
497
+ cache[name] = view;
498
+ }
499
+ }
500
+ _$jscoverage['application.js'][524]++;
501
+ try {
502
+ _$jscoverage['application.js'][525]++;
503
+ view.render(opts, fn);
504
+ }
505
+ catch (err) {
506
+ _$jscoverage['application.js'][527]++;
507
+ fn(err);
508
+ }
509
+ });
510
+ _$jscoverage['application.js'].source = ["","/*!"," * Express - proto"," * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>"," * MIT Licensed"," */","","/**"," * Module dependencies."," */","","var connect = require('connect')"," , Router = require('./router')"," , methods = Router.methods.concat('del', 'all')"," , middleware = require('./middleware')"," , debug = require('debug')('express:application')"," , View = require('./view')"," , url = require('url')"," , utils = connect.utils"," , path = require('path')"," , http = require('http')"," , join = path.join"," , fs = require('fs');","","/**"," * Application prototype."," */","","var app = exports = module.exports = {};","","/**"," * Initialize the server."," *"," * - setup default configuration"," * - setup default middleware"," * - setup route reflection methods"," *"," * @api private"," */","","app.init = function(){"," var self = this;"," this.cache = {};"," this.settings = {};"," this.engines = {};"," this.viewCallbacks = [];"," this.defaultConfiguration();",""," // route reflection methods"," methods.forEach(function(method){"," self.lookup[method] = function(path){"," return self._router.lookup(method, path);"," };",""," self.remove[method] = function(path){"," return self._router.lookup(method, path).remove();"," };"," });",""," // del -> delete"," self.lookup.del = self.lookup.delete;"," self.remove.del = self.remove.delete;","};","","/**"," * Initialize application configuration."," *"," * @api private"," */","","app.defaultConfiguration = function(){"," var self = this;",""," // default settings"," this.set('env', process.env.NODE_ENV || 'development');"," debug('booting in %s mode', this.get('env'));",""," // implicit middleware"," this.use(connect.query());"," this.use(middleware.init(this));",""," // app locals"," this.locals = function(obj){"," for (var key in obj) self.locals[key] = obj[key];"," return self;"," };",""," // response locals"," this.locals.use = function(fn){"," if (3 == fn.length) {"," self.viewCallbacks.push(fn);"," } else {"," self.viewCallbacks.push(function(req, res, done){"," fn(req, res);"," done();"," });"," }"," return this;"," };",""," // router"," this._router = new Router(this);"," this.routes = this._router.routes;"," this.__defineGetter__('router', function(){"," this._usedRouter = true;"," this._router.caseSensitive = this.enabled('case sensitive routing');"," this._router.strict = this.enabled('strict routing');"," return this._router.middleware;"," });",""," // default locals"," this.locals.settings = this.settings;",""," // default configuration"," this.configure('development', function(){"," this.set('json spaces', 2);"," });",""," this.configure('production', function(){"," this.enable('view cache');"," });","};","","/**"," * Remove routes matching the given `path`."," *"," * @param {Route} path"," * @return {Boolean}"," * @api public"," */","","app.remove = function(path){"," return this._router.lookup('all', path).remove();","};","","/**"," * Lookup routes defined with a path"," * equivalent to `path`."," *"," * @param {String} path"," * @return {Array}"," * @api public"," */","","app.lookup = function(path){"," return this._router.lookup('all', path);","};","","/**"," * Proxy `connect#use()` to apply settings to"," * mounted applications."," *"," * @param {String|Function|Server} route"," * @param {Function|Server} fn"," * @return {app} for chaining"," * @api public"," */","","app.use = function(route, fn){"," var app, home, handle;",""," // default route to '/'"," if ('string' != typeof route) fn = route, route = '/';",""," // express app"," if (fn.handle && fn.set) app = fn;",""," // restore .app property on req and res"," if (app) {"," app.route = route;"," fn = function(req, res, next) {"," var orig = req.app;"," app.handle(req, res, function(err){"," req.app = res.app = orig;"," next(err);"," });"," };"," }",""," debug('use %s %s', route, fn.name || 'unnamed');"," connect.proto.use.call(this, route, fn);",""," // mounted an app"," if (app) {"," app.parent = this;"," app.emit('mount', this);"," }",""," return this;","};","","/**"," * Register the given template engine callback `fn`"," * as `ext`. For example we may wish to map \".html\""," * files to ejs rather than using the \".ejs\" extension."," *"," * app.engine('.html', require('ejs').render);"," *"," * or"," *"," * app.engine('html', require('ejs').render);"," *"," * @param {String} ext"," * @param {Function} fn"," * @return {app} for chaining"," * @api public"," */","","app.engine = function(ext, fn){"," if ('.' != ext[0]) ext = '.' + ext;"," this.engines[ext] = fn;"," return this;","};","","/**"," * Map the given param placeholder `name`(s) to the given callback(s)."," *"," * Param mapping is used to provide pre-conditions to routes"," * which us normalized placeholders. This callback has the same"," * signature as regular middleware, for example below when \":userId\""," * is used this function will be invoked in an attempt to load the user."," *"," * app.param('userId', function(req, res, next, id){"," * User.find(id, function(err, user){"," * if (err) {"," * next(err);"," * } else if (user) {"," * req.user = user;"," * next();"," * } else {"," * next(new Error('failed to load user'));"," * }"," * });"," * });"," *"," * Passing a single function allows you to map logic"," * to the values passed to `app.param()`, for example"," * this is useful to provide coercion support in a concise manner."," *"," * The following example maps regular expressions to param values"," * ensuring that they match, otherwise passing control to the next"," * route:"," *"," * app.param(function(name, regexp){"," * if (regexp instanceof RegExp) {"," * return function(req, res, next, val){"," * var captures;"," * if (captures = regexp.exec(String(val))) {"," * req.params[name] = captures;"," * next();"," * } else {"," * next('route');"," * }"," * }"," * }"," * });"," *"," * We can now use it as shown below, where \"/commit/:commit\" expects"," * that the value for \":commit\" is at 5 or more digits. The capture"," * groups are then available as `req.params.commit` as we defined"," * in the function above."," *"," * app.param('commit', /^\\d{5,}$/);"," *"," * For more of this useful functionality take a look"," * at [express-params](http://github.com/visionmedia/express-params)."," *"," * @param {String|Array|Function} name"," * @param {Function} fn"," * @return {app} for chaining"," * @api public"," */","","app.param = function(name, fn){"," var self = this"," , fns = [].slice.call(arguments, 1);",""," // array"," if (Array.isArray(name)) {"," name.forEach(function(name){"," fns.forEach(function(fn){"," self.param(name, fn);"," });"," });"," // param logic"," } else if ('function' == typeof name) {"," this._router.param(name);"," // single"," } else {"," if (':' == name[0]) name = name.substr(1);"," fns.forEach(function(fn){"," self._router.param(name, fn);"," });"," }",""," return this;","};","","/**"," * Assign `setting` to `val`, or return `setting`'s value."," * Mounted servers inherit their parent server's settings."," *"," * @param {String} setting"," * @param {String} val"," * @return {Server|Mixed} for chaining, or the setting value"," * @api public"," */","","app.set = function(setting, val){"," if (1 == arguments.length) {"," if (this.settings.hasOwnProperty(setting)) {"," return this.settings[setting];"," } else if (this.parent) {"," return this.parent.set(setting);"," }"," } else {"," this.settings[setting] = val;"," return this;"," }","};","","/**"," * Return the app's absolute pathname"," * based on the parent(s) that have"," * mounted it."," *"," * @return {String}"," * @api private"," */","","app.path = function(){"," return this.parent"," ? this.parent.path() + this.route"," : '';","};","","/**"," * Check if `setting` is enabled."," *"," * @param {String} setting"," * @return {Boolean}"," * @api public"," */","","app.enabled = function(setting){"," return !!this.set(setting);","};","","/**"," * Check if `setting` is disabled."," *"," * @param {String} setting"," * @return {Boolean}"," * @api public"," */","","app.disabled = function(setting){"," return !this.set(setting);","};","","/**"," * Enable `setting`."," *"," * @param {String} setting"," * @return {app} for chaining"," * @api public"," */","","app.enable = function(setting){"," return this.set(setting, true);","};","","/**"," * Disable `setting`."," *"," * @param {String} setting"," * @return {app} for chaining"," * @api public"," */","","app.disable = function(setting){"," return this.set(setting, false);","};","","/**"," * Configure callback for zero or more envs,"," * when no env is specified that callback will"," * be invoked for all environments. Any combination"," * can be used multiple times, in any order desired."," *"," * Examples:"," *"," * app.configure(function(){"," * // executed for all envs"," * });"," *"," * app.configure('stage', function(){"," * // executed staging env"," * });"," *"," * app.configure('stage', 'production', function(){"," * // executed for stage and production"," * });"," *"," * @param {String} env..."," * @param {Function} fn"," * @return {app} for chaining"," * @api public"," */","","app.configure = function(env, fn){"," var envs = 'all'"," , args = [].slice.call(arguments);"," fn = args.pop();"," if (args.length) envs = args;"," if ('all' == envs || ~envs.indexOf(this.settings.env)) fn.call(this);"," return this;","};","","/**"," * Listen for connections."," *"," * This method takes the same arguments"," * as node's `http.Server#listen()`. "," *"," * @return {http.Server}"," * @api public"," */","","app.listen = function(){"," var server = http.createServer(this);"," return server.listen.apply(server, arguments);","};","","/**"," * Delegate `.VERB(...)` calls to `.route(VERB, ...)`."," */","","methods.forEach(function(method){"," app[method] = function(path){"," if ('get' == method && 1 == arguments.length) return this.set(path); "," var args = [method].concat([].slice.call(arguments));"," if (!this._usedRouter) this.use(this.router);"," return this._router.route.apply(this._router, args);"," }","});","","/**"," * Special-cased \"all\" method, applying the given route `path`,"," * middleware, and callback to _every_ HTTP method."," *"," * @param {String} path"," * @param {Function} ..."," * @return {app} for chaining"," * @api public"," */","","app.all = function(path){"," var args = arguments;"," methods.forEach(function(method){"," if ('all' == method || 'del' == method) return;"," app[method].apply(this, args);"," }, this);"," return this;","};","","// del -> delete alias","","app.del = app.delete;","","/**"," * Render the given view `name` name with `options`"," * and a callback accepting an error and the"," * rendered template string."," *"," * @param {String} name"," * @param {String|Function} options or fn"," * @param {Function} fn"," * @api public"," */","","app.render = function(name, options, fn){"," var self = this"," , opts = {}"," , cache = this.cache"," , engines = this.engines"," , view;",""," // support callback function as second arg"," if ('function' == typeof options) {"," fn = options, options = {};"," }",""," // merge app.locals"," utils.merge(opts, this.locals);",""," // merge options.locals"," if (options.locals) utils.merge(opts, options.locals);",""," // merge options"," utils.merge(opts, options);",""," // set .cache unless explicitly provided"," opts.cache = null == opts.cache"," ? this.enabled('view cache')"," : opts.cache;",""," // primed cache"," if (opts.cache) view = cache[name];",""," // view"," if (!view) {"," view = new View(name, {"," defaultEngine: this.get('view engine')"," , root: this.get('views') || process.cwd() + '/views'"," , engines: engines"," });",""," // prime the cache"," if (opts.cache) cache[name] = view;"," }",""," // render"," try {"," view.render(opts, fn);"," } catch (err) {"," fn(err);"," }","};"];