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
@@ -1,19 +1,34 @@
1
1
  {
2
2
  "name": "express",
3
3
  "description": "Sinatra inspired web development framework",
4
- "version": "2.5.6",
5
- "author": "TJ Holowaychuk <tj@vision-media.ca>",
6
- "contributors": [
7
- { "name": "TJ Holowaychuk", "email": "tj@vision-media.ca" },
8
- { "name": "Aaron Heckmann", "email": "aaron.heckmann+github@gmail.com" },
9
- { "name": "Ciaran Jessup", "email": "ciaranj@gmail.com" },
10
- { "name": "Guillermo Rauch", "email": "rauchg@gmail.com" }
4
+ "version": "2.5.9",
5
+ "author": {
6
+ "name": "TJ Holowaychuk",
7
+ "email": "tj@vision-media.ca"
8
+ },
9
+ "contributors": [
10
+ {
11
+ "name": "TJ Holowaychuk",
12
+ "email": "tj@vision-media.ca"
13
+ },
14
+ {
15
+ "name": "Aaron Heckmann",
16
+ "email": "aaron.heckmann+github@gmail.com"
17
+ },
18
+ {
19
+ "name": "Ciaran Jessup",
20
+ "email": "ciaranj@gmail.com"
21
+ },
22
+ {
23
+ "name": "Guillermo Rauch",
24
+ "email": "rauchg@gmail.com"
25
+ }
11
26
  ],
12
27
  "dependencies": {
13
28
  "connect": "1.x",
14
- "mime": ">= 0.0.1",
15
- "qs": ">= 0.3.1",
16
- "mkdirp": "0.0.7"
29
+ "mime": "1.2.4",
30
+ "qs": "0.4.x",
31
+ "mkdirp": "0.3.0"
17
32
  },
18
33
  "devDependencies": {
19
34
  "connect-form": "0.2.1",
@@ -27,13 +42,37 @@
27
42
  "node-markdown": ">= 0.0.1",
28
43
  "connect-redis": ">= 0.0.1"
29
44
  },
30
- "keywords": ["framework", "sinatra", "web", "rest", "restful"],
31
- "repository": "git://github.com/visionmedia/express",
45
+ "keywords": [
46
+ "framework",
47
+ "sinatra",
48
+ "web",
49
+ "rest",
50
+ "restful"
51
+ ],
52
+ "repository": {
53
+ "type": "git",
54
+ "url": "git://github.com/visionmedia/express.git"
55
+ },
32
56
  "main": "index",
33
- "bin": { "express": "./bin/express" },
57
+ "bin": {
58
+ "express": "./bin/express"
59
+ },
34
60
  "scripts": {
35
61
  "test": "make test",
36
- "prepublish" : "npm prune"
62
+ "prepublish": "npm prune"
63
+ },
64
+ "engines": {
65
+ "node": ">= 0.4.1 < 0.7.0"
66
+ },
67
+ "_npmUser": {
68
+ "name": "ddollar",
69
+ "email": "ddollar@gmail.com"
37
70
  },
38
- "engines": { "node": ">= 0.4.1 < 0.7.0" }
39
- }
71
+ "_id": "express@2.5.9",
72
+ "optionalDependencies": {},
73
+ "_engineSupported": true,
74
+ "_npmVersion": "1.1.21",
75
+ "_nodeVersion": "v0.6.17",
76
+ "_defaultsLoaded": true,
77
+ "_from": "express@2.x.x"
78
+ }
@@ -0,0 +1,41 @@
1
+
2
+ var express = require('./')
3
+ , app = express();
4
+
5
+ var user = { name: 'Tobi' };
6
+
7
+ app.param('user_id', function(req, res, next, id){
8
+ console.log(id);
9
+ });
10
+
11
+ app.get('/:user_id/post/:post_id', function(req, res){
12
+ res.send(req.params.user);
13
+ });
14
+
15
+ app.get('*', function(req, res, next){
16
+ console.log('GET one');
17
+ next();
18
+ });
19
+
20
+ app.use(function(req, res, next){
21
+ console.log('use');
22
+ next();
23
+ });
24
+
25
+ app.get('*', one, two, function(req, res, next){
26
+ console.log('GET two');
27
+ res.send('hey\n');
28
+ });
29
+
30
+ function one(req, res, next) {
31
+ console.log('middleware one');
32
+ next();
33
+ }
34
+
35
+ function two(req, res, next) {
36
+ console.log('middleware two');
37
+ next();
38
+ }
39
+
40
+
41
+ app.listen(4000);
@@ -1,13 +1,35 @@
1
1
  {
2
2
  "name": "knox",
3
3
  "description": "Amazon S3 client",
4
- "keywords": ["aws", "amazon", "s3"],
4
+ "keywords": [
5
+ "aws",
6
+ "amazon",
7
+ "s3"
8
+ ],
5
9
  "version": "0.0.9",
6
- "author": "TJ Holowaychuk <tj@learnboost.com>",
10
+ "author": {
11
+ "name": "TJ Holowaychuk",
12
+ "email": "tj@learnboost.com"
13
+ },
7
14
  "main": "./index.js",
8
- "engines": { "node": ">= 0.2.0" },
15
+ "engines": {
16
+ "node": ">= 0.2.0"
17
+ },
9
18
  "repository": {
10
19
  "type": "git",
11
20
  "url": "git://github.com/LearnBoost/knox.git"
12
- }
21
+ },
22
+ "_npmUser": {
23
+ "name": "ddollar",
24
+ "email": "ddollar@gmail.com"
25
+ },
26
+ "_id": "knox@0.0.9",
27
+ "dependencies": {},
28
+ "devDependencies": {},
29
+ "optionalDependencies": {},
30
+ "_engineSupported": true,
31
+ "_npmVersion": "1.1.21",
32
+ "_nodeVersion": "v0.6.17",
33
+ "_defaultsLoaded": true,
34
+ "_from": "knox@0.0.x"
13
35
  }
@@ -1,14 +1,43 @@
1
1
  {
2
- "name" : "node-uuid",
3
- "description" : "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
4
- "url" : "http://github.com/broofa/node-uuid",
5
- "keywords" : ["uuid", "guid", "rfc4122"],
6
- "author" : "Robert Kieffer <robert@broofa.com>",
7
- "contributors" : [
8
- {"name": "Christoph Tavan <dev@tavan.de>", "github": "https://github.com/ctavan"}
2
+ "name": "node-uuid",
3
+ "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.",
4
+ "url": "http://github.com/broofa/node-uuid",
5
+ "keywords": [
6
+ "uuid",
7
+ "guid",
8
+ "rfc4122"
9
9
  ],
10
- "dependencies" : [],
11
- "lib" : ".",
12
- "main" : "./uuid.js",
13
- "version" : "1.3.3"
10
+ "author": {
11
+ "name": "Robert Kieffer",
12
+ "email": "robert@broofa.com"
13
+ },
14
+ "contributors": [
15
+ {
16
+ "name": "Christoph Tavan",
17
+ "email": "dev@tavan.de"
18
+ }
19
+ ],
20
+ "lib": ".",
21
+ "main": "./uuid.js",
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git://github.com/broofa/node-uuid.git"
25
+ },
26
+ "version": "1.3.3",
27
+ "_npmUser": {
28
+ "name": "ddollar",
29
+ "email": "ddollar@gmail.com"
30
+ },
31
+ "_id": "node-uuid@1.3.3",
32
+ "dependencies": {},
33
+ "devDependencies": {},
34
+ "optionalDependencies": {},
35
+ "engines": {
36
+ "node": "*"
37
+ },
38
+ "_engineSupported": true,
39
+ "_npmVersion": "1.1.21",
40
+ "_nodeVersion": "v0.6.17",
41
+ "_defaultsLoaded": true,
42
+ "_from": "node-uuid@1.x.x"
14
43
  }
@@ -15,7 +15,7 @@ function _log(msg, type) {
15
15
  }
16
16
  if (typeof(console) != 'undefined') {
17
17
  var color = {
18
- log: '\033[30m',
18
+ log: '\033[39m',
19
19
  warn: '\033[33m',
20
20
  error: '\033[31m'
21
21
  }
@@ -0,0 +1,120 @@
1
+ # nodemon
2
+
3
+ For use during development of a node.js based application.
4
+
5
+ nodemon will watch the files in the directory that nodemon was started, and if they change, it will automatically restart your node application.
6
+
7
+ nodemon does **not** require *any* changes to your code or method of development. nodemon simply wraps your node application and keeps an eye on any files that have changed. Remember that nodemon is a replacement wrapper for `node`, think of it as replacing the word "node" on the command line when you run your script.
8
+
9
+ # Installation
10
+
11
+ Either through forking or by using [npm](http://npmjs.org) (the recommended way):
12
+
13
+ npm install nodemon -g
14
+
15
+ And nodemon will be installed in to your bin path. Note that as of npm v1, you must explicitly tell npm to install globally as nodemon is a command line utility.
16
+
17
+ # Usage
18
+
19
+ nodemon wraps your application, so you can pass all the arguments you would normally pass to your app:
20
+
21
+ nodemon [your node app]
22
+
23
+ For example, if my application accepted a host and port as the arguments, I would start it as so:
24
+
25
+ nodemon ./server.js localhost 8080
26
+
27
+ Any output from this script is prefixed with `[nodemon]`, otherwise all output from your application, errors included, will be echoed out as expected.
28
+
29
+ nodemon also supports running and monitoring [coffee-script](http://jashkenas.github.com/coffee-script/) apps:
30
+
31
+ nodemon server.coffee
32
+
33
+ If no script is given, nodemon will test for a `package.json` file and if found, will run the file associated with the *main* property ([ref](https://github.com/remy/nodemon/issues/14)).
34
+
35
+ You can also pass the debug flag to node through the command line as you would normally:
36
+
37
+ nodemon --debug ./server.js 80
38
+
39
+ If you have a `package.json` file for your app, you can omit the main script entirely and nodemon will read the `package.json` for the `main` property and use that value as the app.
40
+
41
+ # Automatic re-running
42
+
43
+ nodemon was original written to restart hanging processes such as web servers, but now supports apps that cleanly exit. If your script exits cleanly, nodemon will continue to monitor the directory (or directories) and restart the script if there are any changes.
44
+
45
+ # Running non-node scripts
46
+
47
+ nodemon can also be used to execute and monitor other programs. nodemon will read the file extension of the script being run and monitor that extension instead of .js if there's no .nodemonignore:
48
+
49
+ nodemon --exec "python -v" ./app.py
50
+
51
+ Now nodemon will run `app.py` with python in verbose mode (note that if you're not passing args to the exec program, you don't need the quotes), and look for new or modified files with the `.py` extension.
52
+
53
+ # Monitoring multiple directories
54
+
55
+ By default nodemon monitors the current working directory. If you want to take control of that option, use the `--watch` option to add specific paths:
56
+
57
+ nodemon --watch app --watch libs app/server.js
58
+
59
+ Now nodemon will only restart if there are changes in the `./app` or `./libs` directory. By default nodemon will traverse sub-directories, so there's no need in explicitly including sub-directories.
60
+
61
+ # Delaying restarting
62
+
63
+ In some situations, you may want to wait until a number of files have changed. The timeout before checking for new file changes is 1 second. If you're uploading a number of files and it's taking some number of seconds, this could cause your app to restart multiple time unnecessarily.
64
+
65
+ To add an extra throttle, or delay restarting, use the `--delay` command:
66
+
67
+ nodemon --delay 10 server.js
68
+
69
+ The delay figure is number of seconds to delay before restarting. So nodemon will only restart your app the given number of seconds after the *last* file change.
70
+
71
+ # Ignoring files
72
+
73
+ By default, if nodemon will only restart when a `.js` JavaScript file changes. In some cases you will want to ignore some specific files, directories or file patterns, to prevent nodemon from prematurely restarting your application.
74
+
75
+ You can use the [example ignore file](http://github.com/remy/nodemon/blob/master/nodemonignore.example) (note that this example file is not hidden - you must rename it to `.nodemonignore`) as a basis for your nodemon, but it's very simple to create your own:
76
+
77
+ # this is my ignore file with a nice comment at the top
78
+
79
+ /vendor/* # ignore all external submodules
80
+ /public/* # static files
81
+ ./README.md # a specific file
82
+ *.css # ignore any CSS files too
83
+
84
+ The ignore file accepts:
85
+
86
+ * Comments starting with a `#` symbol
87
+ * Blank lines
88
+ * Specific files
89
+ * File patterns (this is converted to a regex, so you have full control of the pattern)
90
+
91
+ # Controlling shutdown of your script
92
+
93
+ nodemon sends a kill signal to your application when it sees a file update. If you need to clean up on shutdown inside your script you can capture the kill signal and handle it yourself.
94
+
95
+ The following example will listen once for the `SIGUSR2` signal (used by nodemon to restart), run the clean up process and then kill itself for nodemon to continue control:
96
+
97
+ process.once('SIGUSR2', function () {
98
+ gracefulShutdown(function () {
99
+ process.kill(process.pid, 'SIGUSR2');
100
+ })
101
+ });
102
+
103
+ Note that the `process.kill` is *only* called once your shutdown jobs are complete. Hat tip to [Benjie Gillam](http://www.benjiegillam.com/2011/08/node-js-clean-restart-and-faster-development-with-nodemon/) for writing technique this up.
104
+
105
+
106
+ # Using nodemon with forever
107
+
108
+ If you're using nodemon with [forever](https://github.com/nodejitsu/forever) (perhaps in a production environment) you can combine the two together. This way if the script crashes, forever restarts the script, and if there are file changes, nodemon restarts your script. For more detail, see [issue 30](https://github.com/remy/nodemon/issues/30).
109
+
110
+ To acheive this you need to include the `--exitcrash` flag to ensure nodemon exits if the script crashes (or exits unexpectedly):
111
+
112
+ forever nodemon --exitcrash server.js
113
+
114
+ To test this, you can kill the server.js process and forever will restart it. If you `touch server.js` nodemon will restart it.
115
+
116
+ Note that I *would not* recommend using nodemon in a production environment - but that's because I wouldn't want it restart without my explicit instruction.
117
+
118
+ # License
119
+
120
+ MIT [http://rem.mit-license.org](http://rem.mit-license.org)
@@ -0,0 +1,518 @@
1
+ #!/usr/bin/env node
2
+ var fs = require('fs'),
3
+ util = require('util'),
4
+ childProcess = require('child_process'),
5
+ dirs = [],
6
+ path = require('path'),
7
+ exists = fs.exists || path.exists, // yay, exists moved from path to fs in 0.7.x ... :-\
8
+ existsSync = fs.existsSync || path.existsSync,
9
+ spawn = childProcess.spawn,
10
+ meta = JSON.parse(fs.readFileSync(__dirname + '/package.json')),
11
+ exec = childProcess.exec,
12
+ flag = './.monitor',
13
+ program = getNodemonArgs(),
14
+ child = null,
15
+ monitor = null,
16
+ ignoreFilePath = './.nodemonignore',
17
+ oldIgnoreFilePath = './nodemon-ignore',
18
+ ignoreFiles = [],
19
+ reIgnoreFiles = null,
20
+ timeout = 1000, // check every 1 second
21
+ restartDelay = 0, // controlled through arg --delay 10 (for 10 seconds)
22
+ restartTimer = null,
23
+ lastStarted = +new Date,
24
+ statOffset = 0, // stupid fix for https://github.com/joyent/node/issues/2705
25
+ platform = process.platform,
26
+ isWindows = platform === 'win32',
27
+ noWatch = (platform !== 'win32') || !fs.watch, // && platform !== 'linux' - removed linux fs.watch usage #72
28
+ watchFile = platform === 'darwin' ? fs.watchFile : fs.watch, // lame :(
29
+ // create once, reuse as needed
30
+ reEscComments = /\\#/g,
31
+ reUnescapeComments = /\^\^/g, // note that '^^' is used in place of escaped comments
32
+ reComments = /#.*$/,
33
+ reTrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g,
34
+ reEscapeChars = /[.|\-[\]()\\]/g,
35
+ reAsterisk = /\*/g;
36
+
37
+ // test to see if the version of find being run supports searching by seconds (-mtime -1s -print)
38
+ if (noWatch) {
39
+ exec('find -L /dev/null -type f -mtime -1s -print', function(error, stdout, stderr) {
40
+ if (error) {
41
+ if (!fs.watch) {
42
+ util.error('\x1B[1;31mThe version of node you are using combined with the version of find being used does not support watching files. Upgrade to a newer version of node, or install a version of find that supports search by seconds.\x1B[0m');
43
+ process.exit(1);
44
+ } else {
45
+ noWatch = false;
46
+ }
47
+ }
48
+ });
49
+ }
50
+
51
+ function startNode() {
52
+ util.log('\x1B[32m[nodemon] starting `' + program.options.exec + ' ' + program.args.join(' ') + '`\x1B[0m');
53
+
54
+ child = spawn(program.options.exec, program.args);
55
+
56
+ lastStarted = +new Date;
57
+
58
+ child.stdout.on('data', function (data) {
59
+ util.print(data);
60
+ });
61
+
62
+ child.stderr.on('data', function (data) {
63
+ process.stderr.write(data);
64
+ });
65
+
66
+ child.on('exit', function (code, signal) {
67
+ // this is nasty, but it gives it windows support
68
+ if (isWindows && signal == 'SIGTERM') signal = 'SIGUSR2';
69
+ // exit the monitor, but do it gracefully
70
+ if (signal == 'SIGUSR2') {
71
+ // restart
72
+ startNode();
73
+ } else if (code === 0) { // clean exit - wait until file change to restart
74
+ util.log('\x1B[32m[nodemon] clean exit - waiting for changes before restart\x1B[0m');
75
+ child = null;
76
+ } else if (program.options.exitcrash) {
77
+ util.log('\x1B[1;31m[nodemon] app crashed\x1B[0m');
78
+ process.exit(0);
79
+ } else {
80
+ util.log('\x1B[1;31m[nodemon] app crashed - waiting for file changes before starting...\x1B[0m');
81
+ child = null;
82
+ }
83
+ });
84
+
85
+ // pinched from https://github.com/DTrejo/run.js - pipes stdin to the child process - cheers DTrejo ;-)
86
+ if (program.options.stdin) {
87
+ process.stdin.resume();
88
+ process.stdin.setEncoding('utf8');
89
+ process.stdin.pipe(child.stdin);
90
+ }
91
+
92
+ setTimeout(startMonitor, timeout);
93
+ }
94
+
95
+ function startMonitor() {
96
+ var changeFunction;
97
+
98
+ if (noWatch) {
99
+ // if native fs.watch doesn't work the way we want, we keep polling find command (mac only oddly)
100
+ changeFunction = function (lastStarted, callback) {
101
+ var cmds = [],
102
+ changed = [];
103
+
104
+ dirs.forEach(function(dir) {
105
+ cmds.push('find -L "' + dir + '" -type f -mtime -' + ((+new Date - lastStarted)/1000|0) + 's -print');
106
+ });
107
+
108
+ exec(cmds.join(';'), function (error, stdout, stderr) {
109
+ var files = stdout.split(/\n/);
110
+ files.pop(); // remove blank line ending and split
111
+ callback(files);
112
+ });
113
+ }
114
+ } else {
115
+ changeFunction = function (lastStarted, callback) {
116
+ // recursive watch - watch each directory and it's subdirectories, etc, etc
117
+ var watch = function (err, dir) {
118
+ try {
119
+ fs.watch(dir, { persistent: false }, function (event, filename) {
120
+ var filepath = path.join(dir, filename);
121
+ callback([filepath]);
122
+ });
123
+
124
+ fs.readdir(dir, function (err, files) {
125
+ if (!err) {
126
+ files.forEach(function (file) {
127
+ var filename = path.join(dir, file);
128
+ fs.stat(filename, function (err, stat) {
129
+ if (!err && stat) {
130
+ if (stat.isDirectory()) {
131
+ fs.realpath(filename, watch);
132
+ }
133
+ }
134
+ });
135
+ });
136
+ }
137
+ });
138
+ } catch (e) {
139
+ // ignoring this directory, likely it's "My Music"
140
+ // or some such windows fangled stuff
141
+ }
142
+ }
143
+ dirs.forEach(function (dir) {
144
+ fs.realpath(dir, watch);
145
+ });
146
+ }
147
+ }
148
+
149
+ var isWindows = process.platform === 'win32';
150
+ changeFunction(lastStarted, function (files) {
151
+ if (files.length) {
152
+ // filter ignored files
153
+ if (ignoreFiles.length) {
154
+ files = files.filter(function(file) {
155
+ // If we are in a Windows machine
156
+ if (isWindows) {
157
+ // Break up the file by slashes
158
+ var fileParts = file.split(/\\/g);
159
+
160
+ // Remove the first piece (C:)
161
+ fileParts.shift();
162
+
163
+ // Join the parts together with Unix slashes
164
+ file = '/' + fileParts.join('/');
165
+ }
166
+ return !reIgnoreFiles.test(file);
167
+ });
168
+ }
169
+
170
+
171
+ if (files.length) {
172
+ if (restartTimer !== null) clearTimeout(restartTimer);
173
+ restartTimer = setTimeout(function () {
174
+ if (program.options.verbose) util.log('[nodemon] restarting due to changes...');
175
+ files.forEach(function (file) {
176
+ if (program.options.verbose) util.log('[nodemon] ' + file);
177
+ });
178
+ if (program.options.verbose) util.print('\n\n');
179
+
180
+ if (child !== null) {
181
+ child.kill(isWindows ? '' : 'SIGUSR2');
182
+ } else {
183
+ startNode();
184
+ }
185
+ }, restartDelay);
186
+ return;
187
+ }
188
+ }
189
+
190
+ if (noWatch) setTimeout(startMonitor, timeout);
191
+ });
192
+ }
193
+
194
+ function addIgnoreRule(line, noEscape) {
195
+ // remove comments and trim lines
196
+ // this mess of replace methods is escaping "\#" to allow for emacs temp files
197
+ if (!noEscape) {
198
+ if (line = line.replace(reEscComments, '^^').replace(reComments, '').replace(reUnescapeComments, '#').replace(reTrim, '')) {
199
+ ignoreFiles.push(line.replace(reEscapeChars, '\\$&').replace(reAsterisk, '.*'));
200
+ }
201
+ } else if (line = line.replace(reTrim, '')) {
202
+ ignoreFiles.push(line);
203
+ }
204
+ reIgnoreFiles = new RegExp(ignoreFiles.join('|'));
205
+ }
206
+
207
+ function readIgnoreFile(curr, prev) {
208
+ // unless the ignore file was actually modified, do no re-read it
209
+ if(curr && prev && curr.mtime.valueOf() === prev.mtime.valueOf()) return;
210
+
211
+ if (platform === 'darwin') fs.unwatchFile(ignoreFilePath);
212
+
213
+ // Check if ignore file still exists. Vim tends to delete it before replacing with changed file
214
+ exists(ignoreFilePath, function(exists) {
215
+ if (program.options.verbose) util.log('[nodemon] reading ignore list');
216
+
217
+ // ignoreFiles = ignoreFiles.concat([flag, ignoreFilePath]);
218
+ // addIgnoreRule(flag);
219
+ addIgnoreRule(ignoreFilePath.substring(2)); // ignore the ./ part of the filename
220
+ fs.readFileSync(ignoreFilePath).toString().split(/\n/).forEach(function (rule, i) {
221
+ addIgnoreRule(rule);
222
+ });
223
+
224
+ watchFile(ignoreFilePath, { persistent: false }, readIgnoreFile);
225
+ });
226
+ }
227
+
228
+ // attempt to shutdown the wrapped node instance and remove
229
+ // the monitor file as nodemon exists
230
+ function cleanup() {
231
+ child && child.kill();
232
+ // fs.unlink(flag);
233
+ }
234
+
235
+ function getNodemonArgs() {
236
+ var args = process.argv,
237
+ len = args.length,
238
+ i = 2,
239
+ dir = process.cwd(),
240
+ indexOfApp = -1,
241
+ app = null;
242
+
243
+ for (; i < len; i++) {
244
+ if (existsSync(path.resolve(dir, args[i]))) {
245
+ // double check we didn't use the --watch or -w opt before this arg
246
+ if (args[i-1] && (args[i-1] == '-w' || args[i-1] == '--watch')) {
247
+ // ignore
248
+ } else {
249
+ indexOfApp = i;
250
+ break;
251
+ }
252
+ }
253
+ }
254
+
255
+ if (indexOfApp !== -1) {
256
+ // not found, so assume we're reading the package.json and thus swallow up all the args
257
+ // indexOfApp = len;
258
+ app = process.argv[i];
259
+ indexOfApp++;
260
+ } else {
261
+ indexOfApp = len;
262
+ }
263
+
264
+ var appargs = [], //process.argv.slice(indexOfApp),
265
+ // app = appargs[0],
266
+ nodemonargs = process.argv.slice(2, indexOfApp - (app ? 1 : 0)),
267
+ arg,
268
+ options = {
269
+ delay: 1,
270
+ watch: [],
271
+ exec: 'node',
272
+ verbose: true,
273
+ js: false, // becomes the default anyway...
274
+ includeHidden: false,
275
+ exitcrash: false,
276
+ stdin: true
277
+ // args: []
278
+ };
279
+
280
+ // process nodemon args
281
+ args.splice(0, 2);
282
+ while (arg = args.shift()) {
283
+ if (arg === '--help' || arg === '-h' || arg === '-?') {
284
+ return help(); // exits program
285
+ } else if (arg === '--version' || arg == '-v') {
286
+ return version(); // also exits
287
+ } else if (arg == '--js') {
288
+ options.js = true;
289
+ } else if (arg == '--quiet' || arg == '-q') {
290
+ options.verbose = false;
291
+ } else if (arg == '--hidden') {
292
+ options.includeHidden = true;
293
+ } else if (arg === '--watch' || arg === '-w') {
294
+ options.watch.push(args.shift());
295
+ } else if (arg === '--exitcrash') {
296
+ options.exitcrash = true;
297
+ } else if (arg === '--delay' || arg === '-d') {
298
+ options.delay = parseInt(args.shift());
299
+ } else if (arg === '--exec' || arg === '-x') {
300
+ options.exec = args.shift();
301
+ } else if (arg === '--no-stdin' || arg === '-I') {
302
+ options.stdin = false;
303
+ } else { //if (arg === "--") {
304
+ // Remaining args are node arguments
305
+ appargs.push(arg);
306
+ }
307
+ }
308
+
309
+ var program = { options: options, args: appargs, app: app };
310
+
311
+ getAppScript(program);
312
+
313
+ return program;
314
+ }
315
+
316
+ function getAppScript(program) {
317
+ var hokeycokey = false;
318
+ if (!program.args.length || program.app === null) {
319
+ // try to get the app from the package.json
320
+ // doing a try/catch because we can't use the path.exist callback pattern
321
+ // or we could, but the code would get messy, so this will do exactly
322
+ // what we're after - if the file doesn't exist, it'll throw.
323
+ try {
324
+ // note: this isn't nodemon's package, it's the user's cwd package
325
+ program.app = JSON.parse(fs.readFileSync('./package.json').toString()).main;
326
+ if (program.app === undefined) {
327
+ // no app found to run - so give them a tip and get the feck out
328
+ help();
329
+ }
330
+ program.args.unshift(program.app);
331
+ hokeycokey = true;
332
+ } catch (e) {}
333
+ }
334
+
335
+ if (!program.app) {
336
+ program.app = program.args[0];
337
+ }
338
+
339
+ program.app = path.basename(program.app);
340
+ program.ext = path.extname(program.app);
341
+
342
+ if (program.options.exec.indexOf(' ') !== -1) {
343
+ var execOptions = program.options.exec.split(' ');
344
+ program.options.exec = execOptions.splice(0, 1)[0];
345
+ program.args = execOptions.concat(program.args);
346
+ }
347
+
348
+ if (program.options.exec === 'node' && program.ext == '.coffee') {
349
+ program.options.exec = 'coffee';
350
+ }
351
+
352
+ if (program.options.exec === 'coffee') {
353
+ if (hokeycokey) {
354
+ program.args.push(program.args.shift());
355
+ }
356
+ //coffeescript requires --nodejs --debug
357
+ var debugIndex = program.args.indexOf('--debug');
358
+ if (debugIndex === -1) debugIndex = program.args.indexOf('--debug-brk');
359
+ if (debugIndex !== -1 && program.args.indexOf('--nodejs') === -1) {
360
+ program.args.splice(debugIndex, 0, '--nodejs');
361
+ }
362
+ // monitor both types - TODO possibly make this an option?
363
+ program.ext = '.coffee|.js';
364
+ if (!program.options.exec || program.options.exec == 'node') program.options.exec = 'coffee';
365
+
366
+ // because windows can't find 'coffee', it needs the real file 'coffee.cmd'
367
+ if (isWindows) program.options.exec += '.cmd';
368
+ }
369
+ }
370
+
371
+ function findStatOffset() {
372
+ var filename = './.stat-test';
373
+ fs.writeFile(filename, function (err) {
374
+ if (err) return;
375
+ fs.stat(filename, function (err, stat) {
376
+ if (err) return;
377
+
378
+ statOffset = stat.mtime.getTime() - new Date().getTime();
379
+ fs.unlink(filename);
380
+ });
381
+ });
382
+ }
383
+
384
+ function version() {
385
+ console.log(meta.version);
386
+ process.exit(0);
387
+ }
388
+
389
+ function help() {
390
+ util.print([
391
+ '',
392
+ ' Usage: nodemon [options] [script.js] [args]',
393
+ '',
394
+ ' Options:',
395
+ '',
396
+ ' -d, --delay n throttle restart for "n" seconds',
397
+ ' -w, --watch dir watch directory "dir". use once for each',
398
+ ' directory to watch',
399
+ ' -x, --exec app execute script with "app", ie. -x "python -v"',
400
+ ' -I, --no-stdin don\'t try to read from stdin',
401
+ ' -q, --quiet minimise nodemon messages to start/stop only',
402
+ ' --exitcrash exit on crash, allows use of nodemon with',
403
+ ' daemon tools like forever.js',
404
+ ' -v, --version current nodemon version',
405
+ ' -h, --help you\'re looking at it',
406
+ '',
407
+ ' Note: if the script is omitted, nodemon will try to ',
408
+ ' read "main" from package.json and without a .nodemonignore,',
409
+ ' nodemon will monitor .js and .coffee by default.',
410
+ '',
411
+ ' Examples:',
412
+ '',
413
+ ' $ nodemon server.js',
414
+ ' $ nodemon -w ../foo server.js apparg1 apparg2',
415
+ ' $ PORT=8000 nodemon --debug-brk server.js',
416
+ ' $ nodemon --exec python app.py',
417
+ '',
418
+ ' For more details see http://github.com/remy/nodemon/',
419
+ ''
420
+ ].join('\n') + '\n');
421
+ process.exit(0);
422
+ }
423
+
424
+ // this little bit of hoop jumping is because sometimes the file can't be
425
+ // touched properly, and it send nodemon in to a loop of restarting.
426
+ // this way, the .monitor file is removed entirely, and recreated with
427
+ // permissions that anyone can remove it later (i.e. if you run as root
428
+ // by accident and then try again later).
429
+ // if (path.existsSync(flag)) fs.unlinkSync(flag);
430
+ // fs.writeFileSync(flag, '.'); // requires some content https://github.com/remy/nodemon/issues/36
431
+ // fs.chmodSync(flag, '666');
432
+
433
+ // remove the flag file on exit
434
+ process.on('exit', function (code) {
435
+ if (program.options.verbose) util.log('[nodemon] exiting');
436
+ cleanup();
437
+ });
438
+
439
+ if (!isWindows) { // because windows borks when listening for the SIG* events
440
+ // usual suspect: ctrl+c exit
441
+ process.on('SIGINT', function () {
442
+ child && child.kill('SIGINT');
443
+ cleanup();
444
+ process.exit(0);
445
+ });
446
+
447
+ process.on('SIGTERM', function () {
448
+ cleanup();
449
+ process.exit(0);
450
+ });
451
+ }
452
+
453
+ // TODO on a clean exit, we could continue to monitor the directory and reboot the service
454
+
455
+ // on exception *inside* nodemon, shutdown wrapped node app
456
+ process.on('uncaughtException', function (err) {
457
+ util.log('[nodemon] exception in nodemon killing node');
458
+ util.error(err.stack);
459
+ cleanup();
460
+ });
461
+
462
+
463
+ if (program.options.delay) {
464
+ restartDelay = program.options.delay * 1000;
465
+ }
466
+
467
+ // this is the default - why am I making it a cmd line opt?
468
+ if (program.options.js) {
469
+ addIgnoreRule('^((?!\.js|\.coffee$).)*$', true); // ignores everything except JS
470
+ }
471
+
472
+ if (program.options.watch && program.options.watch.length > 0) {
473
+ program.options.watch.forEach(function (dir) {
474
+ dirs.push(path.resolve(dir));
475
+ });
476
+ } else {
477
+ dirs.unshift(process.cwd());
478
+ }
479
+
480
+ if (!program.app) {
481
+ help();
482
+ }
483
+
484
+ if (program.options.verbose) util.log('[nodemon] v' + meta.version);
485
+
486
+ // this was causing problems for a lot of people, so now not moving to the subdirectory
487
+ // process.chdir(path.dirname(app));
488
+ dirs.forEach(function(dir) {
489
+ if (program.options.verbose) util.log('\x1B[32m[nodemon] watching: ' + dir + '\x1B[0m');
490
+ });
491
+
492
+ // findStatOffset();
493
+
494
+ startNode();
495
+
496
+ exists(ignoreFilePath, function (exist) {
497
+ // watch it: "exist" not to be confused with "exists"....
498
+ if (!exist) {
499
+ // try the old format
500
+ exists(oldIgnoreFilePath, function (exist) {
501
+ if (exist) {
502
+ if (program.options.verbose) util.log('[nodemon] detected old style .nodemonignore');
503
+ ignoreFilePath = oldIgnoreFilePath;
504
+ } else {
505
+ // don't create the ignorefile, just ignore the flag & JS
506
+ // addIgnoreRule(flag);
507
+ var ext = program.ext.replace(/\./g, '\\.');
508
+ if (ext) {
509
+ addIgnoreRule('^((?!' + ext + '$).)*$', true);
510
+ } else {
511
+ addIgnoreRule('^((?!\.js|\.coffee$).)*$', true); // ignores everything except JS
512
+ }
513
+ }
514
+ });
515
+ } else {
516
+ readIgnoreFile();
517
+ }
518
+ });