freezerwatch 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (314) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/CODE_OF_CONDUCT.md +13 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +21 -0
  6. data/README.md +40 -0
  7. data/Rakefile +1 -0
  8. data/bin/console +14 -0
  9. data/bin/freezerwatch +9 -0
  10. data/bin/setup +7 -0
  11. data/freezerwatch.gemspec +23 -0
  12. data/lib/freezerwatch.rb +5 -0
  13. data/lib/freezerwatch/version.rb +3 -0
  14. data/node_modules/.bin/freezerwatch +139 -0
  15. data/node_modules/freezerwatch/.npmignore +3 -0
  16. data/node_modules/freezerwatch/.ruby-version +1 -0
  17. data/node_modules/freezerwatch/Gemfile +4 -0
  18. data/node_modules/freezerwatch/Gemfile.lock +79 -0
  19. data/node_modules/freezerwatch/LICENSE +23 -0
  20. data/node_modules/freezerwatch/README.md +41 -0
  21. data/node_modules/freezerwatch/Rakefile +13 -0
  22. data/node_modules/freezerwatch/freezerwatch.js +139 -0
  23. data/node_modules/freezerwatch/metrics/bigfiles_high_water_mark +1 -0
  24. data/node_modules/freezerwatch/metrics/cane_high_water_mark +1 -0
  25. data/node_modules/freezerwatch/metrics/flay_high_water_mark +1 -0
  26. data/node_modules/freezerwatch/metrics/flog_high_water_mark +1 -0
  27. data/node_modules/freezerwatch/metrics/punchlist_high_water_mark +2 -0
  28. data/node_modules/freezerwatch/metrics/reek_high_water_mark +1 -0
  29. data/node_modules/freezerwatch/metrics/rubocop_high_water_mark +1 -0
  30. data/node_modules/freezerwatch/node_modules/async/.jshintrc +25 -0
  31. data/node_modules/freezerwatch/node_modules/async/.travis.yml +6 -0
  32. data/node_modules/freezerwatch/node_modules/async/CHANGELOG.md +65 -0
  33. data/node_modules/freezerwatch/node_modules/async/LICENSE +19 -0
  34. data/node_modules/freezerwatch/node_modules/async/README.md +1803 -0
  35. data/node_modules/freezerwatch/node_modules/async/bower.json +43 -0
  36. data/node_modules/freezerwatch/node_modules/async/component.json +17 -0
  37. data/node_modules/freezerwatch/node_modules/async/coverage/base.css +182 -0
  38. data/node_modules/freezerwatch/node_modules/async/coverage/index.html +73 -0
  39. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/base.css +182 -0
  40. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/index.html +73 -0
  41. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/async.js.html +3900 -0
  42. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/lib/index.html +73 -0
  43. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.css +1 -0
  44. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/prettify.js +1 -0
  45. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  46. data/node_modules/freezerwatch/node_modules/async/coverage/lcov-report/sorter.js +156 -0
  47. data/node_modules/freezerwatch/node_modules/async/coverage/lcov.info +1452 -0
  48. data/node_modules/freezerwatch/node_modules/async/coverage/lib/async.js.html +3597 -0
  49. data/node_modules/freezerwatch/node_modules/async/coverage/lib/index.html +73 -0
  50. data/node_modules/freezerwatch/node_modules/async/coverage/prettify.css +1 -0
  51. data/node_modules/freezerwatch/node_modules/async/coverage/prettify.js +1 -0
  52. data/node_modules/freezerwatch/node_modules/async/coverage/sort-arrow-sprite.png +0 -0
  53. data/node_modules/freezerwatch/node_modules/async/coverage/sorter.js +156 -0
  54. data/node_modules/freezerwatch/node_modules/async/lib/async.js +1191 -0
  55. data/node_modules/freezerwatch/node_modules/async/nyc_output/5074.json +1 -0
  56. data/node_modules/freezerwatch/node_modules/async/package.json +96 -0
  57. data/node_modules/freezerwatch/node_modules/async/support/sync-package-managers.js +53 -0
  58. data/node_modules/freezerwatch/node_modules/lacrosse/.npmignore +15 -0
  59. data/node_modules/freezerwatch/node_modules/lacrosse/Client.js +60 -0
  60. data/node_modules/freezerwatch/node_modules/lacrosse/Device.js +38 -0
  61. data/node_modules/freezerwatch/node_modules/lacrosse/DeviceRawReadStream.js +36 -0
  62. data/node_modules/freezerwatch/node_modules/lacrosse/DeviceSingleRawReadStream.js +29 -0
  63. data/node_modules/freezerwatch/node_modules/lacrosse/DeviceStream.js +35 -0
  64. data/node_modules/freezerwatch/node_modules/lacrosse/LICENSE +23 -0
  65. data/node_modules/freezerwatch/node_modules/lacrosse/README.md +25 -0
  66. data/node_modules/freezerwatch/node_modules/lacrosse/index.js +1 -0
  67. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.npmignore +2 -0
  68. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/.travis.yml +12 -0
  69. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/LICENSE +55 -0
  70. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/README.md +364 -0
  71. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/index.js +156 -0
  72. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/copy.js +8 -0
  73. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/debug.js +7 -0
  74. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/getSafe.js +34 -0
  75. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/lib/optional.js +5 -0
  76. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/.bin/uuid +26 -0
  77. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/LICENSE +55 -0
  78. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/README.md +4 -0
  79. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/index.js +202 -0
  80. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/aws-sign2/package.json +46 -0
  81. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/LICENSE +55 -0
  82. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/README.md +4 -0
  83. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/index.js +119 -0
  84. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/forever-agent/package.json +45 -0
  85. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/License +19 -0
  86. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/Readme.md +175 -0
  87. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/lib/form_data.js +351 -0
  88. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/.travis.yml +5 -0
  89. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/LICENSE +19 -0
  90. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/README.md +1647 -0
  91. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/bower.json +38 -0
  92. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/component.json +16 -0
  93. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js +1123 -0
  94. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/package.json +84 -0
  95. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/async/support/sync-package-managers.js +53 -0
  96. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/License +19 -0
  97. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/Readme.md +132 -0
  98. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/lib/combined_stream.js +188 -0
  99. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +2 -0
  100. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/License +19 -0
  101. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Makefile +7 -0
  102. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +154 -0
  103. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +99 -0
  104. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/package.json +42 -0
  105. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/common.js +6 -0
  106. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js +38 -0
  107. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-auto-pause.js +21 -0
  108. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream-pause.js +14 -0
  109. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-stream.js +48 -0
  110. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-handle-source-errors.js +15 -0
  111. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-max-data-size.js +18 -0
  112. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-pipe-resumes.js +13 -0
  113. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-proxy-readable.js +13 -0
  114. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/run.js +7 -0
  115. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/node_modules/combined-stream/package.json +60 -0
  116. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/form-data/package.json +80 -0
  117. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.npmignore +18 -0
  118. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/.travis.yml +5 -0
  119. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/LICENSE +24 -0
  120. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/Makefile +10 -0
  121. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/README.md +627 -0
  122. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/example/usage.js +78 -0
  123. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/hawk.png +0 -0
  124. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/images/logo.png +0 -0
  125. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/index.js +1 -0
  126. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/browser.js +485 -0
  127. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/client.js +367 -0
  128. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/crypto.js +111 -0
  129. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/index.js +15 -0
  130. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/server.js +524 -0
  131. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/lib/utils.js +183 -0
  132. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.npmignore +18 -0
  133. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml +5 -0
  134. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE +24 -0
  135. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/Makefile +11 -0
  136. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/README.md +6 -0
  137. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png +0 -0
  138. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/index.js +1 -0
  139. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js +207 -0
  140. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/package.json +64 -0
  141. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js +245 -0
  142. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.npmignore +18 -0
  143. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml +5 -0
  144. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE +24 -0
  145. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/Makefile +11 -0
  146. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md +6 -0
  147. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/index.js +1 -0
  148. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js +68 -0
  149. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json +65 -0
  150. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js +101 -0
  151. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.npmignore +18 -0
  152. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml +5 -0
  153. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE +33 -0
  154. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/Makefile +10 -0
  155. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/README.md +436 -0
  156. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png +0 -0
  157. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/index.js +1 -0
  158. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js +132 -0
  159. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js +585 -0
  160. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/package.json +70 -0
  161. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js +86 -0
  162. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js +1078 -0
  163. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js +1 -0
  164. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js +1 -0
  165. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js +1 -0
  166. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.npmignore +18 -0
  167. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml +5 -0
  168. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE +24 -0
  169. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile +11 -0
  170. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/README.md +68 -0
  171. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js +16 -0
  172. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js +25 -0
  173. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/index.js +1 -0
  174. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js +409 -0
  175. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/package.json +65 -0
  176. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js +359 -0
  177. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/package.json +70 -0
  178. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/browser.js +771 -0
  179. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/client.js +206 -0
  180. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/crypto.js +86 -0
  181. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/index.js +316 -0
  182. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/message.js +246 -0
  183. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/readme.js +98 -0
  184. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/server.js +686 -0
  185. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/uri.js +456 -0
  186. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/hawk/test/utils.js +120 -0
  187. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.dir-locals.el +6 -0
  188. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/.npmignore +7 -0
  189. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/LICENSE +18 -0
  190. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/README.md +79 -0
  191. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/http_signing.md +296 -0
  192. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/index.js +26 -0
  193. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/parser.js +304 -0
  194. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/signer.js +178 -0
  195. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/util.js +304 -0
  196. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/lib/verify.js +42 -0
  197. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/.npmignore +2 -0
  198. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/LICENSE +19 -0
  199. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/README.md +50 -0
  200. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/errors.js +13 -0
  201. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/index.js +27 -0
  202. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/reader.js +267 -0
  203. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/types.js +36 -0
  204. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/ber/writer.js +317 -0
  205. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/lib/index.js +20 -0
  206. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/package.json +63 -0
  207. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/reader.test.js +172 -0
  208. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/asn1/tst/ber/writer.test.js +296 -0
  209. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md +126 -0
  210. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js +245 -0
  211. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json +45 -0
  212. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/.npmignore +1 -0
  213. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/CHANGELOG +78 -0
  214. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/LICENSE +24 -0
  215. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README +82 -0
  216. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/README.old +298 -0
  217. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctf.js +245 -0
  218. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctio.js +1485 -0
  219. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/ctype.js +944 -0
  220. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/man/man3ctype/ctio.3ctype +241 -0
  221. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/package.json +42 -0
  222. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsl.conf +129 -0
  223. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/node_modules/ctype/tools/jsstyle +839 -0
  224. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/http-signature/package.json +72 -0
  225. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/.npmignore +1 -0
  226. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md +14 -0
  227. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/LICENSE +15 -0
  228. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/Makefile +35 -0
  229. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/README.md +52 -0
  230. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/package.json +68 -0
  231. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/stringify.js +27 -0
  232. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts +2 -0
  233. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js +246 -0
  234. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/LICENSE +19 -0
  235. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/README.md +66 -0
  236. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/mime.js +114 -0
  237. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/package.json +57 -0
  238. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/test.js +84 -0
  239. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/mime.types +1588 -0
  240. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/mime/types/node.types +77 -0
  241. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/.npmignore +2 -0
  242. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/LICENSE.md +21 -0
  243. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/README.md +243 -0
  244. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/README.md +53 -0
  245. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu +174 -0
  246. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/bench.sh +34 -0
  247. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c +34 -0
  248. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js +84 -0
  249. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bin/uuid +26 -0
  250. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/bower.json +23 -0
  251. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/component.json +18 -0
  252. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/package.json +65 -0
  253. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/compare_v1.js +63 -0
  254. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.html +17 -0
  255. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/test/test.js +228 -0
  256. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/node-uuid/uuid.js +247 -0
  257. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/LICENSE +55 -0
  258. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/README.md +4 -0
  259. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/index.js +43 -0
  260. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/package.json +48 -0
  261. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/oauth-sign/test.js +49 -0
  262. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.gitmodules +6 -0
  263. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/.npmignore +7 -0
  264. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/Readme.md +58 -0
  265. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/index.js +366 -0
  266. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/qs/package.json +55 -0
  267. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.jshintrc +72 -0
  268. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/.npmignore +3 -0
  269. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/LICENSE +78 -0
  270. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/README.md +380 -0
  271. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/generate-pubsuffix.js +230 -0
  272. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/cookie.js +947 -0
  273. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/memstore.js +102 -0
  274. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js +69 -0
  275. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/LICENSE-MIT.txt +20 -0
  276. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/README.md +176 -0
  277. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/package.json +81 -0
  278. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/node_modules/punycode/punycode.js +530 -0
  279. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/package.json +63 -0
  280. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/public-suffix.txt +5229 -0
  281. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tough-cookie/test.js +1340 -0
  282. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/LICENSE +55 -0
  283. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/README.md +4 -0
  284. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/index.js +227 -0
  285. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/node_modules/tunnel-agent/package.json +45 -0
  286. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/package.json +74 -0
  287. data/node_modules/freezerwatch/node_modules/lacrosse/node_modules/request/request.js +1244 -0
  288. data/node_modules/freezerwatch/node_modules/lacrosse/package.json +34 -0
  289. data/node_modules/freezerwatch/node_modules/optparse/README.md +163 -0
  290. data/node_modules/freezerwatch/node_modules/optparse/TODO +1 -0
  291. data/node_modules/freezerwatch/node_modules/optparse/examples/browser-test.html +75 -0
  292. data/node_modules/freezerwatch/node_modules/optparse/examples/nodejs-test.js +86 -0
  293. data/node_modules/freezerwatch/node_modules/optparse/lib/optparse.js +309 -0
  294. data/node_modules/freezerwatch/node_modules/optparse/package.json +46 -0
  295. data/node_modules/freezerwatch/node_modules/optparse/seed.yml +5 -0
  296. data/node_modules/freezerwatch/node_modules/osenv/.npmignore +13 -0
  297. data/node_modules/freezerwatch/node_modules/osenv/.travis.yml +9 -0
  298. data/node_modules/freezerwatch/node_modules/osenv/LICENSE +15 -0
  299. data/node_modules/freezerwatch/node_modules/osenv/README.md +63 -0
  300. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/index.js +24 -0
  301. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/license +21 -0
  302. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/package.json +70 -0
  303. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-homedir/readme.md +33 -0
  304. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/index.js +25 -0
  305. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/license +21 -0
  306. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/package.json +70 -0
  307. data/node_modules/freezerwatch/node_modules/osenv/node_modules/os-tmpdir/readme.md +36 -0
  308. data/node_modules/freezerwatch/node_modules/osenv/osenv.js +72 -0
  309. data/node_modules/freezerwatch/node_modules/osenv/package.json +76 -0
  310. data/node_modules/freezerwatch/node_modules/osenv/test/unix.js +71 -0
  311. data/node_modules/freezerwatch/node_modules/osenv/test/windows.js +74 -0
  312. data/node_modules/freezerwatch/node_modules/osenv/x.tap +39 -0
  313. data/node_modules/freezerwatch/package.json +37 -0
  314. metadata +384 -0
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "lacrosse",
3
+ "version": "0.1.1",
4
+ "description": "A streaming API for Lacrosse Alert sensors",
5
+ "main": "index.js",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/jed/node-lacrosse.git"
9
+ },
10
+ "keywords": [
11
+ "sensor",
12
+ "stream",
13
+ "temperature",
14
+ "humidity",
15
+ "lacrosse"
16
+ ],
17
+ "author": {
18
+ "name": "Jed Schmidt"
19
+ },
20
+ "license": "BSD-2-Clause",
21
+ "bugs": {
22
+ "url": "https://github.com/jed/node-lacrosse/issues"
23
+ },
24
+ "homepage": "https://github.com/jed/node-lacrosse",
25
+ "dependencies": {
26
+ "request": "~2.29.0"
27
+ },
28
+ "readme": "node-lacrosse\n=============\n\nA node.js streaming API for [Lacrosse Alert](http://www.lacrossetechnology.com/alerts/) sensors.\n\nUsage\n-----\n\n```javascript\nvar lacrosse = require(\"lacrosse\")\n\nvar client = new lacrosse.Client({\n username: \"MY USERNAME\",\n password: \"MY PASSWORD\"\n})\n\nclient.on(\"login\", function() {\n console.log(\"you have %s devices.\", client.devices.length)\n})\n\nvar device = new client.Device(\"MY DEVICE ID\")\nvar stream = device.createReadStream()\n\nstream.on(\"data\", console.log)\n```",
29
+ "readmeFilename": "README.md",
30
+ "_id": "lacrosse@0.1.1",
31
+ "_shasum": "9733d3de808e201391793c012862878fad8cf651",
32
+ "_resolved": "https://github.com/apiology/node-lacrosse/tarball/74770f3820c01868185a369540ac1483d0b8c8ea",
33
+ "_from": "https://github.com/apiology/node-lacrosse/tarball/74770f3820c01868185a369540ac1483d0b8c8ea"
34
+ }
@@ -0,0 +1,163 @@
1
+ optparse-js
2
+ ===========
3
+
4
+ Optparse-js is a command line option parser for Javascript. It's slightly based on Ruby's implementation optparse but with some differences (different languages has different needs) such as custom parsers.
5
+
6
+ All examples in this readme is using [Node.js](http://nodejs.org/). How ever, the library works with all kinds of Javascript implementations.
7
+
8
+
9
+ QUICK START
10
+ -----------
11
+
12
+ The library defines one class, the OptionParser class. The class constructor takes one single argument, a list with a set of rules. Here is a quick example:
13
+
14
+ // Import the sys library
15
+ var sys = require('sys');
16
+
17
+ // Import the optparse library.
18
+ var optparse = require('optparse');
19
+
20
+ // Define an option called ´´help´´. We give it a quick alias named ´´-h´´
21
+ // and a quick help text.
22
+ var switches = [
23
+ ['-h', '--help', 'Shows help sections']
24
+ ];
25
+
26
+ // Create a new OptionParser.
27
+ var parser = new optparse.OptionParser(switches);
28
+
29
+ // Hook the help option. The callback will be executed when the OptionParser
30
+ // hits the switch ´´-h´´ or ´´--help´´. Each representatio
31
+ parser.on('help', function() {
32
+ sys.puts('Help');
33
+ });
34
+
35
+
36
+
37
+ DEFINING RULES
38
+ --------------
39
+ The OptionParser constructor takes an Array with rules. Each rule is represented by an array (tuple) of two or three values. A typical rule definition may look like this:
40
+
41
+ ['-h', '--help', 'Print this help']
42
+
43
+
44
+ The first value is optional, and represents an alias for the long-named switch (the second value, in this case ´´--help´´).
45
+
46
+ The second argument is the actual rule. The rule must start with a double dash followed by a switch name (in this case ´help´). The OptionParser also supports special option arguments. Define an option argument in the rule by adding a named argument after the leading double dash and switch name (E.G '--port-number PORT_NUMBER'). The argument is then parsed to the option handler. To define an optional option argument, just add a braces around argument in the rule (E.G '--port-number [PORT_NUMBER]). The OptionParser also supports filter. More on that in in the section called ´Option Filters´.
47
+
48
+ The third argument is an optional rule description.
49
+
50
+
51
+ OPTION FILTERS
52
+ --------------
53
+ Filters is a neat feature that let you filter option arguments. The OptionParser itself as already a set of built-in common filter's. These are:
54
+
55
+ - NUMBER, supports both decimal and hexadecimal numbers.
56
+ - DATE, filters arguments that matches YYYY-MM-DD.
57
+ - EMAIL, filters arguments that matches my@email.com.
58
+
59
+ It's simple to use any of the filter above in your rule-set. Here is a quick example how to filter number:
60
+
61
+ var rules = [
62
+ ['--first-option NUMBER', 'Takes a number as argument'],
63
+ ['--second-option [NUMBER]', 'Takes an optional number as argument']
64
+ ]
65
+
66
+ You can add your own set of filter by calling the *parser_instance.filter* method:
67
+
68
+ parser.filter('single_char', function(value) {
69
+ if(value.length != 1) throw "Filter mismatch.";
70
+ return value;
71
+ });
72
+
73
+
74
+ OPTION PARSER
75
+ -------------
76
+ The OptionParser class has the following properties and methods:
77
+
78
+ ### string banner
79
+ An optional usage banner. This text is included when calling ´´toString´´. Default value is: "Usage: [Options]".
80
+
81
+
82
+ ### string options_title
83
+ An optional title for the options list. This text is included when calling ´´toString´´. Default value is: "Available options:".
84
+
85
+
86
+ ### function on(switch_or_arg_index, callback)
87
+ Add's a callback for a switch or an argument (defined by index). Switch hooks MUST be typed witout the leading ´´--´´. This example show how to hook a switch:
88
+
89
+ parser.on('help', function(optional_argument) {
90
+ // Show help section
91
+ });
92
+
93
+ And this example show how to hook a positional argument (an option without the leading - or --).
94
+ Note that positional argument 0 will be "node" and positional argument 1 will be the path of the
95
+ script being run. Positional argument 2 will be the first positional argument after the script path:
96
+
97
+ parser.on(2, function(opt) {
98
+ puts('The first non-switch option is:' + opt);
99
+ });
100
+
101
+ It's also possible to define a default handler. The default handler is called when no rule's are meet. Here is an example how to add a ´default handler´:
102
+
103
+ parser.on(function(opt) {
104
+ puts('No handler was defined for option:' + opt);
105
+ });
106
+
107
+ Use the wildcard handler to build a custom ´´on´´ handler.
108
+
109
+ parser.on('*', function(opt, value) {
110
+ puts('option=' + opt + ', value=' + value);
111
+ });
112
+
113
+ ### function filter(name, callback)
114
+ Adds a new filter extension to the OptionParser instance. The first argument is the name of the filter (trigger). The second argument is the actual filter See the ´OPTION FILTERS´ section for more info.
115
+
116
+ It's possible to override the default filters by passing the value "_DEFAULT" to the ´´name´´ argument. The name of the filter is automatically transformed into
117
+ upper case.
118
+
119
+
120
+ ### function halt([callback])
121
+ Interrupt's further parsing. This function should be called from an ´on´ -callbacks, to cancel the parsing. This can be useful when the program should ignore all other arguments (when displaying help or version information).
122
+
123
+ The function also takes an optional callback argument. If the callback argument is specified, a ´halt´ callback will be added (instead of executing the ´halt´ command).
124
+
125
+ Here is an example how to add an ´on_halt´ callback:
126
+
127
+ parser.halt(function() {
128
+ puts('An option callback interupted the parser');
129
+ });
130
+
131
+
132
+ ### function parse(arguments)
133
+ Start's parsing of arguments. This should be the last thing you do.
134
+
135
+
136
+ ### function options()
137
+ Returns an Array with all defined option rules
138
+
139
+
140
+ ### function toString()
141
+ Returns a string representation of this OptionParser instance (a formatted help section).
142
+
143
+
144
+ MORE EXAMPLES
145
+ -------------
146
+ See examples/nodejs-test.js and examples/browser-test-html for more info how to
147
+ use the script.
148
+
149
+
150
+ SUGGESTIONS
151
+ -----------
152
+ All comments in how to improve this library is very welcome. Feel free post suggestions to the [Issue tracker](http://github.com/jfd/optparse-js/issues), or even better, fork the repository to implement your own features.
153
+
154
+
155
+ LICENSE
156
+ -------
157
+ Released under a MIT-style license.
158
+
159
+
160
+ COPYRIGHT
161
+ ---------
162
+ Copyright (c) 2009 Johan Dahlberg
163
+
@@ -0,0 +1 @@
1
+ - Support for Argument lists (for switches)
@@ -0,0 +1,75 @@
1
+ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2
+ "http://www.w3.org/TR/html4/strict.dtd">
3
+ <html>
4
+ <head>
5
+ <meta http-equiv="Content-type" content="text/html; charset=utf-8">
6
+ <title>optparse.js example</title>
7
+ <script type="text/javascript" charset="utf-8" src="../lib/optparse.js"></script>
8
+ <script>
9
+ // Arguments to be passed to the parser
10
+ var ARGS = ['-p', 'This is a message', '-i', 'test.html', '--debug'];
11
+
12
+ // Define some options
13
+ var SWITCHES = [
14
+ ['-i', '--include-file FILE', "Includes a file"],
15
+ ['-p', '--print [MESSAGE]', "Prints a message on screen"],
16
+ ['-d', '--debug', "Enables debug mode"],
17
+ ];
18
+
19
+ function puts(msg) {
20
+ var body = document.getElementById('body');
21
+ var pre = document.createElement('pre');
22
+ pre.innerHTML = msg;
23
+ body.appendChild(pre);
24
+ }
25
+
26
+ function onLoad() {
27
+ puts("optparse.js");
28
+
29
+ // Create a new OptionParser with defined switches
30
+ var parser = new optparse.OptionParser(SWITCHES);
31
+
32
+ // Internal variable to store options.
33
+ var options = {
34
+ debug: false,
35
+ files: []
36
+ };
37
+
38
+ // Handle the first argument (switches excluded)
39
+ parser.on(0, function(value) {
40
+ puts("First non-switch argument is: " + value);
41
+ });
42
+
43
+ // Handle the --include-file switch
44
+ parser.on('include-file', function(value) {
45
+ options.files.push(value);
46
+ });
47
+
48
+ // Handle the --print switch
49
+ parser.on('print', function(value) {
50
+ puts('PRINT: ' + value);
51
+ });
52
+
53
+ // Handle the --debug switch
54
+ parser.on('debug', function() {
55
+ options.debug = true;
56
+ });
57
+
58
+ // Parse command line arguments
59
+ parser.parse(ARGS);
60
+
61
+ // Output all files that was included.
62
+ puts("No of files to include: " + options.files.length);
63
+ for(var i = 0; i < options.files.length; i++) {
64
+ puts("File [" + (i + 1) + "]:" + options.files[i]);
65
+ }
66
+
67
+ // Is debug-mode enabled?
68
+ puts("Debug mode is set to: " + options.debug);
69
+ }
70
+ </script>
71
+ </head>
72
+ <body id="body" onload="onLoad()">
73
+
74
+ </body>
75
+ </html>
@@ -0,0 +1,86 @@
1
+ // Import the optparse script
2
+ var optparse = require('../lib/optparse');
3
+
4
+ // Define some options
5
+ var SWITCHES = [
6
+ ['-i', '--include-file FILE', "Includes a file"],
7
+ ['-p', '--print [MESSAGE]', "Prints an optional message on screen"],
8
+ ['-d', '--debug', "Enables debug mode"],
9
+ ['-H', '--help', "Shows this help section"],
10
+ ['--date DATE', "A date. A date is expected E.G. 2009-01-14"],
11
+ ['--number NUMBER', "A Number. Supported formats are 123, 123.123, 0xA123"],
12
+ ['--other NAME', "No handler defined for this option. Will be handled by the wildcard handler."],
13
+ ];
14
+
15
+ // Create a new OptionParser with defined switches
16
+ var parser = new optparse.OptionParser(SWITCHES), print_summary = true,
17
+ first_arg;
18
+ parser.banner = 'Usage: nodejs-test.js [options]';
19
+
20
+ // Internal variable to store options.
21
+ var options = {
22
+ debug: true,
23
+ files: [],
24
+ number: undefined,
25
+ date: undefined
26
+ };
27
+
28
+ // Handle the first argument (switches excluded)
29
+ parser.on(0, function(value) {
30
+ first_arg = value;
31
+ });
32
+
33
+ // Handle the --include-file switch
34
+ parser.on('include-file', function(name, value) {
35
+ options.files.push(value);
36
+ });
37
+
38
+ // Handle the --print switch
39
+ parser.on('print', function(name, value) {
40
+ console.log('PRINT: ' + (value || 'No message entered'));
41
+ });
42
+
43
+ // Handle the --date switch
44
+ parser.on('date', function(name, value) {
45
+ options.date = value;
46
+ });
47
+
48
+ // Handle the --number switch
49
+ parser.on('number', function(name, value) {
50
+ options.number = value;
51
+ });
52
+
53
+ // Handle the --debug switch
54
+ parser.on('debug', function() {
55
+ options.debug = true;
56
+ });
57
+
58
+ // Handle the --help switch
59
+ parser.on('help', function() {
60
+ console.log(parser.toString());
61
+ print_summary = false;
62
+ });
63
+
64
+ // Set a default handler
65
+ parser.on('*', function(opt, value) {
66
+ console.log('wild handler for ' + opt + ', value=' + value);
67
+ });
68
+
69
+ // Parse command line arguments
70
+ parser.parse(process.ARGV);
71
+
72
+ if(print_summary) {
73
+ console.log("First non-switch argument is: " + first_arg);
74
+
75
+ // Output all files that was included.
76
+ console.log("No of files to include: " + options.files.length);
77
+ for(var i = 0; i < options.files.length; i++) {
78
+ console.log("File [" + (i + 1) + "]:" + options.files[i]);
79
+ }
80
+
81
+ // Is debug-mode enabled?
82
+ console.log("Debug mode is set to: " + options.debug);
83
+
84
+ console.log("Number value is: " + options.number);
85
+ console.log("Date value is: " + options.date);
86
+ }
@@ -0,0 +1,309 @@
1
+ // Optparse.js 1.0.3 - Option Parser for Javascript
2
+ //
3
+ // Copyright (c) 2009 Johan Dahlberg
4
+ //
5
+ // See README.md for license.
6
+ //
7
+ var optparse = {};
8
+ try{ optparse = exports } catch(e) {}; // Try to export the lib for node.js
9
+ (function(self) {
10
+ var VERSION = '1.0.3';
11
+ var LONG_SWITCH_RE = /^--\w/;
12
+ var SHORT_SWITCH_RE = /^-\w/;
13
+ var NUMBER_RE = /^(0x[A-Fa-f0-9]+)|([0-9]+\.[0-9]+)|(\d+)$/;
14
+ var DATE_RE = /^\d{4}-(0[0-9]|1[0,1,2])-([0,1,2][0-9]|3[0,1])$/;
15
+ var EMAIL_RE = /^([0-9a-zA-Z]+([_.-]?[0-9a-zA-Z]+)*@[0-9a-zA-Z]+[0-9,a-z,A-Z,.,-]*(.){1}[a-zA-Z]{2,4})+$/;
16
+ var EXT_RULE_RE = /(\-\-[\w_-]+)\s+([\w\[\]_-]+)|(\-\-[\w_-]+)/;
17
+ var ARG_OPTIONAL_RE = /\[(.+)\]/;
18
+
19
+ // The default switch argument filter to use, when argument name doesnt match
20
+ // any other names.
21
+ var DEFAULT_FILTER = '_DEFAULT';
22
+ var PREDEFINED_FILTERS = {};
23
+
24
+ // The default switch argument filter. Parses the argument as text.
25
+ function filter_text(value) {
26
+ return value;
27
+ }
28
+
29
+ // Switch argument filter that expects an integer, HEX or a decimal value. An
30
+ // exception is throwed if the criteria is not matched.
31
+ // Valid input formats are: 0xFFFFFFF, 12345 and 1234.1234
32
+ function filter_number(value) {
33
+ var m = NUMBER_RE.exec(value);
34
+ if(m == null) throw OptError('Expected a number representative');
35
+ if(m[1]) {
36
+ // The number is in HEX format. Convert into a number, then return it
37
+ return parseInt(m[1], 16);
38
+ } else {
39
+ // The number is in regular- or decimal form. Just run in through
40
+ // the float caster.
41
+ return parseFloat(m[2] || m[3]);
42
+ }
43
+ };
44
+
45
+ // Switch argument filter that expects a Date expression. The date string MUST be
46
+ // formated as: "yyyy-mm-dd" An exception is throwed if the criteria is not
47
+ // matched. An DATE object is returned on success.
48
+ function filter_date(value) {
49
+ var m = DATE_RE.exec(value);
50
+ if(m == null) throw OptError('Expected a date representation in the "yyyy-mm-dd" format.');
51
+ return new Date(parseInt(m[0]), parseInt(m[1]) - 1, parseInt(m[2]));
52
+ };
53
+
54
+ // Switch argument filter that expects an email address. An exception is throwed
55
+ // if the criteria doesn`t match.
56
+ function filter_email(value) {
57
+ var m = EMAIL_RE.exec(value);
58
+ if(m == null) throw OptError('Excpeted an email address.');
59
+ return m[1];
60
+ }
61
+
62
+ // Register all predefined filters. This dict is used by each OptionParser
63
+ // instance, when parsing arguments. Custom filters can be added to the parser
64
+ // instance by calling the "add_filter" -method.
65
+ PREDEFINED_FILTERS[DEFAULT_FILTER] = filter_text;
66
+ PREDEFINED_FILTERS['TEXT'] = filter_text;
67
+ PREDEFINED_FILTERS['NUMBER'] = filter_number;
68
+ PREDEFINED_FILTERS['DATE'] = filter_date;
69
+ PREDEFINED_FILTERS['EMAIL'] = filter_email;
70
+
71
+ // Buildes rules from a switches collection. The switches collection is defined
72
+ // when constructing a new OptionParser object.
73
+ function build_rules(filters, arr) {
74
+ var rules = [];
75
+ for(var i=0; i<arr.length; i++) {
76
+ var r = arr[i], rule
77
+ if(!contains_expr(r)) throw OptError('Rule MUST contain an option.');
78
+ switch(r.length) {
79
+ case 1:
80
+ rule = build_rule(filters, r[0]);
81
+ break;
82
+ case 2:
83
+ var expr = LONG_SWITCH_RE.test(r[0]) ? 0 : 1;
84
+ var alias = expr == 0 ? -1 : 0;
85
+ var desc = alias == -1 ? 1 : -1;
86
+ rule = build_rule(filters, r[alias], r[expr], r[desc]);
87
+ break;
88
+ case 3:
89
+ rule = build_rule(filters, r[0], r[1], r[2]);
90
+ break;
91
+ default:
92
+ case 0:
93
+ continue;
94
+ }
95
+ rules.push(rule)
96
+ }
97
+ return rules;
98
+ }
99
+
100
+ // Builds a rule with specified expression, short style switch and help. This
101
+ // function expects a dict with filters to work correctly.
102
+ //
103
+ // Return format:
104
+ // name The name of the switch.
105
+ // short The short style switch
106
+ // long The long style switch
107
+ // decl The declaration expression (the input expression)
108
+ // desc The optional help section for the switch
109
+ // optional_arg Indicates that switch argument is optional
110
+ // filter The filter to use when parsing the arg. An
111
+ // <<undefined>> value means that the switch does
112
+ // not take anargument.
113
+ function build_rule(filters, short, expr, desc) {
114
+ var optional, filter;
115
+ var m = expr.match(EXT_RULE_RE);
116
+ if(m == null) throw OptError('The switch is not well-formed.');
117
+ var long = m[1] || m[3];
118
+ if(m[2] != undefined) {
119
+ // A switch argument is expected. Check if the argument is optional,
120
+ // then find a filter that suites.
121
+ var optional = ARG_OPTIONAL_RE.test(m[2]);
122
+ var optional_match = m[2].match(ARG_OPTIONAL_RE);
123
+ var filter_name = optional ? optional_match[1] : m[2];
124
+ filter = filters[filter_name];
125
+ if(filter === undefined) filter = filters[DEFAULT_FILTER];
126
+ }
127
+ return {
128
+ name: long.substr(2),
129
+ short: short,
130
+ long: long,
131
+ decl: expr,
132
+ desc: desc,
133
+ optional_arg: optional,
134
+ filter: filter
135
+ }
136
+ }
137
+
138
+ // Loop's trough all elements of an array and check if there is valid
139
+ // options expression within. An valid option is a token that starts
140
+ // double dashes. E.G. --my_option
141
+ function contains_expr(arr) {
142
+ if(!arr || !arr.length) return false;
143
+ var l = arr.length;
144
+ while(l-- > 0) if(LONG_SWITCH_RE.test(arr[l])) return true;
145
+ return false;
146
+ }
147
+
148
+ // Extends destination object with members of source object
149
+ function extend(dest, src) {
150
+ var result = dest;
151
+ for(var n in src) {
152
+ result[n] = src[n];
153
+ }
154
+ return result;
155
+ }
156
+
157
+ // Appends spaces to match specified number of chars
158
+ function spaces(arg1, arg2) {
159
+ var l, builder = [];
160
+ if(arg1.constructor === Number) {
161
+ l = arg1;
162
+ } else {
163
+ if(arg1.length == arg2) return arg1;
164
+ l = arg2 - arg1.length;
165
+ builder.push(arg1);
166
+ }
167
+ while(l-- > 0) builder.push(' ');
168
+ return builder.join('');
169
+ }
170
+
171
+ // Create a new Parser object that can be used to parse command line arguments.
172
+ //
173
+ //
174
+ function Parser(rules) {
175
+ return new OptionParser(rules);
176
+ }
177
+
178
+ // Creates an error object with specified error message.
179
+ function OptError(msg) {
180
+ return new function() {
181
+ this.msg = msg;
182
+ this.toString = function() {
183
+ return this.msg;
184
+ }
185
+ }
186
+ }
187
+
188
+ function OptionParser(rules) {
189
+ this.banner = 'Usage: [Options]';
190
+ this.options_title = 'Available options:'
191
+ this._rules = rules;
192
+ this._halt = false;
193
+ this.filters = extend({}, PREDEFINED_FILTERS);
194
+ this.on_args = {};
195
+ this.on_switches = {};
196
+ this.on_halt = function() {};
197
+ this.default_handler = function() {};
198
+ }
199
+
200
+ OptionParser.prototype = {
201
+
202
+ // Adds args and switchs handler.
203
+ on: function(value, fn) {
204
+ if(value.constructor === Function ) {
205
+ this.default_handler = value;
206
+ } else if(value.constructor === Number) {
207
+ this.on_args[value] = fn;
208
+ } else {
209
+ this.on_switches[value] = fn;
210
+ }
211
+ },
212
+
213
+ // Adds a custom filter to the parser. It's possible to override the
214
+ // default filter by passing the value "_DEFAULT" to the ´´name´´
215
+ // argument. The name of the filter is automatically transformed into
216
+ // upper case.
217
+ filter: function(name, fn) {
218
+ this.filters[name.toUpperCase()] = fn;
219
+ },
220
+
221
+ // Parses specified args. Returns remaining arguments.
222
+ parse: function(args) {
223
+ var result = [], callback;
224
+ var rules = build_rules(this.filters, this._rules);
225
+ var tokens = args.concat([]);
226
+ var token;
227
+ while(this._halt == false && (token = tokens.shift())) {
228
+ if(LONG_SWITCH_RE.test(token) || SHORT_SWITCH_RE.test(token)) {
229
+ var arg = undefined;
230
+ // The token is a long or a short switch. Get the corresponding
231
+ // rule, filter and handle it. Pass the switch to the default
232
+ // handler if no rule matched.
233
+ for(var i = 0; i < rules.length; i++) {
234
+ var rule = rules[i];
235
+ if(rule.long == token || rule.short == token) {
236
+ if(rule.filter !== undefined) {
237
+ arg = tokens.shift();
238
+ if(!LONG_SWITCH_RE.test(arg) && !SHORT_SWITCH_RE.test(arg)) {
239
+ try {
240
+ arg = rule.filter(arg);
241
+ } catch(e) {
242
+ throw OptError(token + ': ' + e.toString());
243
+ }
244
+ } else if(rule.optional_arg) {
245
+ tokens.unshift(arg);
246
+ } else {
247
+ throw OptError('Expected switch argument.');
248
+ }
249
+ }
250
+ callback = this.on_switches[rule.name];
251
+ if (!callback) callback = this.on_switches['*'];
252
+ if(callback) callback.apply(this, [rule.name, arg]);
253
+ break;
254
+ }
255
+ }
256
+ if(i == rules.length) this.default_handler.apply(this, [token]);
257
+ } else {
258
+ // Did not match long or short switch. Parse the token as a
259
+ // normal argument.
260
+ callback = this.on_args[result.length];
261
+ result.push(token);
262
+ if(callback) callback.apply(this, [token]);
263
+ }
264
+ }
265
+ return this._halt ? this.on_halt.apply(this, [tokens]) : result;
266
+ },
267
+
268
+ // Returns an Array with all defined option rules
269
+ options: function() {
270
+ return build_rules(this.filters, this._rules);
271
+ },
272
+
273
+ // Add an on_halt callback if argument ´´fn´´ is specified. on_switch handlers can
274
+ // call instance.halt to abort the argument parsing. This can be useful when
275
+ // displaying help or version information.
276
+ halt: function(fn) {
277
+ this._halt = fn === undefined
278
+ if(fn) this.on_halt = fn;
279
+ },
280
+
281
+ // Returns a string representation of this OptionParser instance.
282
+ toString: function() {
283
+ var builder = [this.banner, '', this.options_title],
284
+ shorts = false, longest = 0, rule;
285
+ var rules = build_rules(this.filters, this._rules);
286
+ for(var i = 0; i < rules.length; i++) {
287
+ rule = rules[i];
288
+ // Quick-analyze the options.
289
+ if(rule.short) shorts = true;
290
+ if(rule.decl.length > longest) longest = rule.decl.length;
291
+ }
292
+ for(var i = 0; i < rules.length; i++) {
293
+ var text = spaces(6);
294
+ rule = rules[i];
295
+ if(shorts) {
296
+ if(rule.short) text = spaces(2) + rule.short + ', ';
297
+ }
298
+ text += spaces(rule.decl, longest) + spaces(3);
299
+ text += rule.desc;
300
+ builder.push(text);
301
+ }
302
+ return builder.join('\n');
303
+ }
304
+ }
305
+
306
+ self.VERSION = VERSION;
307
+ self.OptionParser = OptionParser;
308
+
309
+ })(optparse);