opal 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -1
  3. data/lib/opal/cli.rb +9 -1
  4. data/lib/opal/cli_options.rb +12 -3
  5. data/lib/opal/cli_runners/nodejs.rb +3 -2
  6. data/lib/opal/version.rb +1 -1
  7. data/opal/corelib/kernel.rb +7 -0
  8. data/opal/corelib/runtime.js +4 -0
  9. data/spec/lib/cli_spec.rb +16 -0
  10. data/stdlib/nodejs.rb +1 -2
  11. data/stdlib/nodejs/{process.rb → kernel.rb} +7 -4
  12. data/stdlib/nodejs/node_modules/.bin/js-yaml +140 -0
  13. data/stdlib/nodejs/node_modules/glob/LICENSE +15 -0
  14. data/stdlib/nodejs/node_modules/glob/README.md +357 -0
  15. data/stdlib/nodejs/node_modules/glob/common.js +177 -0
  16. data/stdlib/nodejs/node_modules/glob/glob.js +649 -0
  17. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/.eslintrc +17 -0
  18. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/LICENSE +15 -0
  19. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/README.md +37 -0
  20. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/inflight.js +44 -0
  21. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/LICENSE +15 -0
  22. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/README.md +36 -0
  23. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/package.json +52 -0
  24. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/test/basic.js +51 -0
  25. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/node_modules/wrappy/wrappy.js +33 -0
  26. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/package.json +61 -0
  27. data/stdlib/nodejs/node_modules/glob/node_modules/inflight/test.js +97 -0
  28. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/LICENSE +16 -0
  29. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/README.md +42 -0
  30. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/inherits.js +1 -0
  31. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/inherits_browser.js +23 -0
  32. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/package.json +51 -0
  33. data/stdlib/nodejs/node_modules/glob/node_modules/inherits/test.js +25 -0
  34. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/.npmignore +1 -0
  35. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/.travis.yml +4 -0
  36. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/LICENSE +23 -0
  37. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/README.md +216 -0
  38. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/benchmark.js +15 -0
  39. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/browser.js +1181 -0
  40. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/minimatch.js +845 -0
  41. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.npmignore +2 -0
  42. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/.travis.yml +3 -0
  43. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/README.md +121 -0
  44. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/example.js +8 -0
  45. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/index.js +191 -0
  46. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.npmignore +2 -0
  47. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/.travis.yml +4 -0
  48. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/Makefile +6 -0
  49. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/README.md +80 -0
  50. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/example.js +5 -0
  51. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/index.js +38 -0
  52. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/package.json +73 -0
  53. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match/test/balanced.js +56 -0
  54. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/.travis.yml +4 -0
  55. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/LICENSE +18 -0
  56. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/README.markdown +62 -0
  57. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/example/map.js +6 -0
  58. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/index.js +13 -0
  59. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json +83 -0
  60. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map/test/map.js +39 -0
  61. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/package.json +75 -0
  62. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-comparison.js +32 -0
  63. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/bash-results.txt +1075 -0
  64. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/cases.txt +182 -0
  65. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/dollar.js +9 -0
  66. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/empty-option.js +10 -0
  67. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/generate.sh +24 -0
  68. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/negative-increment.js +15 -0
  69. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/nested.js +16 -0
  70. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/order.js +10 -0
  71. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/pad.js +13 -0
  72. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/same-type.js +7 -0
  73. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/test/sequence.js +50 -0
  74. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/package.json +60 -0
  75. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/basic.js +399 -0
  76. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/brace-expand.js +45 -0
  77. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/defaults.js +274 -0
  78. data/stdlib/nodejs/node_modules/glob/node_modules/minimatch/test/extglob-ending-with-state-char.js +8 -0
  79. data/stdlib/nodejs/node_modules/glob/node_modules/once/LICENSE +27 -0
  80. data/stdlib/nodejs/node_modules/glob/node_modules/once/README.md +51 -0
  81. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/LICENSE +15 -0
  82. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/README.md +36 -0
  83. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/package.json +52 -0
  84. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/test/basic.js +51 -0
  85. data/stdlib/nodejs/node_modules/glob/node_modules/once/node_modules/wrappy/wrappy.js +33 -0
  86. data/stdlib/nodejs/node_modules/glob/node_modules/once/once.js +21 -0
  87. data/stdlib/nodejs/node_modules/glob/node_modules/once/package.json +60 -0
  88. data/stdlib/nodejs/node_modules/glob/node_modules/once/test/once.js +23 -0
  89. data/stdlib/nodejs/node_modules/glob/package.json +72 -0
  90. data/stdlib/nodejs/node_modules/glob/sync.js +409 -0
  91. data/stdlib/nodejs/node_modules/js-yaml/HISTORY.md +277 -0
  92. data/stdlib/nodejs/node_modules/js-yaml/LICENSE +21 -0
  93. data/stdlib/nodejs/node_modules/js-yaml/README.md +288 -0
  94. data/stdlib/nodejs/node_modules/js-yaml/bin/js-yaml.js +140 -0
  95. data/stdlib/nodejs/node_modules/js-yaml/bower.json +23 -0
  96. data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.js +3666 -0
  97. data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.min.js +3 -0
  98. data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.js +102 -0
  99. data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.yml +18 -0
  100. data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.js +31 -0
  101. data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.json +22 -0
  102. data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.js +18 -0
  103. data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.yml +197 -0
  104. data/stdlib/nodejs/node_modules/js-yaml/index.js +7 -0
  105. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml.js +39 -0
  106. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/common.js +62 -0
  107. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/dumper.js +554 -0
  108. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/exception.js +25 -0
  109. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/loader.js +1581 -0
  110. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/mark.js +78 -0
  111. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema.js +103 -0
  112. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/core.js +18 -0
  113. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +25 -0
  114. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +28 -0
  115. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +17 -0
  116. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/json.js +25 -0
  117. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type.js +61 -0
  118. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/binary.js +133 -0
  119. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/bool.js +37 -0
  120. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/float.js +110 -0
  121. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/int.js +183 -0
  122. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/function.js +85 -0
  123. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +84 -0
  124. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +27 -0
  125. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/map.js +8 -0
  126. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/merge.js +12 -0
  127. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/null.js +36 -0
  128. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/omap.js +56 -0
  129. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/pairs.js +61 -0
  130. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/seq.js +8 -0
  131. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/set.js +33 -0
  132. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/str.js +8 -0
  133. data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +98 -0
  134. data/stdlib/nodejs/node_modules/js-yaml/node_modules/.bin/esparse +117 -0
  135. data/stdlib/nodejs/node_modules/js-yaml/node_modules/.bin/esvalidate +177 -0
  136. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/HISTORY.md +115 -0
  137. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/LICENSE +21 -0
  138. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +239 -0
  139. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/arguments.js +36 -0
  140. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/choice.js +22 -0
  141. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/constants.js +59 -0
  142. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/help.js +13 -0
  143. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/nargs.js +33 -0
  144. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js +28 -0
  145. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js +23 -0
  146. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js +49 -0
  147. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sum.js +35 -0
  148. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js +270 -0
  149. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/index.js +1 -0
  150. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action.js +146 -0
  151. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append.js +55 -0
  152. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js +47 -0
  153. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/count.js +40 -0
  154. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/help.js +48 -0
  155. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store.js +50 -0
  156. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js +43 -0
  157. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js +27 -0
  158. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js +26 -0
  159. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js +148 -0
  160. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/version.js +50 -0
  161. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action_container.js +481 -0
  162. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argparse.js +14 -0
  163. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js +50 -0
  164. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js +54 -0
  165. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js +75 -0
  166. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js +1168 -0
  167. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/const.js +18 -0
  168. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js +88 -0
  169. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js +798 -0
  170. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/namespace.js +77 -0
  171. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.npmignore +2 -0
  172. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml +8 -0
  173. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown +825 -0
  174. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/bower.json +33 -0
  175. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/component.json +11 -0
  176. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/foo.js +10 -0
  177. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/gulpfile.js +26 -0
  178. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js +673 -0
  179. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log +0 -0
  180. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json +107 -0
  181. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE +23 -0
  182. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md +22 -0
  183. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json +69 -0
  184. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js +6 -0
  185. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js +1415 -0
  186. data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/package.json +62 -0
  187. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/README.md +73 -0
  188. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esparse.js +117 -0
  189. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js +177 -0
  190. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/esprima.js +3908 -0
  191. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/package.json +69 -0
  192. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/compat.js +239 -0
  193. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/reflect.js +422 -0
  194. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/run.js +66 -0
  195. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/runner.js +387 -0
  196. data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/test.js +20238 -0
  197. data/stdlib/nodejs/node_modules/js-yaml/package.json +83 -0
  198. data/{package.json → stdlib/nodejs/package.json} +0 -3
  199. data/stdlib/phantomjs.rb +1 -6
  200. data/tasks/testing.rake +1 -4
  201. metadata +191 -6
  202. data/stdlib/nodejs/runtime.rb +0 -26
@@ -0,0 +1,177 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright
9
+ notice, this list of conditions and the following disclaimer.
10
+ * Redistributions in binary form must reproduce the above copyright
11
+ notice, this list of conditions and the following disclaimer in the
12
+ documentation and/or other materials provided with the distribution.
13
+
14
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
18
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23
+ THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
+ */
25
+
26
+ /*jslint sloppy:true plusplus:true node:true rhino:true */
27
+
28
+ var fs, esprima, options, fnames, count;
29
+
30
+ if (typeof require === 'function') {
31
+ fs = require('fs');
32
+ esprima = require('esprima');
33
+ } else if (typeof load === 'function') {
34
+ try {
35
+ load('esprima.js');
36
+ } catch (e) {
37
+ load('../esprima.js');
38
+ }
39
+ }
40
+
41
+ // Shims to Node.js objects when running under Rhino.
42
+ if (typeof console === 'undefined' && typeof process === 'undefined') {
43
+ console = { log: print };
44
+ fs = { readFileSync: readFile };
45
+ process = { argv: arguments, exit: quit };
46
+ process.argv.unshift('esvalidate.js');
47
+ process.argv.unshift('rhino');
48
+ }
49
+
50
+ function showUsage() {
51
+ console.log('Usage:');
52
+ console.log(' esvalidate [options] file.js');
53
+ console.log();
54
+ console.log('Available options:');
55
+ console.log();
56
+ console.log(' --format=type Set the report format, plain (default) or junit');
57
+ console.log(' -v, --version Print program version');
58
+ console.log();
59
+ process.exit(1);
60
+ }
61
+
62
+ if (process.argv.length <= 2) {
63
+ showUsage();
64
+ }
65
+
66
+ options = {
67
+ format: 'plain'
68
+ };
69
+
70
+ fnames = [];
71
+
72
+ process.argv.splice(2).forEach(function (entry) {
73
+
74
+ if (entry === '-h' || entry === '--help') {
75
+ showUsage();
76
+ } else if (entry === '-v' || entry === '--version') {
77
+ console.log('ECMAScript Validator (using Esprima version', esprima.version, ')');
78
+ console.log();
79
+ process.exit(0);
80
+ } else if (entry.slice(0, 9) === '--format=') {
81
+ options.format = entry.slice(9);
82
+ if (options.format !== 'plain' && options.format !== 'junit') {
83
+ console.log('Error: unknown report format ' + options.format + '.');
84
+ process.exit(1);
85
+ }
86
+ } else if (entry.slice(0, 2) === '--') {
87
+ console.log('Error: unknown option ' + entry + '.');
88
+ process.exit(1);
89
+ } else {
90
+ fnames.push(entry);
91
+ }
92
+ });
93
+
94
+ if (fnames.length === 0) {
95
+ console.log('Error: no input file.');
96
+ process.exit(1);
97
+ }
98
+
99
+ if (options.format === 'junit') {
100
+ console.log('<?xml version="1.0" encoding="UTF-8"?>');
101
+ console.log('<testsuites>');
102
+ }
103
+
104
+ count = 0;
105
+ fnames.forEach(function (fname) {
106
+ var content, timestamp, syntax, name;
107
+ try {
108
+ content = fs.readFileSync(fname, 'utf-8');
109
+
110
+ if (content[0] === '#' && content[1] === '!') {
111
+ content = '//' + content.substr(2, content.length);
112
+ }
113
+
114
+ timestamp = Date.now();
115
+ syntax = esprima.parse(content, { tolerant: true });
116
+
117
+ if (options.format === 'junit') {
118
+
119
+ name = fname;
120
+ if (name.lastIndexOf('/') >= 0) {
121
+ name = name.slice(name.lastIndexOf('/') + 1);
122
+ }
123
+
124
+ console.log('<testsuite name="' + fname + '" errors="0" ' +
125
+ ' failures="' + syntax.errors.length + '" ' +
126
+ ' tests="' + syntax.errors.length + '" ' +
127
+ ' time="' + Math.round((Date.now() - timestamp) / 1000) +
128
+ '">');
129
+
130
+ syntax.errors.forEach(function (error) {
131
+ var msg = error.message;
132
+ msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
133
+ console.log(' <testcase name="Line ' + error.lineNumber + ': ' + msg + '" ' +
134
+ ' time="0">');
135
+ console.log(' <error type="SyntaxError" message="' + error.message + '">' +
136
+ error.message + '(' + name + ':' + error.lineNumber + ')' +
137
+ '</error>');
138
+ console.log(' </testcase>');
139
+ });
140
+
141
+ console.log('</testsuite>');
142
+
143
+ } else if (options.format === 'plain') {
144
+
145
+ syntax.errors.forEach(function (error) {
146
+ var msg = error.message;
147
+ msg = msg.replace(/^Line\ [0-9]*\:\ /, '');
148
+ msg = fname + ':' + error.lineNumber + ': ' + msg;
149
+ console.log(msg);
150
+ ++count;
151
+ });
152
+
153
+ }
154
+ } catch (e) {
155
+ ++count;
156
+ if (options.format === 'junit') {
157
+ console.log('<testsuite name="' + fname + '" errors="1" failures="0" tests="1" ' +
158
+ ' time="' + Math.round((Date.now() - timestamp) / 1000) + '">');
159
+ console.log(' <testcase name="' + e.message + '" ' + ' time="0">');
160
+ console.log(' <error type="ParseError" message="' + e.message + '">' +
161
+ e.message + '(' + fname + ((e.lineNumber) ? ':' + e.lineNumber : '') +
162
+ ')</error>');
163
+ console.log(' </testcase>');
164
+ console.log('</testsuite>');
165
+ } else {
166
+ console.log('Error: ' + e.message);
167
+ }
168
+ }
169
+ });
170
+
171
+ if (options.format === 'junit') {
172
+ console.log('</testsuites>');
173
+ }
174
+
175
+ if (count > 0) {
176
+ process.exit(1);
177
+ }
@@ -0,0 +1,115 @@
1
+ 0.1.16 / 2013-12-01
2
+ -------------------
3
+
4
+ * Maintenance release. Updated dependencies and docs.
5
+
6
+
7
+ 0.1.15 / 2013-05-13
8
+ -------------------
9
+
10
+ * Fixed #55, @trebor89
11
+
12
+
13
+ 0.1.14 / 2013-05-12
14
+ -------------------
15
+
16
+ * Fixed #62, @maxtaco
17
+
18
+
19
+ 0.1.13 / 2013-04-08
20
+ -------------------
21
+
22
+ * Added `.npmignore` to reduce package size
23
+
24
+
25
+ 0.1.12 / 2013-02-10
26
+ -------------------
27
+
28
+ * Fixed conflictHandler (#46), @hpaulj
29
+
30
+
31
+ 0.1.11 / 2013-02-07
32
+ -------------------
33
+
34
+ * Multiple bugfixes, @hpaulj
35
+ * Added 70+ tests (ported from python), @hpaulj
36
+ * Added conflictHandler, @applepicke
37
+ * Added fromfilePrefixChar, @hpaulj
38
+
39
+
40
+ 0.1.10 / 2012-12-30
41
+ -------------------
42
+
43
+ * Added [mutual exclusion](http://docs.python.org/dev/library/argparse.html#mutual-exclusion)
44
+ support, thanks to @hpaulj
45
+ * Fixed options check for `storeConst` & `appendConst` actions, thanks to @hpaulj
46
+
47
+
48
+ 0.1.9 / 2012-12-27
49
+ ------------------
50
+
51
+ * Fixed option dest interferens with other options (issue #23), thanks to @hpaulj
52
+ * Fixed default value behavior with `*` positionals, thanks to @hpaulj
53
+ * Improve `getDefault()` behavior, thanks to @hpaulj
54
+ * Imrove negative argument parsing, thanks to @hpaulj
55
+
56
+
57
+ 0.1.8 / 2012-12-01
58
+ ------------------
59
+
60
+ * Fixed parser parents (issue #19), thanks to @hpaulj
61
+ * Fixed negative argument parse (issue #20), thanks to @hpaulj
62
+
63
+
64
+ 0.1.7 / 2012-10-14
65
+ ------------------
66
+
67
+ * Fixed 'choices' argument parse (issue #16)
68
+ * Fixed stderr output (issue #15)
69
+
70
+
71
+ 0.1.6 / 2012-09-09
72
+ ------------------
73
+
74
+ * Fixed check for conflict of options (thanks to @tomxtobin)
75
+
76
+
77
+ 0.1.5 / 2012-09-03
78
+ ------------------
79
+
80
+ * Fix parser #setDefaults method (thanks to @tomxtobin)
81
+
82
+
83
+ 0.1.4 / 2012-07-30
84
+ ------------------
85
+
86
+ * Fixed pseudo-argument support (thanks to @CGamesPlay)
87
+ * Fixed addHelp default (should be true), if not set (thanks to @benblank)
88
+
89
+
90
+ 0.1.3 / 2012-06-27
91
+ ------------------
92
+
93
+ * Fixed formatter api name: Formatter -> HelpFormatter
94
+
95
+
96
+ 0.1.2 / 2012-05-29
97
+ ------------------
98
+
99
+ * Added basic tests
100
+ * Removed excess whitespace in help
101
+ * Fixed error reporting, when parcer with subcommands
102
+ called with empty arguments
103
+
104
+
105
+ 0.1.1 / 2012-05-23
106
+ ------------------
107
+
108
+ * Fixed line wrapping in help formatter
109
+ * Added better error reporting on invalid arguments
110
+
111
+
112
+ 0.1.0 / 2012-05-16
113
+ ------------------
114
+
115
+ * First release.
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (C) 2012 by Vitaly Puzrin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,239 @@
1
+ argparse
2
+ ========
3
+
4
+ [![Build Status](https://secure.travis-ci.org/nodeca/argparse.png?branch=master)](http://travis-ci.org/nodeca/argparse)
5
+
6
+ CLI arguments parser for node.js. Javascript port of python's
7
+ [argparse](http://docs.python.org/dev/library/argparse.html) module
8
+ (original version 3.2). That's a full port, except some very rare options,
9
+ recorded in issue tracker.
10
+
11
+ **NB.** Method names changed to camelCase. See [generated docs](http://nodeca.github.com/argparse/).
12
+
13
+
14
+ Example
15
+ =======
16
+
17
+ test.js file:
18
+
19
+ ```javascript
20
+ #!/usr/bin/env node
21
+ 'use strict';
22
+
23
+ var ArgumentParser = require('../lib/argparse').ArgumentParser;
24
+ var parser = new ArgumentParser({
25
+ version: '0.0.1',
26
+ addHelp:true,
27
+ description: 'Argparse example'
28
+ });
29
+ parser.addArgument(
30
+ [ '-f', '--foo' ],
31
+ {
32
+ help: 'foo bar'
33
+ }
34
+ );
35
+ parser.addArgument(
36
+ [ '-b', '--bar' ],
37
+ {
38
+ help: 'bar foo'
39
+ }
40
+ );
41
+ var args = parser.parseArgs();
42
+ console.dir(args);
43
+ ```
44
+
45
+ Display help:
46
+
47
+ ```
48
+ $ ./test.js -h
49
+ usage: example.js [-h] [-v] [-f FOO] [-b BAR]
50
+
51
+ Argparse example
52
+
53
+ Optional arguments:
54
+ -h, --help Show this help message and exit.
55
+ -v, --version Show program's version number and exit.
56
+ -f FOO, --foo FOO foo bar
57
+ -b BAR, --bar BAR bar foo
58
+ ```
59
+
60
+ Parse arguments:
61
+
62
+ ```
63
+ $ ./test.js -f=3 --bar=4
64
+ { foo: '3', bar: '4' }
65
+ ```
66
+
67
+ More [examples](https://github.com/nodeca/argparse/tree/master/examples).
68
+
69
+
70
+ ArgumentParser objects
71
+ ======================
72
+
73
+ ```
74
+ new ArgumentParser({paramters hash});
75
+ ```
76
+
77
+ Creates a new ArgumentParser object.
78
+
79
+ **Supported params:**
80
+
81
+ - ```description``` - Text to display before the argument help.
82
+ - ```epilog``` - Text to display after the argument help.
83
+ - ```addHelp``` - Add a -h/–help option to the parser. (default: true)
84
+ - ```argumentDefault``` - Set the global default value for arguments. (default: null)
85
+ - ```parents``` - A list of ArgumentParser objects whose arguments should also be included.
86
+ - ```prefixChars``` - The set of characters that prefix optional arguments. (default: ‘-‘)
87
+ - ```formatterClass``` - A class for customizing the help output.
88
+ - ```prog``` - The name of the program (default: `path.basename(process.argv[1])`)
89
+ - ```usage``` - The string describing the program usage (default: generated)
90
+ - ```conflictHandler``` - Usually unnecessary, defines strategy for resolving conflicting optionals.
91
+
92
+ **Not supportied yet**
93
+
94
+ - ```fromfilePrefixChars``` - The set of characters that prefix files from which additional arguments should be read.
95
+
96
+
97
+ Details in [original ArgumentParser guide](http://docs.python.org/dev/library/argparse.html#argumentparser-objects)
98
+
99
+
100
+ addArgument() method
101
+ ====================
102
+
103
+ ```
104
+ ArgumentParser.addArgument([names or flags], {options})
105
+ ```
106
+
107
+ Defines how a single command-line argument should be parsed.
108
+
109
+ - ```name or flags``` - Either a name or a list of option strings, e.g. foo or -f, --foo.
110
+
111
+ Options:
112
+
113
+ - ```action``` - The basic type of action to be taken when this argument is encountered at the command line.
114
+ - ```nargs```- The number of command-line arguments that should be consumed.
115
+ - ```constant``` - A constant value required by some action and nargs selections.
116
+ - ```defaultValue``` - The value produced if the argument is absent from the command line.
117
+ - ```type``` - The type to which the command-line argument should be converted.
118
+ - ```choices``` - A container of the allowable values for the argument.
119
+ - ```required``` - Whether or not the command-line option may be omitted (optionals only).
120
+ - ```help``` - A brief description of what the argument does.
121
+ - ```metavar``` - A name for the argument in usage messages.
122
+ - ```dest``` - The name of the attribute to be added to the object returned by parseArgs().
123
+
124
+ Details in [original add_argument guide](http://docs.python.org/dev/library/argparse.html#the-add-argument-method)
125
+
126
+
127
+ Action (some details)
128
+ ================
129
+
130
+ ArgumentParser objects associate command-line arguments with actions.
131
+ These actions can do just about anything with the command-line arguments associated
132
+ with them, though most actions simply add an attribute to the object returned by
133
+ parseArgs(). The action keyword argument specifies how the command-line arguments
134
+ should be handled. The supported actions are:
135
+
136
+ - ```store``` - Just stores the argument’s value. This is the default action.
137
+ - ```storeConst``` - Stores value, specified by the const keyword argument.
138
+ (Note that the const keyword argument defaults to the rather unhelpful None.)
139
+ The 'storeConst' action is most commonly used with optional arguments, that
140
+ specify some sort of flag.
141
+ - ```storeTrue``` and ```storeFalse``` - Stores values True and False
142
+ respectively. These are special cases of 'storeConst'.
143
+ - ```append``` - Stores a list, and appends each argument value to the list.
144
+ This is useful to allow an option to be specified multiple times.
145
+ - ```appendConst``` - Stores a list, and appends value, specified by the
146
+ const keyword argument to the list. (Note, that the const keyword argument defaults
147
+ is None.) The 'appendConst' action is typically used when multiple arguments need
148
+ to store constants to the same list.
149
+ - ```count``` - Counts the number of times a keyword argument occurs. For example,
150
+ used for increasing verbosity levels.
151
+ - ```help``` - Prints a complete help message for all the options in the current
152
+ parser and then exits. By default a help action is automatically added to the parser.
153
+ See ArgumentParser for details of how the output is created.
154
+ - ```version``` - Prints version information and exit. Expects a `version=`
155
+ keyword argument in the addArgument() call.
156
+
157
+ Details in [original action guide](http://docs.python.org/dev/library/argparse.html#action)
158
+
159
+
160
+ Sub-commands
161
+ ============
162
+
163
+ ArgumentParser.addSubparsers()
164
+
165
+ Many programs split their functionality into a number of sub-commands, for
166
+ example, the svn program can invoke sub-commands like `svn checkout`, `svn update`,
167
+ and `svn commit`. Splitting up functionality this way can be a particularly good
168
+ idea when a program performs several different functions which require different
169
+ kinds of command-line arguments. `ArgumentParser` supports creation of such
170
+ sub-commands with `addSubparsers()` method. The `addSubparsers()` method is
171
+ normally called with no arguments and returns an special action object.
172
+ This object has a single method `addParser()`, which takes a command name and
173
+ any `ArgumentParser` constructor arguments, and returns an `ArgumentParser` object
174
+ that can be modified as usual.
175
+
176
+ Example:
177
+
178
+ sub_commands.js
179
+ ```javascript
180
+ #!/usr/bin/env node
181
+ 'use strict';
182
+
183
+ var ArgumentParser = require('../lib/argparse').ArgumentParser;
184
+ var parser = new ArgumentParser({
185
+ version: '0.0.1',
186
+ addHelp:true,
187
+ description: 'Argparse examples: sub-commands',
188
+ });
189
+
190
+ var subparsers = parser.addSubparsers({
191
+ title:'subcommands',
192
+ dest:"subcommand_name"
193
+ });
194
+
195
+ var bar = subparsers.addParser('c1', {addHelp:true});
196
+ bar.addArgument(
197
+ [ '-f', '--foo' ],
198
+ {
199
+ action: 'store',
200
+ help: 'foo3 bar3'
201
+ }
202
+ );
203
+ var bar = subparsers.addParser(
204
+ 'c2',
205
+ {aliases:['co'], addHelp:true}
206
+ );
207
+ bar.addArgument(
208
+ [ '-b', '--bar' ],
209
+ {
210
+ action: 'store',
211
+ type: 'int',
212
+ help: 'foo3 bar3'
213
+ }
214
+ );
215
+
216
+ var args = parser.parseArgs();
217
+ console.dir(args);
218
+
219
+ ```
220
+
221
+ Details in [original sub-commands guide](http://docs.python.org/dev/library/argparse.html#sub-commands)
222
+
223
+
224
+ Contributors
225
+ ============
226
+
227
+ - [Eugene Shkuropat](https://github.com/shkuropat)
228
+ - [Paul Jacobson](https://github.com/hpaulj)
229
+
230
+ [others](https://github.com/nodeca/argparse/graphs/contributors)
231
+
232
+ License
233
+ =======
234
+
235
+ Copyright (c) 2012 [Vitaly Puzrin](https://github.com/puzrin).
236
+ Released under the MIT license. See
237
+ [LICENSE](https://github.com/nodeca/argparse/blob/master/LICENSE) for details.
238
+
239
+