spade 0.0.8.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (346) hide show
  1. data/.gitignore +0 -1
  2. data/.gitmodules +4 -4
  3. data/README.md +4 -0
  4. data/bin/spade +1 -1
  5. data/lib/spade.rb +0 -51
  6. data/lib/spade/cli.rb +10 -4
  7. data/lib/spade/version.rb +1 -1
  8. data/spade.gemspec +4 -21
  9. metadata +13 -482
  10. data/Gemfile +0 -3
  11. data/Gemfile.lock +0 -40
  12. data/lib/index.js +0 -14
  13. data/lib/node/loader.js +0 -146
  14. data/lib/node/sandbox.js +0 -44
  15. data/lib/spade.js +0 -1130
  16. data/lib/spade/bundle.rb +0 -171
  17. data/lib/spade/cli/base.rb +0 -354
  18. data/lib/spade/cli/owner.rb +0 -45
  19. data/lib/spade/cli/project_generator.rb +0 -58
  20. data/lib/spade/compiler.rb +0 -34
  21. data/lib/spade/console.rb +0 -39
  22. data/lib/spade/context.rb +0 -116
  23. data/lib/spade/credentials.rb +0 -36
  24. data/lib/spade/dependency_installer.rb +0 -103
  25. data/lib/spade/environment.rb +0 -35
  26. data/lib/spade/exports.rb +0 -71
  27. data/lib/spade/installer.rb +0 -40
  28. data/lib/spade/loader.rb +0 -238
  29. data/lib/spade/local.rb +0 -46
  30. data/lib/spade/package.rb +0 -157
  31. data/lib/spade/reactor.rb +0 -159
  32. data/lib/spade/remote.rb +0 -99
  33. data/lib/spade/repository.rb +0 -18
  34. data/lib/spade/server.rb +0 -66
  35. data/lib/spade/shell.rb +0 -36
  36. data/lib/spade/templates/project/LICENSE +0 -19
  37. data/lib/spade/templates/project/README.md +0 -21
  38. data/lib/spade/templates/project/lib/main.js +0 -9
  39. data/lib/spade/templates/project/project.json +0 -31
  40. data/lib/spade/templates/project/tests/main-test.js +0 -8
  41. data/package.json +0 -27
  42. data/packages/coffee-script/.gitignore +0 -8
  43. data/packages/coffee-script/.npmignore +0 -11
  44. data/packages/coffee-script/Cakefile +0 -229
  45. data/packages/coffee-script/LICENSE +0 -22
  46. data/packages/coffee-script/README +0 -47
  47. data/packages/coffee-script/Rakefile +0 -78
  48. data/packages/coffee-script/bin/cake +0 -7
  49. data/packages/coffee-script/bin/coffee +0 -7
  50. data/packages/coffee-script/documentation/coffee/aliases.coffee +0 -11
  51. data/packages/coffee-script/documentation/coffee/array_comprehensions.coffee +0 -2
  52. data/packages/coffee-script/documentation/coffee/block_comment.coffee +0 -6
  53. data/packages/coffee-script/documentation/coffee/cake_tasks.coffee +0 -9
  54. data/packages/coffee-script/documentation/coffee/classes.coffee +0 -25
  55. data/packages/coffee-script/documentation/coffee/comparisons.coffee +0 -5
  56. data/packages/coffee-script/documentation/coffee/conditionals.coffee +0 -13
  57. data/packages/coffee-script/documentation/coffee/default_args.coffee +0 -8
  58. data/packages/coffee-script/documentation/coffee/do.coffee +0 -4
  59. data/packages/coffee-script/documentation/coffee/embedded.coffee +0 -5
  60. data/packages/coffee-script/documentation/coffee/existence.coffee +0 -10
  61. data/packages/coffee-script/documentation/coffee/expressions.coffee +0 -9
  62. data/packages/coffee-script/documentation/coffee/expressions_assignment.coffee +0 -3
  63. data/packages/coffee-script/documentation/coffee/expressions_comprehension.coffee +0 -3
  64. data/packages/coffee-script/documentation/coffee/expressions_try.coffee +0 -7
  65. data/packages/coffee-script/documentation/coffee/fat_arrow.coffee +0 -6
  66. data/packages/coffee-script/documentation/coffee/functions.coffee +0 -2
  67. data/packages/coffee-script/documentation/coffee/heredocs.coffee +0 -7
  68. data/packages/coffee-script/documentation/coffee/heregexes.coffee +0 -11
  69. data/packages/coffee-script/documentation/coffee/interpolation.coffee +0 -6
  70. data/packages/coffee-script/documentation/coffee/multiple_return_values.coffee +0 -7
  71. data/packages/coffee-script/documentation/coffee/object_comprehensions.coffee +0 -4
  72. data/packages/coffee-script/documentation/coffee/object_extraction.coffee +0 -13
  73. data/packages/coffee-script/documentation/coffee/objects_and_arrays.coffee +0 -19
  74. data/packages/coffee-script/documentation/coffee/objects_reserved.coffee +0 -5
  75. data/packages/coffee-script/documentation/coffee/overview.coffee +0 -28
  76. data/packages/coffee-script/documentation/coffee/parallel_assignment.coffee +0 -6
  77. data/packages/coffee-script/documentation/coffee/patterns_and_splats.coffee +0 -7
  78. data/packages/coffee-script/documentation/coffee/prototypes.coffee +0 -3
  79. data/packages/coffee-script/documentation/coffee/range_comprehensions.coffee +0 -2
  80. data/packages/coffee-script/documentation/coffee/scope.coffee +0 -5
  81. data/packages/coffee-script/documentation/coffee/slices.coffee +0 -7
  82. data/packages/coffee-script/documentation/coffee/soaks.coffee +0 -1
  83. data/packages/coffee-script/documentation/coffee/splats.coffee +0 -27
  84. data/packages/coffee-script/documentation/coffee/splices.coffee +0 -5
  85. data/packages/coffee-script/documentation/coffee/strings.coffee +0 -8
  86. data/packages/coffee-script/documentation/coffee/switch.coffee +0 -10
  87. data/packages/coffee-script/documentation/coffee/try.coffee +0 -8
  88. data/packages/coffee-script/documentation/coffee/while.coffee +0 -10
  89. data/packages/coffee-script/documentation/css/docs.css +0 -374
  90. data/packages/coffee-script/documentation/css/idle.css +0 -64
  91. data/packages/coffee-script/documentation/docs/browser.html +0 -25
  92. data/packages/coffee-script/documentation/docs/cake.html +0 -43
  93. data/packages/coffee-script/documentation/docs/coffee-script.html +0 -51
  94. data/packages/coffee-script/documentation/docs/command.html +0 -161
  95. data/packages/coffee-script/documentation/docs/docco.css +0 -186
  96. data/packages/coffee-script/documentation/docs/grammar.html +0 -399
  97. data/packages/coffee-script/documentation/docs/helpers.html +0 -31
  98. data/packages/coffee-script/documentation/docs/index.html +0 -3
  99. data/packages/coffee-script/documentation/docs/lexer.html +0 -490
  100. data/packages/coffee-script/documentation/docs/nodes.html +0 -1338
  101. data/packages/coffee-script/documentation/docs/optparse.html +0 -78
  102. data/packages/coffee-script/documentation/docs/repl.html +0 -24
  103. data/packages/coffee-script/documentation/docs/rewriter.html +0 -251
  104. data/packages/coffee-script/documentation/docs/scope.html +0 -54
  105. data/packages/coffee-script/documentation/docs/underscore.html +0 -295
  106. data/packages/coffee-script/documentation/images/background.png +0 -0
  107. data/packages/coffee-script/documentation/images/banding.png +0 -0
  108. data/packages/coffee-script/documentation/images/button_bg.png +0 -0
  109. data/packages/coffee-script/documentation/images/button_bg_dark.gif +0 -0
  110. data/packages/coffee-script/documentation/images/button_bg_green.gif +0 -0
  111. data/packages/coffee-script/documentation/images/favicon.ico +0 -0
  112. data/packages/coffee-script/documentation/images/logo.png +0 -0
  113. data/packages/coffee-script/documentation/images/screenshadow.png +0 -0
  114. data/packages/coffee-script/documentation/index.html.erb +0 -1607
  115. data/packages/coffee-script/documentation/js/aliases.js +0 -17
  116. data/packages/coffee-script/documentation/js/array_comprehensions.js +0 -6
  117. data/packages/coffee-script/documentation/js/block_comment.js +0 -4
  118. data/packages/coffee-script/documentation/js/cake_tasks.js +0 -10
  119. data/packages/coffee-script/documentation/js/classes.js +0 -44
  120. data/packages/coffee-script/documentation/js/comparisons.js +0 -3
  121. data/packages/coffee-script/documentation/js/conditionals.js +0 -12
  122. data/packages/coffee-script/documentation/js/default_args.js +0 -7
  123. data/packages/coffee-script/documentation/js/do.js +0 -10
  124. data/packages/coffee-script/documentation/js/embedded.js +0 -4
  125. data/packages/coffee-script/documentation/js/existence.js +0 -6
  126. data/packages/coffee-script/documentation/js/expressions.js +0 -15
  127. data/packages/coffee-script/documentation/js/expressions_assignment.js +0 -2
  128. data/packages/coffee-script/documentation/js/expressions_comprehension.js +0 -9
  129. data/packages/coffee-script/documentation/js/expressions_try.js +0 -7
  130. data/packages/coffee-script/documentation/js/fat_arrow.js +0 -9
  131. data/packages/coffee-script/documentation/js/functions.js +0 -7
  132. data/packages/coffee-script/documentation/js/heredocs.js +0 -2
  133. data/packages/coffee-script/documentation/js/heregexes.js +0 -2
  134. data/packages/coffee-script/documentation/js/interpolation.js +0 -4
  135. data/packages/coffee-script/documentation/js/multiple_return_values.js +0 -5
  136. data/packages/coffee-script/documentation/js/object_comprehensions.js +0 -15
  137. data/packages/coffee-script/documentation/js/object_extraction.js +0 -10
  138. data/packages/coffee-script/documentation/js/objects_and_arrays.js +0 -17
  139. data/packages/coffee-script/documentation/js/objects_reserved.js +0 -4
  140. data/packages/coffee-script/documentation/js/overview.js +0 -35
  141. data/packages/coffee-script/documentation/js/parallel_assignment.js +0 -4
  142. data/packages/coffee-script/documentation/js/patterns_and_splats.js +0 -4
  143. data/packages/coffee-script/documentation/js/prototypes.js +0 -3
  144. data/packages/coffee-script/documentation/js/range_comprehensions.js +0 -9
  145. data/packages/coffee-script/documentation/js/scope.js +0 -8
  146. data/packages/coffee-script/documentation/js/slices.js +0 -4
  147. data/packages/coffee-script/documentation/js/soaks.js +0 -2
  148. data/packages/coffee-script/documentation/js/splats.js +0 -15
  149. data/packages/coffee-script/documentation/js/splices.js +0 -3
  150. data/packages/coffee-script/documentation/js/strings.js +0 -2
  151. data/packages/coffee-script/documentation/js/switch.js +0 -23
  152. data/packages/coffee-script/documentation/js/try.js +0 -8
  153. data/packages/coffee-script/documentation/js/while.js +0 -18
  154. data/packages/coffee-script/documentation/vendor/jquery-1.4.2.js +0 -6240
  155. data/packages/coffee-script/examples/beautiful_code/binary_search.coffee +0 -16
  156. data/packages/coffee-script/examples/beautiful_code/quicksort_runtime.coffee +0 -13
  157. data/packages/coffee-script/examples/beautiful_code/regular_expression_matcher.coffee +0 -34
  158. data/packages/coffee-script/examples/blocks.coffee +0 -54
  159. data/packages/coffee-script/examples/code.coffee +0 -167
  160. data/packages/coffee-script/examples/computer_science/README +0 -4
  161. data/packages/coffee-script/examples/computer_science/binary_search.coffee +0 -25
  162. data/packages/coffee-script/examples/computer_science/bubble_sort.coffee +0 -11
  163. data/packages/coffee-script/examples/computer_science/linked_list.coffee +0 -108
  164. data/packages/coffee-script/examples/computer_science/luhn_algorithm.coffee +0 -36
  165. data/packages/coffee-script/examples/computer_science/merge_sort.coffee +0 -19
  166. data/packages/coffee-script/examples/computer_science/selection_sort.coffee +0 -23
  167. data/packages/coffee-script/examples/poignant.coffee +0 -181
  168. data/packages/coffee-script/examples/potion.coffee +0 -206
  169. data/packages/coffee-script/examples/underscore.coffee +0 -682
  170. data/packages/coffee-script/examples/web_server.coffee +0 -12
  171. data/packages/coffee-script/extras/EXTRAS +0 -7
  172. data/packages/coffee-script/extras/coffee-script.js +0 -8
  173. data/packages/coffee-script/extras/jsl.conf +0 -44
  174. data/packages/coffee-script/index.html +0 -2515
  175. data/packages/coffee-script/lib/browser.js +0 -52
  176. data/packages/coffee-script/lib/cake.js +0 -76
  177. data/packages/coffee-script/lib/coffee-script.js +0 -82
  178. data/packages/coffee-script/lib/command.js +0 -263
  179. data/packages/coffee-script/lib/grammar.js +0 -581
  180. data/packages/coffee-script/lib/helpers.js +0 -66
  181. data/packages/coffee-script/lib/index.js +0 -8
  182. data/packages/coffee-script/lib/lexer.js +0 -633
  183. data/packages/coffee-script/lib/nodes.js +0 -2165
  184. data/packages/coffee-script/lib/optparse.js +0 -111
  185. data/packages/coffee-script/lib/parser.js +0 -649
  186. data/packages/coffee-script/lib/repl.js +0 -42
  187. data/packages/coffee-script/lib/rewriter.js +0 -353
  188. data/packages/coffee-script/lib/scope.js +0 -120
  189. data/packages/coffee-script/lib/spade-format.js +0 -45
  190. data/packages/coffee-script/package.json +0 -26
  191. data/packages/coffee-script/src/browser.coffee +0 -43
  192. data/packages/coffee-script/src/cake.coffee +0 -69
  193. data/packages/coffee-script/src/coffee-script.coffee +0 -92
  194. data/packages/coffee-script/src/command.coffee +0 -214
  195. data/packages/coffee-script/src/grammar.coffee +0 -590
  196. data/packages/coffee-script/src/helpers.coffee +0 -56
  197. data/packages/coffee-script/src/index.coffee +0 -2
  198. data/packages/coffee-script/src/lexer.coffee +0 -653
  199. data/packages/coffee-script/src/nodes.coffee +0 -1754
  200. data/packages/coffee-script/src/optparse.coffee +0 -99
  201. data/packages/coffee-script/src/repl.coffee +0 -42
  202. data/packages/coffee-script/src/rewriter.coffee +0 -326
  203. data/packages/coffee-script/src/scope.coffee +0 -94
  204. data/packages/coffee-script/test/arguments.coffee +0 -127
  205. data/packages/coffee-script/test/assignment.coffee +0 -98
  206. data/packages/coffee-script/test/break.coffee +0 -18
  207. data/packages/coffee-script/test/comments.coffee +0 -201
  208. data/packages/coffee-script/test/conditionals.coffee +0 -181
  209. data/packages/coffee-script/test/exception_handling.coffee +0 -90
  210. data/packages/coffee-script/test/helpers.coffee +0 -96
  211. data/packages/coffee-script/test/importing.coffee +0 -18
  212. data/packages/coffee-script/test/operators.coffee +0 -225
  213. data/packages/coffee-script/test/ranges_slices_and_splices.coffee +0 -186
  214. data/packages/coffee-script/test/regular_expressions.coffee +0 -56
  215. data/packages/coffee-script/test/test.html +0 -123
  216. data/packages/coffee-script/test/test_chaining.coffee +0 -77
  217. data/packages/coffee-script/test/test_classes.coffee +0 -372
  218. data/packages/coffee-script/test/test_compilation.coffee +0 -26
  219. data/packages/coffee-script/test/test_comprehensions.coffee +0 -318
  220. data/packages/coffee-script/test/test_existence.coffee +0 -165
  221. data/packages/coffee-script/test/test_functions.coffee +0 -379
  222. data/packages/coffee-script/test/test_heredocs.coffee +0 -111
  223. data/packages/coffee-script/test/test_literals.coffee +0 -270
  224. data/packages/coffee-script/test/test_option_parser.coffee +0 -27
  225. data/packages/coffee-script/test/test_pattern_matching.coffee +0 -162
  226. data/packages/coffee-script/test/test_returns.coffee +0 -63
  227. data/packages/coffee-script/test/test_splats.coffee +0 -102
  228. data/packages/coffee-script/test/test_strings.coffee +0 -118
  229. data/packages/coffee-script/test/test_switch.coffee +0 -103
  230. data/packages/coffee-script/test/test_while.coffee +0 -71
  231. data/packages/ivory/LICENSE.txt +0 -1
  232. data/packages/ivory/README.md +0 -19
  233. data/packages/ivory/lib/buffer.js +0 -111
  234. data/packages/ivory/lib/events.js +0 -137
  235. data/packages/ivory/lib/fs.js +0 -266
  236. data/packages/ivory/lib/main.js +0 -13
  237. data/packages/ivory/lib/path.js +0 -158
  238. data/packages/ivory/lib/ruby/buffer.rb +0 -145
  239. data/packages/ivory/lib/ruby/constants.rb +0 -585
  240. data/packages/ivory/lib/ruby/events.rb +0 -32
  241. data/packages/ivory/lib/ruby/fs.rb +0 -245
  242. data/packages/ivory/lib/ruby/process.rb +0 -28
  243. data/packages/ivory/lib/stream.js +0 -115
  244. data/packages/ivory/lib/util.js +0 -414
  245. data/packages/ivory/package.json +0 -11
  246. data/packages/jquery/main.js +0 -7179
  247. data/packages/jquery/package.json +0 -10
  248. data/packages/json/lib/main.js +0 -14
  249. data/packages/json/package.json +0 -8
  250. data/packages/lproj/README.md +0 -77
  251. data/packages/lproj/examples/demo-app/en.lproj/localized.strings +0 -2
  252. data/packages/lproj/examples/demo-app/fr.lproj/localized.strings +0 -3
  253. data/packages/lproj/examples/demo-app/index.html +0 -8
  254. data/packages/lproj/examples/demo-app/lib/main.js +0 -7
  255. data/packages/lproj/examples/demo-app/package.json +0 -9
  256. data/packages/lproj/lib/main.js +0 -78
  257. data/packages/lproj/lib/strings-format.js +0 -6
  258. data/packages/lproj/package.json +0 -9
  259. data/packages/optparse/README.md +0 -161
  260. data/packages/optparse/TODO +0 -1
  261. data/packages/optparse/examples/browser-test.html +0 -75
  262. data/packages/optparse/examples/nodejs-test.js +0 -90
  263. data/packages/optparse/lib/optparse.js +0 -309
  264. data/packages/optparse/package.json +0 -13
  265. data/packages/optparse/seed.yml +0 -5
  266. data/packages/text/lib/main.js +0 -8
  267. data/packages/text/package.json +0 -9
  268. data/packages/web-file/README.md +0 -7
  269. data/packages/web-file/lib/errors.js +0 -32
  270. data/packages/web-file/lib/file-reader.js +0 -10
  271. data/packages/web-file/lib/file-system.js +0 -234
  272. data/packages/web-file/lib/file-writer.js +0 -10
  273. data/packages/web-file/lib/file.js +0 -9
  274. data/packages/web-file/lib/main.js +0 -34
  275. data/packages/web-file/lib/platform.js +0 -25
  276. data/packages/web-file/lib/ruby/file.rb +0 -252
  277. data/packages/web-file/lib/ruby/file_reader.rb +0 -69
  278. data/packages/web-file/lib/ruby/file_system.rb +0 -134
  279. data/packages/web-file/lib/ruby/file_writer.rb +0 -78
  280. data/packages/web-file/package.json +0 -12
  281. data/packages/web-typed-array/README.md +0 -7
  282. data/packages/web-typed-array/lib/array-buffer-view.js +0 -9
  283. data/packages/web-typed-array/lib/array-buffer.js +0 -7
  284. data/packages/web-typed-array/lib/main.js +0 -33
  285. data/packages/web-typed-array/lib/platform.js +0 -20
  286. data/packages/web-typed-array/lib/ruby/array_buffer.rb +0 -31
  287. data/packages/web-typed-array/lib/ruby/array_buffer_view.rb +0 -130
  288. data/packages/web-typed-array/lib/ruby/typed_array.rb +0 -133
  289. data/packages/web-typed-array/lib/typed-array.js +0 -26
  290. data/packages/web-typed-array/package.json +0 -9
  291. data/spec/cli/build_spec.rb +0 -59
  292. data/spec/cli/install_spec.rb +0 -120
  293. data/spec/cli/installed_spec.rb +0 -55
  294. data/spec/cli/list_spec.rb +0 -75
  295. data/spec/cli/login_spec.rb +0 -76
  296. data/spec/cli/new_spec.rb +0 -5
  297. data/spec/cli/owner_spec.rb +0 -115
  298. data/spec/cli/push_spec.rb +0 -74
  299. data/spec/cli/uninstall_spec.rb +0 -58
  300. data/spec/cli/unpack_spec.rb +0 -73
  301. data/spec/cli/unyank_spec.rb +0 -74
  302. data/spec/cli/update_spec.rb +0 -8
  303. data/spec/cli/yank_spec.rb +0 -74
  304. data/spec/credentials_spec.rb +0 -24
  305. data/spec/fixtures/coffee-1.0.1.pre.spd +0 -0
  306. data/spec/fixtures/core-test-0.4.3.spd +0 -0
  307. data/spec/fixtures/core-test/bin/cot +0 -3
  308. data/spec/fixtures/core-test/lib/main.js +0 -1
  309. data/spec/fixtures/core-test/resources/runner.css +0 -0
  310. data/spec/fixtures/core-test/tests/test.js +0 -1
  311. data/spec/fixtures/ivory-0.0.1.spd +0 -0
  312. data/spec/fixtures/jquery-1.4.3.spd +0 -0
  313. data/spec/fixtures/optparse-1.0.1.spd +0 -0
  314. data/spec/fixtures/package.json +0 -30
  315. data/spec/gauntlet_spec.rb +0 -27
  316. data/spec/javascript/async-test.js +0 -123
  317. data/spec/javascript/compiler/javascript.js +0 -13
  318. data/spec/javascript/compiler/ruby.js +0 -14
  319. data/spec/javascript/loader-test.js +0 -64
  320. data/spec/javascript/normalize-test.js +0 -73
  321. data/spec/javascript/packages-test.js +0 -44
  322. data/spec/javascript/relative-require-test.js +0 -72
  323. data/spec/javascript/require-test.js +0 -117
  324. data/spec/javascript/sandbox/compile.js +0 -37
  325. data/spec/javascript/sandbox/creation.js +0 -44
  326. data/spec/javascript/sandbox/format.js +0 -79
  327. data/spec/javascript/sandbox/misc.js +0 -57
  328. data/spec/javascript/sandbox/preprocessor.js +0 -81
  329. data/spec/javascript/sandbox/require.js +0 -48
  330. data/spec/javascript/sandbox/run-command.js +0 -21
  331. data/spec/javascript/spade/externs.js +0 -14
  332. data/spec/javascript/spade/load-factory.js +0 -15
  333. data/spec/javascript/spade/misc.js +0 -23
  334. data/spec/javascript/spade/ready.js +0 -12
  335. data/spec/javascript/spade/register.js +0 -13
  336. data/spec/javascript_spec.rb +0 -7
  337. data/spec/package_spec.rb +0 -267
  338. data/spec/spec_helper.rb +0 -30
  339. data/spec/support/cli.rb +0 -94
  340. data/spec/support/core_test.rb +0 -59
  341. data/spec/support/fake.rb +0 -44
  342. data/spec/support/fake_gem_server.rb +0 -66
  343. data/spec/support/fake_gemcutter.rb +0 -49
  344. data/spec/support/matchers.rb +0 -31
  345. data/spec/support/path.rb +0 -54
  346. data/test-spade.html +0 -8
@@ -1,64 +0,0 @@
1
- pre.idle .InheritedClass {
2
- }
3
- pre.idle .TypeName {
4
- color: #21439C;
5
- }
6
- pre.idle .Number {
7
- }
8
- pre.idle .LibraryVariable {
9
- color: #A535AE;
10
- }
11
- pre.idle .Storage {
12
- color: #FF5600;
13
- }
14
- pre.idle .line-numbers {
15
- background-color: #BAD6FD;
16
- color: #000000;
17
- }
18
- pre.idle {
19
- background-color: #FFFFFF;
20
- color: #000000;
21
- }
22
- pre.idle .StringInterpolation {
23
- color: #990000;
24
- }
25
- pre.idle .TagName {
26
- }
27
- pre.idle .LibraryConstant {
28
- color: #A535AE;
29
- }
30
- pre.idle .FunctionArgument {
31
- color: #0076ad;
32
- }
33
- pre.idle .BuiltInConstant {
34
- color: #A535AE;
35
- }
36
- pre.idle .Invalid {
37
- background-color: #990000;
38
- color: #FFFFFF;
39
- }
40
- pre.idle .LibraryClassType {
41
- color: #A535AE;
42
- }
43
- pre.idle .LibraryFunction {
44
- color: #A535AE;
45
- }
46
- pre.idle .TagAttribute {
47
- }
48
- pre.idle .Keyword {
49
- color: #FF5600;
50
- }
51
- pre.idle .UserDefinedConstant {
52
- }
53
- pre.idle .String {
54
- color: #00A33F;
55
- }
56
- pre.idle .FunctionName {
57
- color: #21439C;
58
- }
59
- pre.idle .Variable {
60
- color: #A535AE;
61
- }
62
- pre.idle .Comment {
63
- color: #919191;
64
- }
@@ -1,25 +0,0 @@
1
- <!DOCTYPE html> <html> <head> <title>browser.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="browser.html"> browser.coffee </a> <a class="source" href="cake.html"> cake.coffee </a> <a class="source" href="coffee-script.html"> coffee-script.coffee </a> <a class="source" href="command.html"> command.coffee </a> <a class="source" href="grammar.html"> grammar.coffee </a> <a class="source" href="helpers.html"> helpers.coffee </a> <a class="source" href="index.html"> index.coffee </a> <a class="source" href="lexer.html"> lexer.coffee </a> <a class="source" href="nodes.html"> nodes.coffee </a> <a class="source" href="optparse.html"> optparse.coffee </a> <a class="source" href="repl.html"> repl.coffee </a> <a class="source" href="rewriter.html"> rewriter.coffee </a> <a class="source" href="scope.html"> scope.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> browser.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>Override exported methods for non-Node.js engines.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">CoffeeScript = </span><span class="nx">require</span> <span class="s1">&#39;./coffee-script&#39;</span>
2
- <span class="nv">CoffeeScript.require = </span><span class="nx">require</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>Use standard JavaScript <code>eval</code> to eval code.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">CoffeeScript.eval = </span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="o">-&gt;</span>
3
- <span class="nb">eval</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">options</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Running code does not provide access to this scope.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">CoffeeScript.run = </span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nv">options = </span><span class="p">{})</span> <span class="o">-&gt;</span>
4
- <span class="nv">options.bare = </span><span class="kc">on</span>
5
- <span class="nb">Function</span><span class="p">(</span><span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">)()</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>If we're not in a browser environment, we're finished with the public API.</p> </td> <td class="code"> <div class="highlight"><pre><span class="k">return</span> <span class="nx">unless</span> <span class="nb">window</span><span class="o">?</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>Load a remote script from the current domain via XHR.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">CoffeeScript.load = </span><span class="p">(</span><span class="nx">url</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="o">-&gt;</span>
6
- <span class="nv">xhr = </span><span class="k">new</span> <span class="p">(</span><span class="nb">window</span><span class="p">.</span><span class="nx">ActiveXObject</span> <span class="o">or</span> <span class="nx">XMLHttpRequest</span><span class="p">)(</span><span class="s1">&#39;Microsoft.XMLHTTP&#39;</span><span class="p">)</span>
7
- <span class="nx">xhr</span><span class="p">.</span><span class="nx">open</span> <span class="s1">&#39;GET&#39;</span><span class="p">,</span> <span class="nx">url</span><span class="p">,</span> <span class="kc">true</span>
8
- <span class="nx">xhr</span><span class="p">.</span><span class="nx">overrideMimeType</span> <span class="s1">&#39;text/plain&#39;</span> <span class="k">if</span> <span class="s1">&#39;overrideMimeType&#39;</span> <span class="k">of</span> <span class="nx">xhr</span>
9
- <span class="nv">xhr.onreadystatechange = </span><span class="o">-&gt;</span>
10
- <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">run</span> <span class="nx">xhr</span><span class="p">.</span><span class="nx">responseText</span><span class="p">,</span> <span class="nx">options</span> <span class="k">if</span> <span class="nx">xhr</span><span class="p">.</span><span class="nx">readyState</span> <span class="o">is</span> <span class="mi">4</span>
11
- <span class="nx">xhr</span><span class="p">.</span><span class="nx">send</span> <span class="kc">null</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>Activate CoffeeScript in the browser by having it compile and evaluate
12
- all script tags with a content-type of <code>text/coffeescript</code>.
13
- This happens on page load.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">runScripts = </span><span class="o">-&gt;</span>
14
- <span class="k">for</span> <span class="nx">script</span> <span class="k">in</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span> <span class="s1">&#39;script&#39;</span>
15
- <span class="k">if</span> <span class="nx">script</span><span class="p">.</span><span class="nx">type</span> <span class="o">is</span> <span class="s1">&#39;text/coffeescript&#39;</span>
16
- <span class="k">if</span> <span class="nx">script</span><span class="p">.</span><span class="nx">src</span>
17
- <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">load</span> <span class="nx">script</span><span class="p">.</span><span class="nx">src</span>
18
- <span class="k">else</span>
19
- <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">run</span> <span class="nx">script</span><span class="p">.</span><span class="nx">innerHTML</span>
20
- <span class="kc">null</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>Listen for window load, both in browsers and in IE.</p> </td> <td class="code"> <div class="highlight"><pre><span class="k">if</span> <span class="nb">window</span><span class="p">.</span><span class="nx">addEventListener</span>
21
- <span class="nx">addEventListener</span> <span class="s1">&#39;DOMContentLoaded&#39;</span><span class="p">,</span> <span class="nx">runScripts</span><span class="p">,</span> <span class="kc">no</span>
22
- <span class="k">else</span>
23
- <span class="nx">attachEvent</span> <span class="s1">&#39;onload&#39;</span><span class="p">,</span> <span class="nx">runScripts</span>
24
-
25
- </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,43 +0,0 @@
1
- <!DOCTYPE html> <html> <head> <title>cake.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="browser.html"> browser.coffee </a> <a class="source" href="cake.html"> cake.coffee </a> <a class="source" href="coffee-script.html"> coffee-script.coffee </a> <a class="source" href="command.html"> command.coffee </a> <a class="source" href="grammar.html"> grammar.coffee </a> <a class="source" href="helpers.html"> helpers.coffee </a> <a class="source" href="index.html"> index.coffee </a> <a class="source" href="lexer.html"> lexer.coffee </a> <a class="source" href="nodes.html"> nodes.coffee </a> <a class="source" href="optparse.html"> optparse.coffee </a> <a class="source" href="repl.html"> repl.coffee </a> <a class="source" href="rewriter.html"> rewriter.coffee </a> <a class="source" href="scope.html"> scope.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> cake.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p><code>cake</code> is a simplified version of <a href="http://www.gnu.org/software/make/">Make</a>
2
- (<a href="http://rake.rubyforge.org/">Rake</a>, <a href="http://github.com/280north/jake">Jake</a>)
3
- for CoffeeScript. You define tasks with names and descriptions in a Cakefile,
4
- and can call them from the command line, or invoke them from other tasks.</p>
5
-
6
- <p>Running <code>cake</code> with no arguments will print out a list of all the tasks in the
7
- current directory's Cakefile.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>External dependencies.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">fs = </span><span class="nx">require</span> <span class="s1">&#39;fs&#39;</span>
8
- <span class="nv">path = </span><span class="nx">require</span> <span class="s1">&#39;path&#39;</span>
9
- <span class="nv">helpers = </span><span class="nx">require</span> <span class="s1">&#39;./helpers&#39;</span>
10
- <span class="nv">optparse = </span><span class="nx">require</span> <span class="s1">&#39;./optparse&#39;</span>
11
- <span class="nv">CoffeeScript = </span><span class="nx">require</span> <span class="s1">&#39;./coffee-script&#39;</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Keep track of the list of defined tasks, the accepted options, and so on.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">tasks = </span><span class="p">{}</span>
12
- <span class="nv">options = </span><span class="p">{}</span>
13
- <span class="nv">switches = </span><span class="p">[]</span>
14
- <span class="nv">oparse = </span><span class="kc">null</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Mixin the top-level Cake functions for Cakefiles to use directly.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">helpers</span><span class="p">.</span><span class="nx">extend</span> <span class="nx">global</span><span class="p">,</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>Define a Cake task with a short name, an optional sentence description,
15
- and the function to run as the action itself.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">task</span><span class="o">:</span> <span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">description</span><span class="p">,</span> <span class="nx">action</span><span class="p">)</span> <span class="o">-&gt;</span>
16
- <span class="p">[</span><span class="nx">action</span><span class="p">,</span> <span class="nx">description</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="nx">description</span><span class="p">,</span> <span class="nx">action</span><span class="p">]</span> <span class="nx">unless</span> <span class="nx">action</span>
17
- <span class="nx">tasks</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="nx">name</span><span class="p">,</span> <span class="nx">description</span><span class="p">,</span> <span class="nx">action</span><span class="p">}</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>Define an option that the Cakefile accepts. The parsed options hash,
18
- containing all of the command-line options passed, will be made available
19
- as the first argument to the action.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">option</span><span class="o">:</span> <span class="p">(</span><span class="nx">letter</span><span class="p">,</span> <span class="nx">flag</span><span class="p">,</span> <span class="nx">description</span><span class="p">)</span> <span class="o">-&gt;</span>
20
- <span class="nx">switches</span><span class="p">.</span><span class="nx">push</span> <span class="p">[</span><span class="nx">letter</span><span class="p">,</span> <span class="nx">flag</span><span class="p">,</span> <span class="nx">description</span><span class="p">]</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>Invoke another task in the current Cakefile.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nx">invoke</span><span class="o">:</span> <span class="p">(</span><span class="nx">name</span><span class="p">)</span> <span class="o">-&gt;</span>
21
- <span class="nx">missingTask</span> <span class="nx">name</span> <span class="nx">unless</span> <span class="nx">tasks</span><span class="p">[</span><span class="nx">name</span><span class="p">]</span>
22
- <span class="nx">tasks</span><span class="p">[</span><span class="nx">name</span><span class="p">].</span><span class="nx">action</span> <span class="nx">options</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Run <code>cake</code>. Executes all of the tasks you pass, in order. Note that Node's
23
- asynchrony may cause tasks to execute in a different order than you'd expect.
24
- If no tasks are passed, print the help screen.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.run = </span><span class="o">-&gt;</span>
25
- <span class="nx">path</span><span class="p">.</span><span class="nx">exists</span> <span class="s1">&#39;Cakefile&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nx">exists</span><span class="p">)</span> <span class="o">-&gt;</span>
26
- <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span><span class="p">(</span><span class="s2">&quot;Cakefile not found in #{process.cwd()}&quot;</span><span class="p">)</span> <span class="nx">unless</span> <span class="nx">exists</span>
27
- <span class="nv">args = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">2</span>
28
- <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">run</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span><span class="p">(</span><span class="s1">&#39;Cakefile&#39;</span><span class="p">).</span><span class="nx">toString</span><span class="p">(),</span> <span class="nx">fileName</span><span class="o">:</span> <span class="s1">&#39;Cakefile&#39;</span>
29
- <span class="nv">oparse = </span><span class="k">new</span> <span class="nx">optparse</span><span class="p">.</span><span class="nx">OptionParser</span> <span class="nx">switches</span>
30
- <span class="k">return</span> <span class="nx">printTasks</span><span class="p">()</span> <span class="nx">unless</span> <span class="nx">args</span><span class="p">.</span><span class="nx">length</span>
31
- <span class="nv">options = </span><span class="nx">oparse</span><span class="p">.</span><span class="nx">parse</span><span class="p">(</span><span class="nx">args</span><span class="p">)</span>
32
- <span class="nx">invoke</span> <span class="nx">arg</span> <span class="k">for</span> <span class="nx">arg</span> <span class="k">in</span> <span class="nx">options</span><span class="p">.</span><span class="nx">arguments</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Display the list of Cake tasks in a format similar to <code>rake -T</code></p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">printTasks = </span><span class="o">-&gt;</span>
33
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s1">&#39;&#39;</span>
34
- <span class="k">for</span> <span class="nx">name</span><span class="p">,</span> <span class="nx">task</span> <span class="k">of</span> <span class="nx">tasks</span>
35
- <span class="nv">spaces = </span><span class="mi">20</span> <span class="o">-</span> <span class="nx">name</span><span class="p">.</span><span class="nx">length</span>
36
- <span class="nv">spaces = </span><span class="k">if</span> <span class="nx">spaces</span> <span class="o">&gt;</span> <span class="mi">0</span> <span class="k">then</span> <span class="nb">Array</span><span class="p">(</span><span class="nx">spaces</span> <span class="o">+</span> <span class="mi">1</span><span class="p">).</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">)</span> <span class="k">else</span> <span class="s1">&#39;&#39;</span>
37
- <span class="nv">desc = </span><span class="k">if</span> <span class="nx">task</span><span class="p">.</span><span class="nx">description</span> <span class="k">then</span> <span class="s2">&quot;# #{task.description}&quot;</span> <span class="k">else</span> <span class="s1">&#39;&#39;</span>
38
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s2">&quot;cake #{name}#{spaces} #{desc}&quot;</span>
39
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="nx">oparse</span><span class="p">.</span><span class="nx">help</span><span class="p">()</span> <span class="k">if</span> <span class="nx">switches</span><span class="p">.</span><span class="nx">length</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>Print an error and exit when attempting to all an undefined task.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">missingTask = </span><span class="p">(</span><span class="nx">task</span><span class="p">)</span> <span class="o">-&gt;</span>
40
- <span class="nx">console</span><span class="p">.</span><span class="nx">log</span> <span class="s2">&quot;No such task: \&quot;#{task}\&quot;&quot;</span>
41
- <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">1</span>
42
-
43
- </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,51 +0,0 @@
1
- <!DOCTYPE html> <html> <head> <title>coffee-script.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="browser.html"> browser.coffee </a> <a class="source" href="cake.html"> cake.coffee </a> <a class="source" href="coffee-script.html"> coffee-script.coffee </a> <a class="source" href="command.html"> command.coffee </a> <a class="source" href="grammar.html"> grammar.coffee </a> <a class="source" href="helpers.html"> helpers.coffee </a> <a class="source" href="index.html"> index.coffee </a> <a class="source" href="lexer.html"> lexer.coffee </a> <a class="source" href="nodes.html"> nodes.coffee </a> <a class="source" href="optparse.html"> optparse.coffee </a> <a class="source" href="repl.html"> repl.coffee </a> <a class="source" href="rewriter.html"> rewriter.coffee </a> <a class="source" href="scope.html"> scope.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> coffee-script.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>CoffeeScript can be used both on the server, as a command-line compiler based
2
- on Node.js/V8, or to run CoffeeScripts directly in the browser. This module
3
- contains the main entry functions for tokenizing, parsing, and compiling
4
- source CoffeeScript into JavaScript.</p>
5
-
6
- <p>If included on a webpage, it will automatically sniff out, compile, and
7
- execute all scripts present in <code>text/coffeescript</code> tags.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">fs = </span><span class="nx">require</span> <span class="s1">&#39;fs&#39;</span>
8
- <span class="nv">path = </span><span class="nx">require</span> <span class="s1">&#39;path&#39;</span>
9
- <span class="p">{</span><span class="nx">Lexer</span><span class="p">,</span><span class="nx">RESERVED</span><span class="p">}</span> <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;./lexer&#39;</span>
10
- <span class="p">{</span><span class="nx">parser</span><span class="p">}</span> <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;./parser&#39;</span></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>TODO: Remove registerExtension when fully deprecated.</p> </td> <td class="code"> <div class="highlight"><pre><span class="k">if</span> <span class="nx">require</span><span class="p">.</span><span class="nx">extensions</span>
11
- <span class="nx">require</span><span class="p">.</span><span class="nx">extensions</span><span class="p">[</span><span class="s1">&#39;.coffee&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="p">(</span><span class="nx">module</span><span class="p">,</span> <span class="nx">filename</span><span class="p">)</span> <span class="o">-&gt;</span>
12
- <span class="nv">content = </span><span class="nx">compile</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">readFileSync</span> <span class="nx">filename</span><span class="p">,</span> <span class="s1">&#39;utf8&#39;</span>
13
- <span class="nx">module</span><span class="p">.</span><span class="nx">_compile</span> <span class="nx">content</span><span class="p">,</span> <span class="nx">filename</span>
14
- <span class="k">else</span> <span class="k">if</span> <span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span>
15
- <span class="nx">require</span><span class="p">.</span><span class="nx">registerExtension</span> <span class="s1">&#39;.coffee&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nx">content</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nx">compile</span> <span class="nx">content</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>The current CoffeeScript version number.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.VERSION = </span><span class="s1">&#39;1.0.0&#39;</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>Words that cannot be used as identifiers in CoffeeScript code</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.RESERVED = </span><span class="nx">RESERVED</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>Expose helpers for testing.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.helpers = </span><span class="nx">require</span> <span class="s1">&#39;./helpers&#39;</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>Compile a string of CoffeeScript code to JavaScript, using the Coffee/Jison
16
- compiler.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.compile = compile = </span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nv">options = </span><span class="p">{})</span> <span class="o">-&gt;</span>
17
- <span class="k">try</span>
18
- <span class="p">(</span><span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">code</span><span class="p">).</span><span class="nx">compile</span> <span class="nx">options</span>
19
- <span class="k">catch</span> <span class="nx">err</span>
20
- <span class="nv">err.message = </span><span class="s2">&quot;In #{options.fileName}, #{err.message}&quot;</span> <span class="k">if</span> <span class="nx">options</span><span class="p">.</span><span class="nx">fileName</span>
21
- <span class="k">throw</span> <span class="nx">err</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>Tokenize a string of CoffeeScript code, and return the array of tokens.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.tokens = </span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="o">-&gt;</span>
22
- <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">options</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Parse a string of CoffeeScript code or an array of lexed tokens, and
23
- return the AST. You can then compile it by calling <code>.compile()</code> on the root,
24
- or traverse it by using <code>.traverse()</code> with a callback.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.nodes = </span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="o">-&gt;</span>
25
- <span class="k">if</span> <span class="k">typeof</span> <span class="nx">source</span> <span class="o">is</span> <span class="s1">&#39;string&#39;</span>
26
- <span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">lexer</span><span class="p">.</span><span class="nx">tokenize</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">options</span>
27
- <span class="k">else</span>
28
- <span class="nx">parser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">source</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Compile and execute a string of CoffeeScript (on the server), correctly
29
- setting <code>__filename</code>, <code>__dirname</code>, and relative <code>require()</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.run = </span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="o">-&gt;</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>We want the root module.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">root = </span><span class="nx">module</span>
30
- <span class="k">while</span> <span class="nx">root</span><span class="p">.</span><span class="nx">parent</span>
31
- <span class="nv">root = </span><span class="nx">root</span><span class="p">.</span><span class="nx">parent</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>Set the filename.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">root.filename = </span><span class="nx">fs</span><span class="p">.</span><span class="nx">realpathSync</span> <span class="nx">options</span><span class="p">.</span><span class="nx">fileName</span> <span class="o">or</span> <span class="s1">&#39;.&#39;</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">&#182;</a> </div> <p>Clear the module cache.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="nv">root.moduleCache = </span><span class="p">{}</span> <span class="k">if</span> <span class="nx">root</span><span class="p">.</span><span class="nx">moduleCache</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">&#182;</a> </div> <p>Compile.</p> </td> <td class="code"> <div class="highlight"><pre> <span class="k">if</span> <span class="nx">path</span><span class="p">.</span><span class="nx">extname</span><span class="p">(</span><span class="nx">root</span><span class="p">.</span><span class="nx">filename</span><span class="p">)</span> <span class="o">isnt</span> <span class="s1">&#39;.coffee&#39;</span> <span class="o">or</span> <span class="nx">require</span><span class="p">.</span><span class="nx">extensions</span>
32
- <span class="nx">root</span><span class="p">.</span><span class="nx">_compile</span> <span class="nx">compile</span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">),</span> <span class="nx">root</span><span class="p">.</span><span class="nx">filename</span>
33
- <span class="k">else</span>
34
- <span class="nx">root</span><span class="p">.</span><span class="nx">_compile</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">root</span><span class="p">.</span><span class="nx">filename</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">&#182;</a> </div> <p>Compile and evaluate a string of CoffeeScript (in a Node.js-like environment).
35
- The CoffeeScript REPL uses this to run the input.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.eval = </span><span class="p">(</span><span class="nx">code</span><span class="p">,</span> <span class="nx">options</span><span class="p">)</span> <span class="o">-&gt;</span>
36
- <span class="nv">__filename = </span><span class="nx">options</span><span class="p">.</span><span class="nx">fileName</span>
37
- <span class="nv">__dirname = </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span> <span class="nx">__filename</span>
38
- <span class="nb">eval</span> <span class="nx">compile</span> <span class="nx">code</span><span class="p">,</span> <span class="nx">options</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-15">&#182;</a> </div> <p>Instantiate a Lexer for our use here.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">lexer = </span><span class="k">new</span> <span class="nx">Lexer</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16">&#182;</a> </div> <p>The real Lexer produces a generic stream of tokens. This object provides a
39
- thin wrapper around it, compatible with the Jison API. We can then pass it
40
- directly as a "Jison lexer".</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">parser.lexer =</span>
41
- <span class="nx">lex</span><span class="o">:</span> <span class="o">-&gt;</span>
42
- <span class="p">[</span><span class="nx">tag</span><span class="p">,</span> <span class="nx">@yytext</span><span class="p">,</span> <span class="nx">@yylineno</span><span class="p">]</span> <span class="o">=</span> <span class="nx">@tokens</span><span class="p">[</span><span class="nx">@pos</span><span class="o">++</span><span class="p">]</span> <span class="o">or</span> <span class="p">[</span><span class="s1">&#39;&#39;</span><span class="p">]</span>
43
- <span class="nx">tag</span>
44
- <span class="nx">setInput</span><span class="o">:</span> <span class="p">(</span><span class="nx">@tokens</span><span class="p">)</span> <span class="o">-&gt;</span>
45
- <span class="vi">@pos = </span><span class="mi">0</span>
46
- <span class="nx">upcomingInput</span><span class="o">:</span> <span class="o">-&gt;</span>
47
- <span class="s2">&quot;&quot;</span>
48
-
49
- <span class="nv">parser.yy = </span><span class="nx">require</span> <span class="s1">&#39;./nodes&#39;</span>
50
-
51
- </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,161 +0,0 @@
1
- <!DOCTYPE html> <html> <head> <title>command.coffee</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <link rel="stylesheet" media="all" href="docco.css" /> </head> <body> <div id="container"> <div id="background"></div> <div id="jump_to"> Jump To &hellip; <div id="jump_wrapper"> <div id="jump_page"> <a class="source" href="browser.html"> browser.coffee </a> <a class="source" href="cake.html"> cake.coffee </a> <a class="source" href="coffee-script.html"> coffee-script.coffee </a> <a class="source" href="command.html"> command.coffee </a> <a class="source" href="grammar.html"> grammar.coffee </a> <a class="source" href="helpers.html"> helpers.coffee </a> <a class="source" href="index.html"> index.coffee </a> <a class="source" href="lexer.html"> lexer.coffee </a> <a class="source" href="nodes.html"> nodes.coffee </a> <a class="source" href="optparse.html"> optparse.coffee </a> <a class="source" href="repl.html"> repl.coffee </a> <a class="source" href="rewriter.html"> rewriter.coffee </a> <a class="source" href="scope.html"> scope.coffee </a> </div> </div> </div> <table cellpadding="0" cellspacing="0"> <thead> <tr> <th class="docs"> <h1> command.coffee </h1> </th> <th class="code"> </th> </tr> </thead> <tbody> <tr id="section-1"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-1">&#182;</a> </div> <p>The <code>coffee</code> utility. Handles command-line compilation of CoffeeScript
2
- into various forms: saved into <code>.js</code> files or printed to stdout, piped to
3
- <a href="http://javascriptlint.com/">JSLint</a> or recompiled every time the source is
4
- saved, printed as a token stream or as the syntax tree, or launch an
5
- interactive REPL.</p> </td> <td class="code"> <div class="highlight"><pre></pre></div> </td> </tr> <tr id="section-2"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-2">&#182;</a> </div> <p>External dependencies.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">fs = </span><span class="nx">require</span> <span class="s1">&#39;fs&#39;</span>
6
- <span class="nv">path = </span><span class="nx">require</span> <span class="s1">&#39;path&#39;</span>
7
- <span class="nv">util = </span><span class="nx">require</span> <span class="s1">&#39;util&#39;</span>
8
- <span class="nv">helpers = </span><span class="nx">require</span> <span class="s1">&#39;./helpers&#39;</span>
9
- <span class="nv">optparse = </span><span class="nx">require</span> <span class="s1">&#39;./optparse&#39;</span>
10
- <span class="nv">CoffeeScript = </span><span class="nx">require</span> <span class="s1">&#39;./coffee-script&#39;</span>
11
- <span class="p">{</span><span class="nx">spawn</span><span class="p">,</span> <span class="nx">exec</span><span class="p">}</span> <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;child_process&#39;</span>
12
- <span class="p">{</span><span class="nx">EventEmitter</span><span class="p">}</span> <span class="o">=</span> <span class="nx">require</span> <span class="s1">&#39;events&#39;</span></pre></div> </td> </tr> <tr id="section-3"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-3">&#182;</a> </div> <p>Allow CoffeeScript to emit Node.js events.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nx">helpers</span><span class="p">.</span><span class="nx">extend</span> <span class="nx">CoffeeScript</span><span class="p">,</span> <span class="k">new</span> <span class="nx">EventEmitter</span>
13
-
14
- <span class="nv">printLine = </span><span class="p">(</span><span class="nx">line</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nx">process</span><span class="p">.</span><span class="nx">stdout</span><span class="p">.</span><span class="nx">write</span> <span class="nx">line</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span>
15
- <span class="nv">printWarn = </span><span class="p">(</span><span class="nx">line</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nx">process</span><span class="p">.</span><span class="nx">binding</span><span class="p">(</span><span class="s1">&#39;stdio&#39;</span><span class="p">).</span><span class="nx">writeError</span> <span class="nx">line</span> <span class="o">+</span> <span class="s1">&#39;\n&#39;</span></pre></div> </td> </tr> <tr id="section-4"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-4">&#182;</a> </div> <p>The help banner that is printed when <code>coffee</code> is called without arguments.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">BANNER = </span><span class="s1">&#39;&#39;&#39;</span>
16
- <span class="s1"> Usage: coffee [options] path/to/script.coffee</span>
17
- <span class="s1"> &#39;&#39;&#39;</span></pre></div> </td> </tr> <tr id="section-5"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-5">&#182;</a> </div> <p>The list of all the valid option flags that <code>coffee</code> knows how to handle.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">SWITCHES = </span><span class="p">[</span>
18
- <span class="p">[</span><span class="s1">&#39;-c&#39;</span><span class="p">,</span> <span class="s1">&#39;--compile&#39;</span><span class="p">,</span> <span class="s1">&#39;compile to JavaScript and save as .js files&#39;</span><span class="p">]</span>
19
- <span class="p">[</span><span class="s1">&#39;-i&#39;</span><span class="p">,</span> <span class="s1">&#39;--interactive&#39;</span><span class="p">,</span> <span class="s1">&#39;run an interactive CoffeeScript REPL&#39;</span><span class="p">]</span>
20
- <span class="p">[</span><span class="s1">&#39;-o&#39;</span><span class="p">,</span> <span class="s1">&#39;--output [DIR]&#39;</span><span class="p">,</span> <span class="s1">&#39;set the directory for compiled JavaScript&#39;</span><span class="p">]</span>
21
- <span class="p">[</span><span class="s1">&#39;-j&#39;</span><span class="p">,</span> <span class="s1">&#39;--join&#39;</span><span class="p">,</span> <span class="s1">&#39;concatenate the scripts before compiling&#39;</span><span class="p">]</span>
22
- <span class="p">[</span><span class="s1">&#39;-w&#39;</span><span class="p">,</span> <span class="s1">&#39;--watch&#39;</span><span class="p">,</span> <span class="s1">&#39;watch scripts for changes, and recompile&#39;</span><span class="p">]</span>
23
- <span class="p">[</span><span class="s1">&#39;-p&#39;</span><span class="p">,</span> <span class="s1">&#39;--print&#39;</span><span class="p">,</span> <span class="s1">&#39;print the compiled JavaScript to stdout&#39;</span><span class="p">]</span>
24
- <span class="p">[</span><span class="s1">&#39;-l&#39;</span><span class="p">,</span> <span class="s1">&#39;--lint&#39;</span><span class="p">,</span> <span class="s1">&#39;pipe the compiled JavaScript through JSLint&#39;</span><span class="p">]</span>
25
- <span class="p">[</span><span class="s1">&#39;-s&#39;</span><span class="p">,</span> <span class="s1">&#39;--stdio&#39;</span><span class="p">,</span> <span class="s1">&#39;listen for and compile scripts over stdio&#39;</span><span class="p">]</span>
26
- <span class="p">[</span><span class="s1">&#39;-e&#39;</span><span class="p">,</span> <span class="s1">&#39;--eval&#39;</span><span class="p">,</span> <span class="s1">&#39;compile a string from the command line&#39;</span><span class="p">]</span>
27
- <span class="p">[</span><span class="s1">&#39;-r&#39;</span><span class="p">,</span> <span class="s1">&#39;--require [FILE*]&#39;</span><span class="p">,</span> <span class="s1">&#39;require a library before executing your script&#39;</span><span class="p">]</span>
28
- <span class="p">[</span><span class="s1">&#39;-b&#39;</span><span class="p">,</span> <span class="s1">&#39;--bare&#39;</span><span class="p">,</span> <span class="s1">&#39;compile without the top-level function wrapper&#39;</span><span class="p">]</span>
29
- <span class="p">[</span><span class="s1">&#39;-t&#39;</span><span class="p">,</span> <span class="s1">&#39;--tokens&#39;</span><span class="p">,</span> <span class="s1">&#39;print the tokens that the lexer produces&#39;</span><span class="p">]</span>
30
- <span class="p">[</span><span class="s1">&#39;-n&#39;</span><span class="p">,</span> <span class="s1">&#39;--nodes&#39;</span><span class="p">,</span> <span class="s1">&#39;print the parse tree that Jison produces&#39;</span><span class="p">]</span>
31
- <span class="p">[</span> <span class="s1">&#39;--nodejs [ARGS]&#39;</span><span class="p">,</span> <span class="s1">&#39;pass options through to the &quot;node&quot; binary&#39;</span><span class="p">]</span>
32
- <span class="p">[</span><span class="s1">&#39;-v&#39;</span><span class="p">,</span> <span class="s1">&#39;--version&#39;</span><span class="p">,</span> <span class="s1">&#39;display CoffeeScript version&#39;</span><span class="p">]</span>
33
- <span class="p">[</span><span class="s1">&#39;-h&#39;</span><span class="p">,</span> <span class="s1">&#39;--help&#39;</span><span class="p">,</span> <span class="s1">&#39;display this help message&#39;</span><span class="p">]</span>
34
- <span class="p">]</span></pre></div> </td> </tr> <tr id="section-6"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-6">&#182;</a> </div> <p>Top-level objects shared by all the functions.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">opts = </span><span class="p">{}</span>
35
- <span class="nv">sources = </span><span class="p">[]</span>
36
- <span class="nv">contents = </span><span class="p">[]</span>
37
- <span class="nv">optionParser = </span><span class="kc">null</span></pre></div> </td> </tr> <tr id="section-7"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-7">&#182;</a> </div> <p>Run <code>coffee</code> by parsing passed options and determining what action to take.
38
- Many flags cause us to divert before compiling anything. Flags passed after
39
- <code>--</code> will be passed verbatim to your script as arguments in <code>process.argv</code></p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">exports.run = </span><span class="o">-&gt;</span>
40
- <span class="nx">parseOptions</span><span class="p">()</span>
41
- <span class="k">return</span> <span class="nx">forkNode</span><span class="p">()</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">nodejs</span>
42
- <span class="k">return</span> <span class="nx">usage</span><span class="p">()</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">help</span>
43
- <span class="k">return</span> <span class="nx">version</span><span class="p">()</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">version</span>
44
- <span class="k">return</span> <span class="nx">require</span> <span class="s1">&#39;./repl&#39;</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">interactive</span>
45
- <span class="k">return</span> <span class="nx">compileStdio</span><span class="p">()</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">stdio</span>
46
- <span class="k">return</span> <span class="nx">compileScript</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">sources</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nb">eval</span>
47
- <span class="k">return</span> <span class="nx">require</span> <span class="s1">&#39;./repl&#39;</span> <span class="nx">unless</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">length</span>
48
- <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">run</span>
49
- <span class="nv">opts.literals = </span><span class="nx">sources</span><span class="p">.</span><span class="nx">splice</span><span class="p">(</span><span class="mi">1</span><span class="p">).</span><span class="nx">concat</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">literals</span>
50
- <span class="nv">process.ARGV = process.argv = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">slice</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">).</span><span class="nx">concat</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">literals</span>
51
- <span class="nx">compileScripts</span><span class="p">()</span></pre></div> </td> </tr> <tr id="section-8"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-8">&#182;</a> </div> <p>Asynchronously read in each CoffeeScript in a list of source files and
52
- compile them. If a directory is passed, recursively compile all
53
- '.coffee' extension source files in it and all subdirectories.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">compileScripts = </span><span class="o">-&gt;</span>
54
- <span class="k">for</span> <span class="nx">source</span> <span class="k">in</span> <span class="nx">sources</span>
55
- <span class="nv">base = </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">source</span><span class="p">)</span>
56
- <span class="nv">compile = </span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">topLevel</span><span class="p">)</span> <span class="o">-&gt;</span>
57
- <span class="nx">path</span><span class="p">.</span><span class="nx">exists</span> <span class="nx">source</span><span class="p">,</span> <span class="p">(</span><span class="nx">exists</span><span class="p">)</span> <span class="o">-&gt;</span>
58
- <span class="k">throw</span> <span class="k">new</span> <span class="nb">Error</span> <span class="s2">&quot;File not found: #{source}&quot;</span> <span class="nx">unless</span> <span class="nx">exists</span>
59
- <span class="nx">fs</span><span class="p">.</span><span class="nx">stat</span> <span class="nx">source</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">stats</span><span class="p">)</span> <span class="o">-&gt;</span>
60
- <span class="k">if</span> <span class="nx">stats</span><span class="p">.</span><span class="nx">isDirectory</span><span class="p">()</span>
61
- <span class="nx">fs</span><span class="p">.</span><span class="nx">readdir</span> <span class="nx">source</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">files</span><span class="p">)</span> <span class="o">-&gt;</span>
62
- <span class="k">for</span> <span class="nx">file</span> <span class="k">in</span> <span class="nx">files</span>
63
- <span class="nx">compile</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">file</span><span class="p">)</span>
64
- <span class="k">else</span> <span class="k">if</span> <span class="nx">topLevel</span> <span class="o">or</span> <span class="nx">path</span><span class="p">.</span><span class="nx">extname</span><span class="p">(</span><span class="nx">source</span><span class="p">)</span> <span class="o">is</span> <span class="s1">&#39;.coffee&#39;</span>
65
- <span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span> <span class="nx">source</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">code</span><span class="p">)</span> <span class="o">-&gt;</span>
66
- <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">join</span>
67
- <span class="nx">contents</span><span class="p">[</span><span class="nx">sources</span><span class="p">.</span><span class="nx">indexOf</span> <span class="nx">source</span><span class="p">]</span> <span class="o">=</span> <span class="nx">code</span><span class="p">.</span><span class="nx">toString</span><span class="p">()</span>
68
- <span class="nx">compileJoin</span><span class="p">()</span> <span class="k">if</span> <span class="nx">helpers</span><span class="p">.</span><span class="nx">compact</span><span class="p">(</span><span class="nx">contents</span><span class="p">).</span><span class="nx">length</span> <span class="o">is</span> <span class="nx">sources</span><span class="p">.</span><span class="nx">length</span>
69
- <span class="k">else</span>
70
- <span class="nx">compileScript</span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">code</span><span class="p">.</span><span class="nx">toString</span><span class="p">(),</span> <span class="nx">base</span><span class="p">)</span>
71
- <span class="nx">watch</span> <span class="nx">source</span><span class="p">,</span> <span class="nx">base</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">watch</span> <span class="o">and</span> <span class="o">not</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">join</span>
72
- <span class="nx">compile</span> <span class="nx">source</span><span class="p">,</span> <span class="kc">true</span></pre></div> </td> </tr> <tr id="section-9"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-9">&#182;</a> </div> <p>Compile a single source script, containing the given code, according to the
73
- requested options. If evaluating the script directly sets <code>__filename</code>,
74
- <code>__dirname</code> and <code>module.filename</code> to be correct relative to the script's path.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">compileScript = </span><span class="p">(</span><span class="nx">file</span><span class="p">,</span> <span class="nx">input</span><span class="p">,</span> <span class="nx">base</span><span class="p">)</span> <span class="o">-&gt;</span>
75
- <span class="nv">o = </span><span class="nx">opts</span>
76
- <span class="nv">options = </span><span class="nx">compileOptions</span> <span class="nx">file</span>
77
- <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">require</span>
78
- <span class="nx">require</span><span class="p">(</span><span class="k">if</span> <span class="nx">helpers</span><span class="p">.</span><span class="nx">starts</span><span class="p">(</span><span class="nx">req</span><span class="p">,</span> <span class="s1">&#39;.&#39;</span><span class="p">)</span> <span class="k">then</span> <span class="nx">fs</span><span class="p">.</span><span class="nx">realpathSync</span><span class="p">(</span><span class="nx">req</span><span class="p">)</span> <span class="k">else</span> <span class="nx">req</span><span class="p">)</span> <span class="k">for</span> <span class="nx">req</span> <span class="k">in</span> <span class="nx">o</span><span class="p">.</span><span class="nx">require</span>
79
- <span class="k">try</span>
80
- <span class="nv">t = task = </span><span class="p">{</span><span class="nx">file</span><span class="p">,</span> <span class="nx">input</span><span class="p">,</span> <span class="nx">options</span><span class="p">}</span>
81
- <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">emit</span> <span class="s1">&#39;compile&#39;</span><span class="p">,</span> <span class="nx">task</span>
82
- <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">tokens</span> <span class="k">then</span> <span class="nx">printTokens</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">tokens</span> <span class="nx">t</span><span class="p">.</span><span class="nx">input</span>
83
- <span class="k">else</span> <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">nodes</span> <span class="k">then</span> <span class="nx">printLine</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">nodes</span><span class="p">(</span><span class="nx">t</span><span class="p">.</span><span class="nx">input</span><span class="p">).</span><span class="nx">toString</span><span class="p">().</span><span class="nx">trim</span><span class="p">()</span>
84
- <span class="k">else</span> <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">run</span> <span class="k">then</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">run</span> <span class="nx">t</span><span class="p">.</span><span class="nx">input</span><span class="p">,</span> <span class="nx">t</span><span class="p">.</span><span class="nx">options</span>
85
- <span class="k">else</span>
86
- <span class="nv">t.output = </span><span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">compile</span> <span class="nx">t</span><span class="p">.</span><span class="nx">input</span><span class="p">,</span> <span class="nx">t</span><span class="p">.</span><span class="nx">options</span>
87
- <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">emit</span> <span class="s1">&#39;success&#39;</span><span class="p">,</span> <span class="nx">task</span>
88
- <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">print</span> <span class="k">then</span> <span class="nx">printLine</span> <span class="nx">t</span><span class="p">.</span><span class="nx">output</span><span class="p">.</span><span class="nx">trim</span><span class="p">()</span>
89
- <span class="k">else</span> <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">compile</span> <span class="k">then</span> <span class="nx">writeJs</span> <span class="nx">t</span><span class="p">.</span><span class="nx">file</span><span class="p">,</span> <span class="nx">t</span><span class="p">.</span><span class="nx">output</span><span class="p">,</span> <span class="nx">base</span>
90
- <span class="k">else</span> <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">lint</span> <span class="k">then</span> <span class="nx">lint</span> <span class="nx">t</span><span class="p">.</span><span class="nx">file</span><span class="p">,</span> <span class="nx">t</span><span class="p">.</span><span class="nx">output</span>
91
- <span class="k">catch</span> <span class="nx">err</span>
92
- <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">emit</span> <span class="s1">&#39;failure&#39;</span><span class="p">,</span> <span class="nx">err</span><span class="p">,</span> <span class="nx">task</span>
93
- <span class="k">return</span> <span class="k">if</span> <span class="nx">CoffeeScript</span><span class="p">.</span><span class="nx">listeners</span><span class="p">(</span><span class="s1">&#39;failure&#39;</span><span class="p">).</span><span class="nx">length</span>
94
- <span class="k">return</span> <span class="nx">printLine</span> <span class="nx">err</span><span class="p">.</span><span class="nx">message</span> <span class="k">if</span> <span class="nx">o</span><span class="p">.</span><span class="nx">watch</span>
95
- <span class="nx">printWarn</span> <span class="nx">err</span><span class="p">.</span><span class="nx">stack</span>
96
- <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">1</span></pre></div> </td> </tr> <tr id="section-10"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-10">&#182;</a> </div> <p>Attach the appropriate listeners to compile scripts incoming over <strong>stdin</strong>,
97
- and write them back to <strong>stdout</strong>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">compileStdio = </span><span class="o">-&gt;</span>
98
- <span class="nv">code = </span><span class="s1">&#39;&#39;</span>
99
- <span class="nv">stdin = </span><span class="nx">process</span><span class="p">.</span><span class="nx">openStdin</span><span class="p">()</span>
100
- <span class="nx">stdin</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="p">(</span><span class="nx">buffer</span><span class="p">)</span> <span class="o">-&gt;</span>
101
- <span class="nx">code</span> <span class="o">+=</span> <span class="nx">buffer</span><span class="p">.</span><span class="nx">toString</span><span class="p">()</span> <span class="k">if</span> <span class="nx">buffer</span>
102
- <span class="nx">stdin</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;end&#39;</span><span class="p">,</span> <span class="o">-&gt;</span>
103
- <span class="nx">compileScript</span> <span class="kc">null</span><span class="p">,</span> <span class="nx">code</span></pre></div> </td> </tr> <tr id="section-11"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-11">&#182;</a> </div> <p>After all of the source files are done being read, concatenate and compile
104
- them together.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">compileJoin = </span><span class="o">-&gt;</span>
105
- <span class="nv">code = </span><span class="nx">contents</span><span class="p">.</span><span class="nx">join</span> <span class="s1">&#39;\n&#39;</span>
106
- <span class="nx">compileScript</span> <span class="s2">&quot;concatenation&quot;</span><span class="p">,</span> <span class="nx">code</span><span class="p">,</span> <span class="s2">&quot;concatenation&quot;</span></pre></div> </td> </tr> <tr id="section-12"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-12">&#182;</a> </div> <p>Watch a source CoffeeScript file using <code>fs.watchFile</code>, recompiling it every
107
- time the file is updated. May be used in combination with other options,
108
- such as <code>--lint</code> or <code>--print</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">watch = </span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">base</span><span class="p">)</span> <span class="o">-&gt;</span>
109
- <span class="nx">fs</span><span class="p">.</span><span class="nx">watchFile</span> <span class="nx">source</span><span class="p">,</span> <span class="p">{</span><span class="nx">persistent</span><span class="o">:</span> <span class="kc">true</span><span class="p">,</span> <span class="nx">interval</span><span class="o">:</span> <span class="mi">500</span><span class="p">},</span> <span class="p">(</span><span class="nx">curr</span><span class="p">,</span> <span class="nx">prev</span><span class="p">)</span> <span class="o">-&gt;</span>
110
- <span class="k">return</span> <span class="k">if</span> <span class="nx">curr</span><span class="p">.</span><span class="nx">size</span> <span class="o">is</span> <span class="nx">prev</span><span class="p">.</span><span class="nx">size</span> <span class="o">and</span> <span class="nx">curr</span><span class="p">.</span><span class="nx">mtime</span><span class="p">.</span><span class="nx">getTime</span><span class="p">()</span> <span class="o">is</span> <span class="nx">prev</span><span class="p">.</span><span class="nx">mtime</span><span class="p">.</span><span class="nx">getTime</span><span class="p">()</span>
111
- <span class="nx">fs</span><span class="p">.</span><span class="nx">readFile</span> <span class="nx">source</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">,</span> <span class="nx">code</span><span class="p">)</span> <span class="o">-&gt;</span>
112
- <span class="k">throw</span> <span class="nx">err</span> <span class="k">if</span> <span class="nx">err</span>
113
- <span class="nx">compileScript</span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">code</span><span class="p">.</span><span class="nx">toString</span><span class="p">(),</span> <span class="nx">base</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-13"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-13">&#182;</a> </div> <p>Write out a JavaScript source file with the compiled code. By default, files
114
- are written out in <code>cwd</code> as <code>.js</code> files with the same name, but the output
115
- directory can be customized with <code>--output</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">writeJs = </span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">js</span><span class="p">,</span> <span class="nx">base</span><span class="p">)</span> <span class="o">-&gt;</span>
116
- <span class="nv">filename = </span><span class="nx">path</span><span class="p">.</span><span class="nx">basename</span><span class="p">(</span><span class="nx">source</span><span class="p">,</span> <span class="nx">path</span><span class="p">.</span><span class="nx">extname</span><span class="p">(</span><span class="nx">source</span><span class="p">))</span> <span class="o">+</span> <span class="s1">&#39;.js&#39;</span>
117
- <span class="nv">srcDir = </span><span class="nx">path</span><span class="p">.</span><span class="nx">dirname</span> <span class="nx">source</span>
118
- <span class="nv">baseDir = </span><span class="k">if</span> <span class="nx">base</span> <span class="o">is</span> <span class="s1">&#39;.&#39;</span> <span class="k">then</span> <span class="nx">srcDir</span> <span class="k">else</span> <span class="nx">srcDir</span><span class="p">.</span><span class="nx">substring</span> <span class="nx">base</span><span class="p">.</span><span class="nx">length</span>
119
- <span class="nv">dir = </span><span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">output</span> <span class="k">then</span> <span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">output</span><span class="p">,</span> <span class="nx">baseDir</span> <span class="k">else</span> <span class="nx">srcDir</span>
120
- <span class="nv">jsPath = </span><span class="nx">path</span><span class="p">.</span><span class="nx">join</span> <span class="nx">dir</span><span class="p">,</span> <span class="nx">filename</span>
121
- <span class="nv">compile = </span><span class="o">-&gt;</span>
122
- <span class="nv">js = </span><span class="s1">&#39; &#39;</span> <span class="k">if</span> <span class="nx">js</span><span class="p">.</span><span class="nx">length</span> <span class="o">&lt;=</span> <span class="mi">0</span>
123
- <span class="nx">fs</span><span class="p">.</span><span class="nx">writeFile</span> <span class="nx">jsPath</span><span class="p">,</span> <span class="nx">js</span><span class="p">,</span> <span class="p">(</span><span class="nx">err</span><span class="p">)</span> <span class="o">-&gt;</span>
124
- <span class="k">if</span> <span class="nx">err</span> <span class="k">then</span> <span class="nx">printLine</span> <span class="nx">err</span><span class="p">.</span><span class="nx">message</span>
125
- <span class="k">else</span> <span class="k">if</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">compile</span> <span class="o">and</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">watch</span> <span class="k">then</span> <span class="nx">util</span><span class="p">.</span><span class="nx">log</span> <span class="s2">&quot;compiled #{source}&quot;</span>
126
- <span class="nx">path</span><span class="p">.</span><span class="nx">exists</span> <span class="nx">dir</span><span class="p">,</span> <span class="p">(</span><span class="nx">exists</span><span class="p">)</span> <span class="o">-&gt;</span>
127
- <span class="k">if</span> <span class="nx">exists</span> <span class="k">then</span> <span class="nx">compile</span><span class="p">()</span> <span class="k">else</span> <span class="nx">exec</span> <span class="s2">&quot;mkdir -p #{dir}&quot;</span><span class="p">,</span> <span class="nx">compile</span></pre></div> </td> </tr> <tr id="section-14"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-14">&#182;</a> </div> <p>Pipe compiled JS through JSLint (requires a working <code>jsl</code> command), printing
128
- any errors or warnings that arise.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">lint = </span><span class="p">(</span><span class="nx">file</span><span class="p">,</span> <span class="nx">js</span><span class="p">)</span> <span class="o">-&gt;</span>
129
- <span class="nv">printIt = </span><span class="p">(</span><span class="nx">buffer</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nx">printLine</span> <span class="nx">file</span> <span class="o">+</span> <span class="s1">&#39;:\t&#39;</span> <span class="o">+</span> <span class="nx">buffer</span><span class="p">.</span><span class="nx">toString</span><span class="p">().</span><span class="nx">trim</span><span class="p">()</span>
130
- <span class="nv">conf = </span><span class="nx">__dirname</span> <span class="o">+</span> <span class="s1">&#39;/../extras/jsl.conf&#39;</span>
131
- <span class="nv">jsl = </span><span class="nx">spawn</span> <span class="s1">&#39;jsl&#39;</span><span class="p">,</span> <span class="p">[</span><span class="s1">&#39;-nologo&#39;</span><span class="p">,</span> <span class="s1">&#39;-stdin&#39;</span><span class="p">,</span> <span class="s1">&#39;-conf&#39;</span><span class="p">,</span> <span class="nx">conf</span><span class="p">]</span>
132
- <span class="nx">jsl</span><span class="p">.</span><span class="nx">stdout</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="nx">printIt</span>
133
- <span class="nx">jsl</span><span class="p">.</span><span class="nx">stderr</span><span class="p">.</span><span class="kc">on</span> <span class="s1">&#39;data&#39;</span><span class="p">,</span> <span class="nx">printIt</span>
134
- <span class="nx">jsl</span><span class="p">.</span><span class="nx">stdin</span><span class="p">.</span><span class="nx">write</span> <span class="nx">js</span>
135
- <span class="nx">jsl</span><span class="p">.</span><span class="nx">stdin</span><span class="p">.</span><span class="nx">end</span><span class="p">()</span></pre></div> </td> </tr> <tr id="section-15"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-15">&#182;</a> </div> <p>Pretty-print a stream of tokens.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">printTokens = </span><span class="p">(</span><span class="nx">tokens</span><span class="p">)</span> <span class="o">-&gt;</span>
136
- <span class="nv">strings = </span><span class="k">for</span> <span class="nx">token</span> <span class="k">in</span> <span class="nx">tokens</span>
137
- <span class="p">[</span><span class="nx">tag</span><span class="p">,</span> <span class="nx">value</span><span class="p">]</span> <span class="o">=</span> <span class="p">[</span><span class="nx">token</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="nx">token</span><span class="p">[</span><span class="mi">1</span><span class="p">].</span><span class="nx">toString</span><span class="p">().</span><span class="nx">replace</span><span class="p">(</span><span class="sr">/\n/</span><span class="p">,</span> <span class="s1">&#39;\\n&#39;</span><span class="p">)]</span>
138
- <span class="s2">&quot;[#{tag} #{value}]&quot;</span>
139
- <span class="nx">printLine</span> <span class="nx">strings</span><span class="p">.</span><span class="nx">join</span><span class="p">(</span><span class="s1">&#39; &#39;</span><span class="p">)</span></pre></div> </td> </tr> <tr id="section-16"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-16">&#182;</a> </div> <p>Use the <a href="optparse.html">OptionParser module</a> to extract all options from
140
- <code>process.argv</code> that are specified in <code>SWITCHES</code>.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">parseOptions = </span><span class="o">-&gt;</span>
141
- <span class="nv">optionParser = </span><span class="k">new</span> <span class="nx">optparse</span><span class="p">.</span><span class="nx">OptionParser</span> <span class="nx">SWITCHES</span><span class="p">,</span> <span class="nx">BANNER</span>
142
- <span class="nv">o = opts = </span><span class="nx">optionParser</span><span class="p">.</span><span class="nx">parse</span> <span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">.</span><span class="nx">slice</span> <span class="mi">2</span>
143
- <span class="nx">o</span><span class="p">.</span><span class="nx">compile</span> <span class="o">or=</span> <span class="o">!!</span><span class="nx">o</span><span class="p">.</span><span class="nx">output</span>
144
- <span class="nv">o.run = </span><span class="o">not</span> <span class="p">(</span><span class="nx">o</span><span class="p">.</span><span class="nx">compile</span> <span class="o">or</span> <span class="nx">o</span><span class="p">.</span><span class="nx">print</span> <span class="o">or</span> <span class="nx">o</span><span class="p">.</span><span class="nx">lint</span><span class="p">)</span>
145
- <span class="nv">o.print = </span><span class="o">!!</span> <span class="p">(</span><span class="nx">o</span><span class="p">.</span><span class="nx">print</span> <span class="o">or</span> <span class="p">(</span><span class="nx">o</span><span class="p">.</span><span class="nb">eval</span> <span class="o">or</span> <span class="nx">o</span><span class="p">.</span><span class="nx">stdio</span> <span class="o">and</span> <span class="nx">o</span><span class="p">.</span><span class="nx">compile</span><span class="p">))</span>
146
- <span class="nv">sources = </span><span class="nx">o</span><span class="p">.</span><span class="nx">arguments</span></pre></div> </td> </tr> <tr id="section-17"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-17">&#182;</a> </div> <p>The compile-time options to pass to the CoffeeScript compiler.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">compileOptions = </span><span class="p">(</span><span class="nx">fileName</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="p">{</span><span class="nx">fileName</span><span class="p">,</span> <span class="nx">bare</span><span class="o">:</span> <span class="nx">opts</span><span class="p">.</span><span class="nx">bare</span><span class="p">}</span></pre></div> </td> </tr> <tr id="section-18"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-18">&#182;</a> </div> <p>Start up a new Node.js instance with the arguments in <code>--nodejs</code> passed to
147
- the <code>node</code> binary, preserving the other options.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">forkNode = </span><span class="o">-&gt;</span>
148
- <span class="nv">nodeArgs = </span><span class="nx">opts</span><span class="p">.</span><span class="nx">nodejs</span><span class="p">.</span><span class="nx">split</span> <span class="sr">/\s+/</span>
149
- <span class="nv">args = </span><span class="nx">process</span><span class="p">.</span><span class="nx">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">..]</span>
150
- <span class="nx">args</span><span class="p">.</span><span class="nx">splice</span> <span class="nx">args</span><span class="p">.</span><span class="nx">indexOf</span><span class="p">(</span><span class="s1">&#39;--nodejs&#39;</span><span class="p">),</span> <span class="mi">2</span>
151
- <span class="nx">spawn</span> <span class="nx">process</span><span class="p">.</span><span class="nx">execPath</span><span class="p">,</span> <span class="nx">nodeArgs</span><span class="p">.</span><span class="nx">concat</span><span class="p">(</span><span class="nx">args</span><span class="p">),</span>
152
- <span class="nx">cwd</span><span class="o">:</span> <span class="nx">process</span><span class="p">.</span><span class="nx">cwd</span><span class="p">()</span>
153
- <span class="nx">env</span><span class="o">:</span> <span class="nx">process</span><span class="p">.</span><span class="nx">env</span>
154
- <span class="nx">customFds</span><span class="o">:</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">2</span><span class="p">]</span></pre></div> </td> </tr> <tr id="section-19"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-19">&#182;</a> </div> <p>Print the <code>--help</code> usage message and exit. Deprecated switches are not
155
- shown.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">usage = </span><span class="o">-&gt;</span>
156
- <span class="nx">printLine</span> <span class="p">(</span><span class="k">new</span> <span class="nx">optparse</span><span class="p">.</span><span class="nx">OptionParser</span> <span class="nx">SWITCHES</span><span class="p">,</span> <span class="nx">BANNER</span><span class="p">).</span><span class="nx">help</span><span class="p">()</span>
157
- <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">0</span></pre></div> </td> </tr> <tr id="section-20"> <td class="docs"> <div class="pilwrap"> <a class="pilcrow" href="#section-20">&#182;</a> </div> <p>Print the <code>--version</code> message and exit.</p> </td> <td class="code"> <div class="highlight"><pre><span class="nv">version = </span><span class="o">-&gt;</span>
158
- <span class="nx">printLine</span> <span class="s2">&quot;CoffeeScript version #{CoffeeScript.VERSION}&quot;</span>
159
- <span class="nx">process</span><span class="p">.</span><span class="nx">exit</span> <span class="mi">0</span>
160
-
161
- </pre></div> </td> </tr> </tbody> </table> </div> </body> </html>
@@ -1,186 +0,0 @@
1
- /*--------------------- Layout and Typography ----------------------------*/
2
- body {
3
- font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif;
4
- font-size: 15px;
5
- line-height: 22px;
6
- color: #252519;
7
- margin: 0; padding: 0;
8
- }
9
- a {
10
- color: #261a3b;
11
- }
12
- a:visited {
13
- color: #261a3b;
14
- }
15
- p {
16
- margin: 0 0 15px 0;
17
- }
18
- h1, h2, h3, h4, h5, h6 {
19
- margin: 0px 0 15px 0;
20
- }
21
- h1 {
22
- margin-top: 40px;
23
- }
24
- #container {
25
- position: relative;
26
- }
27
- #background {
28
- position: fixed;
29
- top: 0; left: 525px; right: 0; bottom: 0;
30
- background: #f5f5ff;
31
- border-left: 1px solid #e5e5ee;
32
- z-index: -1;
33
- }
34
- #jump_to, #jump_page {
35
- background: white;
36
- -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777;
37
- -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px;
38
- font: 10px Arial;
39
- text-transform: uppercase;
40
- cursor: pointer;
41
- text-align: right;
42
- }
43
- #jump_to, #jump_wrapper {
44
- position: fixed;
45
- right: 0; top: 0;
46
- padding: 5px 10px;
47
- }
48
- #jump_wrapper {
49
- padding: 0;
50
- display: none;
51
- }
52
- #jump_to:hover #jump_wrapper {
53
- display: block;
54
- }
55
- #jump_page {
56
- padding: 5px 0 3px;
57
- margin: 0 0 25px 25px;
58
- }
59
- #jump_page .source {
60
- display: block;
61
- padding: 5px 10px;
62
- text-decoration: none;
63
- border-top: 1px solid #eee;
64
- }
65
- #jump_page .source:hover {
66
- background: #f5f5ff;
67
- }
68
- #jump_page .source:first-child {
69
- }
70
- table td {
71
- border: 0;
72
- outline: 0;
73
- }
74
- td.docs, th.docs {
75
- max-width: 450px;
76
- min-width: 450px;
77
- min-height: 5px;
78
- padding: 10px 25px 1px 50px;
79
- overflow-x: hidden;
80
- vertical-align: top;
81
- text-align: left;
82
- }
83
- .docs pre {
84
- margin: 15px 0 15px;
85
- padding-left: 15px;
86
- }
87
- .docs p tt, .docs p code {
88
- background: #f8f8ff;
89
- border: 1px solid #dedede;
90
- font-size: 12px;
91
- padding: 0 0.2em;
92
- }
93
- .pilwrap {
94
- position: relative;
95
- }
96
- .pilcrow {
97
- font: 12px Arial;
98
- text-decoration: none;
99
- color: #454545;
100
- position: absolute;
101
- top: 3px; left: -20px;
102
- padding: 1px 2px;
103
- opacity: 0;
104
- -webkit-transition: opacity 0.2s linear;
105
- }
106
- td.docs:hover .pilcrow {
107
- opacity: 1;
108
- }
109
- td.code, th.code {
110
- padding: 14px 15px 16px 25px;
111
- width: 100%;
112
- vertical-align: top;
113
- background: #f5f5ff;
114
- border-left: 1px solid #e5e5ee;
115
- }
116
- pre, tt, code {
117
- font-size: 12px; line-height: 18px;
118
- font-family: Monaco, Consolas, "Lucida Console", monospace;
119
- margin: 0; padding: 0;
120
- }
121
-
122
-
123
- /*---------------------- Syntax Highlighting -----------------------------*/
124
- td.linenos { background-color: #f0f0f0; padding-right: 10px; }
125
- span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; }
126
- body .hll { background-color: #ffffcc }
127
- body .c { color: #408080; font-style: italic } /* Comment */
128
- body .err { border: 1px solid #FF0000 } /* Error */
129
- body .k { color: #954121 } /* Keyword */
130
- body .o { color: #666666 } /* Operator */
131
- body .cm { color: #408080; font-style: italic } /* Comment.Multiline */
132
- body .cp { color: #BC7A00 } /* Comment.Preproc */
133
- body .c1 { color: #408080; font-style: italic } /* Comment.Single */
134
- body .cs { color: #408080; font-style: italic } /* Comment.Special */
135
- body .gd { color: #A00000 } /* Generic.Deleted */
136
- body .ge { font-style: italic } /* Generic.Emph */
137
- body .gr { color: #FF0000 } /* Generic.Error */
138
- body .gh { color: #000080; font-weight: bold } /* Generic.Heading */
139
- body .gi { color: #00A000 } /* Generic.Inserted */
140
- body .go { color: #808080 } /* Generic.Output */
141
- body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
142
- body .gs { font-weight: bold } /* Generic.Strong */
143
- body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
144
- body .gt { color: #0040D0 } /* Generic.Traceback */
145
- body .kc { color: #954121 } /* Keyword.Constant */
146
- body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */
147
- body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */
148
- body .kp { color: #954121 } /* Keyword.Pseudo */
149
- body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */
150
- body .kt { color: #B00040 } /* Keyword.Type */
151
- body .m { color: #666666 } /* Literal.Number */
152
- body .s { color: #219161 } /* Literal.String */
153
- body .na { color: #7D9029 } /* Name.Attribute */
154
- body .nb { color: #954121 } /* Name.Builtin */
155
- body .nc { color: #0000FF; font-weight: bold } /* Name.Class */
156
- body .no { color: #880000 } /* Name.Constant */
157
- body .nd { color: #AA22FF } /* Name.Decorator */
158
- body .ni { color: #999999; font-weight: bold } /* Name.Entity */
159
- body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
160
- body .nf { color: #0000FF } /* Name.Function */
161
- body .nl { color: #A0A000 } /* Name.Label */
162
- body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
163
- body .nt { color: #954121; font-weight: bold } /* Name.Tag */
164
- body .nv { color: #19469D } /* Name.Variable */
165
- body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
166
- body .w { color: #bbbbbb } /* Text.Whitespace */
167
- body .mf { color: #666666 } /* Literal.Number.Float */
168
- body .mh { color: #666666 } /* Literal.Number.Hex */
169
- body .mi { color: #666666 } /* Literal.Number.Integer */
170
- body .mo { color: #666666 } /* Literal.Number.Oct */
171
- body .sb { color: #219161 } /* Literal.String.Backtick */
172
- body .sc { color: #219161 } /* Literal.String.Char */
173
- body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */
174
- body .s2 { color: #219161 } /* Literal.String.Double */
175
- body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
176
- body .sh { color: #219161 } /* Literal.String.Heredoc */
177
- body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
178
- body .sx { color: #954121 } /* Literal.String.Other */
179
- body .sr { color: #BB6688 } /* Literal.String.Regex */
180
- body .s1 { color: #219161 } /* Literal.String.Single */
181
- body .ss { color: #19469D } /* Literal.String.Symbol */
182
- body .bp { color: #954121 } /* Name.Builtin.Pseudo */
183
- body .vc { color: #19469D } /* Name.Variable.Class */
184
- body .vg { color: #19469D } /* Name.Variable.Global */
185
- body .vi { color: #19469D } /* Name.Variable.Instance */
186
- body .il { color: #666666 } /* Literal.Number.Integer.Long */