opal 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (255) hide show
  1. data/.gitignore +0 -0
  2. data/.gitmodules +6 -0
  3. data/Opalfile +14 -1
  4. data/README.md +3 -44
  5. data/Rakefile +39 -131
  6. data/VERSION +1 -1
  7. data/extras/compiler.jar +0 -0
  8. data/gen/browser/__PROJECT_NAME__/Rakefile +12 -0
  9. data/gen/browser/__PROJECT_NAME__/index.html +1 -0
  10. data/gen/browser/__PROJECT_NAME__/javascripts/opal.debug.js +4687 -0
  11. data/gen/browser/__PROJECT_NAME__/javascripts/opal.min.js +175 -0
  12. data/lib/opal.rb +1 -0
  13. data/lib/opal/models/project.rb +45 -8
  14. data/lib/opal/opal/build.rb +169 -0
  15. data/lib/opal/opal/env/fs.rb +1 -1
  16. data/lib/opal/opal/environment.rb +2 -2
  17. data/lib/opal/opal/opal.rb +10 -3
  18. data/lib/opal/rake/opal_task.rb +34 -0
  19. data/opal.gemspec +260 -0
  20. data/opals/opal/README.md +37 -0
  21. data/opals/opal/Rakefile +1 -0
  22. data/opals/{browser → opal/browser}/Opalfile +0 -0
  23. data/opals/{browser → opal/browser}/README.md +0 -0
  24. data/opals/{browser → opal/browser}/SIZZLE_LICESNSE.txt +0 -0
  25. data/opals/{browser → opal/browser}/lib/browser.rb +0 -0
  26. data/opals/{browser → opal/browser}/lib/browser/builder.rb +0 -0
  27. data/opals/{browser → opal/browser}/lib/browser/canvas_context.rb +0 -0
  28. data/opals/{browser → opal/browser}/lib/browser/dimensions.rb +0 -0
  29. data/opals/{browser → opal/browser}/lib/browser/document.rb +0 -0
  30. data/opals/{browser → opal/browser}/lib/browser/element.rb +0 -0
  31. data/opals/{browser → opal/browser}/lib/browser/element/attributes.rb +0 -0
  32. data/opals/{browser → opal/browser}/lib/browser/element/css.rb +0 -0
  33. data/opals/{browser → opal/browser}/lib/browser/element/form.rb +0 -0
  34. data/opals/{browser → opal/browser}/lib/browser/event/dom_events.rb +0 -0
  35. data/opals/{browser → opal/browser}/lib/browser/event/event.rb +0 -0
  36. data/opals/{browser → opal/browser}/lib/browser/event/trigger_events.rb +0 -0
  37. data/opals/{browser → opal/browser}/lib/browser/geometry.rb +0 -0
  38. data/opals/{browser → opal/browser}/lib/browser/json.rb +0 -0
  39. data/opals/{browser → opal/browser}/lib/browser/json_parse.js +0 -0
  40. data/opals/{browser → opal/browser}/lib/browser/request/request.rb +0 -0
  41. data/opals/{browser → opal/browser}/lib/browser/sizzle.js +0 -0
  42. data/opals/{browser → opal/browser}/lib/browser/string.rb +0 -0
  43. data/opals/{browser → opal/browser}/lib/browser/touch.rb +0 -0
  44. data/opals/{browser → opal/browser}/lib/browser/vml_context.js +0 -0
  45. data/opals/{browser → opal/browser}/lib/browser/window.rb +0 -0
  46. data/opals/{browser → opal/browser}/spec/browser/browser_detection_spec.rb +0 -0
  47. data/opals/{browser → opal/browser}/spec/document/aref_spec.rb +0 -0
  48. data/opals/{browser → opal/browser}/spec/document/ready_spec.rb +0 -0
  49. data/opals/{browser → opal/browser}/spec/element/body_spec.rb +0 -0
  50. data/opals/{browser → opal/browser}/spec/element/clear_spec.rb +0 -0
  51. data/opals/{browser → opal/browser}/spec/element/empty_spec.rb +0 -0
  52. data/opals/{browser → opal/browser}/spec/element/has_class_spec.rb +0 -0
  53. data/opals/{browser → opal/browser}/spec/element/hidden_spec.rb +0 -0
  54. data/opals/{browser → opal/browser}/spec/element/hide_spec.rb +0 -0
  55. data/opals/{browser → opal/browser}/spec/element/remove_spec.rb +0 -0
  56. data/opals/{browser → opal/browser}/spec/element/show_spec.rb +0 -0
  57. data/opals/{browser → opal/browser}/spec/element/style_spec.rb +0 -0
  58. data/opals/{browser → opal/browser}/spec/element/toggle_spec.rb +0 -0
  59. data/opals/{browser → opal/browser}/spec/element/visible_spec.rb +0 -0
  60. data/opals/{browser → opal/browser}/spec/spec_helper.rb +0 -0
  61. data/opals/opal/{Opalfile → opal/Opalfile} +0 -0
  62. data/opals/opal/{spec → opal/spec}/core/array/append_spec.rb +0 -0
  63. data/opals/opal/{spec → opal/spec}/core/array/assoc_spec.rb +0 -0
  64. data/opals/opal/{spec → opal/spec}/core/array/at_spec.rb +0 -0
  65. data/opals/opal/{spec → opal/spec}/core/array/clear_spec.rb +0 -0
  66. data/opals/opal/{spec → opal/spec}/core/array/collect_bang_spec.rb +0 -0
  67. data/opals/opal/{spec → opal/spec}/core/array/collect_spec.rb +0 -0
  68. data/opals/opal/{spec → opal/spec}/core/array/compact_spec.rb +0 -0
  69. data/opals/opal/{spec → opal/spec}/core/array/concat_spec.rb +0 -0
  70. data/opals/opal/{spec → opal/spec}/core/array/constructor_spec.rb +0 -0
  71. data/opals/opal/{spec → opal/spec}/core/array/each_spec.rb +0 -0
  72. data/opals/opal/{spec → opal/spec}/core/array/element_reference_spec.rb +0 -0
  73. data/opals/opal/{spec → opal/spec}/core/array/first_spec.rb +0 -0
  74. data/opals/opal/{spec → opal/spec}/core/array/include_spec.rb +0 -0
  75. data/opals/opal/{spec → opal/spec}/core/array/map_spec.rb +0 -0
  76. data/opals/opal/{spec → opal/spec}/core/builtin_constants/builtin_constants_spec.rb +0 -0
  77. data/opals/opal/{spec → opal/spec}/core/false/and_spec.rb +0 -0
  78. data/opals/opal/{spec → opal/spec}/core/false/inspect_spec.rb +0 -0
  79. data/opals/opal/{spec → opal/spec}/core/false/or_spec.rb +0 -0
  80. data/opals/opal/{spec → opal/spec}/core/false/to_s_spec.rb +0 -0
  81. data/opals/opal/{spec → opal/spec}/core/false/xor_spec.rb +0 -0
  82. data/opals/opal/{spec → opal/spec}/core/file/join_spec.rb +0 -0
  83. data/opals/opal/{spec → opal/spec}/core/kernel/instance_eval_spec.rb +0 -0
  84. data/opals/opal/{spec → opal/spec}/core/kernel/loop_spec.rb +0 -0
  85. data/opals/opal/{spec → opal/spec}/core/kernel/raise_spec.rb +0 -0
  86. data/opals/opal/{spec → opal/spec}/core/module/attr_accessor_spec.rb +0 -0
  87. data/opals/opal/{spec → opal/spec}/core/number/lt_spec.rb +0 -0
  88. data/opals/opal/{spec → opal/spec}/core/true/and_spec.rb +0 -0
  89. data/opals/opal/{spec → opal/spec}/core/true/inspect_spec.rb +0 -0
  90. data/opals/opal/{spec → opal/spec}/core/true/or_spec.rb +0 -0
  91. data/opals/opal/{spec → opal/spec}/core/true/to_s_spec.rb +0 -0
  92. data/opals/opal/{spec → opal/spec}/core/true/xor_spec.rb +0 -0
  93. data/opals/opal/{spec → opal/spec}/fixtures/super.rb +0 -0
  94. data/opals/opal/{spec → opal/spec}/language/____temp_remove_this.rb +0 -0
  95. data/opals/opal/{spec → opal/spec}/language/and_spec.rb +0 -0
  96. data/opals/opal/{spec → opal/spec}/language/array_spec.rb +0 -0
  97. data/opals/opal/{spec → opal/spec}/language/block_spec.rb +0 -0
  98. data/opals/opal/{spec → opal/spec}/language/break_spec.rb +0 -0
  99. data/opals/opal/{spec → opal/spec}/language/case_spec.rb +0 -0
  100. data/opals/opal/{spec → opal/spec}/language/def_spec.rb +0 -0
  101. data/opals/opal/{spec → opal/spec}/language/eigenclass_spec.rb +0 -0
  102. data/opals/opal/{spec → opal/spec}/language/hash_spec.rb +0 -0
  103. data/opals/opal/{spec → opal/spec}/language/if_spec.rb +0 -0
  104. data/opals/opal/{spec → opal/spec}/language/loop_spec.rb +0 -0
  105. data/opals/opal/{spec → opal/spec}/language/metaclass_spec.rb +0 -0
  106. data/opals/opal/{spec → opal/spec}/language/method_spec.rb +0 -0
  107. data/opals/opal/{spec → opal/spec}/language/next_spec.rb +0 -0
  108. data/opals/opal/{spec → opal/spec}/language/or_spec.rb +0 -0
  109. data/opals/opal/{spec → opal/spec}/language/redo_spec.rb +0 -0
  110. data/opals/opal/{spec → opal/spec}/language/rescue_spec.rb +0 -0
  111. data/opals/opal/{spec → opal/spec}/language/return_spec.rb +0 -0
  112. data/opals/opal/{spec → opal/spec}/language/string_spec.rb +0 -0
  113. data/opals/opal/{spec → opal/spec}/language/super_spec.rb +0 -0
  114. data/opals/opal/{spec → opal/spec}/language/until_spec.rb +0 -0
  115. data/opals/opal/{spec → opal/spec}/language/while_spec.rb +0 -0
  116. data/opals/opal/{spec → opal/spec}/spec_helper.rb +0 -0
  117. data/opals/{runtime → opal/runtime}/Opalfile +10 -0
  118. data/opals/{runtime → opal/runtime}/README.md +0 -0
  119. data/opals/{runtime → opal/runtime}/docs/debugging.md +0 -0
  120. data/opals/{runtime → opal/runtime}/lib/array.rb +0 -0
  121. data/opals/{runtime → opal/runtime}/lib/basic_object.rb +0 -0
  122. data/opals/{runtime → opal/runtime}/lib/class.rb +0 -0
  123. data/opals/{runtime → opal/runtime}/lib/dir.rb +0 -0
  124. data/opals/{runtime → opal/runtime}/lib/error.rb +0 -0
  125. data/opals/{runtime → opal/runtime}/lib/false_class.rb +0 -0
  126. data/opals/{runtime → opal/runtime}/lib/file.rb +0 -0
  127. data/opals/{runtime → opal/runtime}/lib/hash.rb +0 -0
  128. data/opals/{runtime → opal/runtime}/lib/io.rb +0 -0
  129. data/opals/{runtime → opal/runtime}/lib/kernel.rb +0 -0
  130. data/opals/{runtime → opal/runtime}/lib/match_data.rb +0 -0
  131. data/opals/{runtime → opal/runtime}/lib/module.rb +0 -0
  132. data/opals/{runtime → opal/runtime}/lib/nil_class.rb +0 -0
  133. data/opals/{runtime → opal/runtime}/lib/number.rb +0 -0
  134. data/opals/{runtime → opal/runtime}/lib/proc.rb +0 -0
  135. data/opals/{runtime → opal/runtime}/lib/range.rb +0 -0
  136. data/opals/{runtime → opal/runtime}/lib/regexp.rb +0 -0
  137. data/opals/{runtime → opal/runtime}/lib/ruby.rb +0 -0
  138. data/opals/{runtime → opal/runtime}/lib/string.rb +0 -0
  139. data/opals/{runtime → opal/runtime}/lib/symbol.rb +0 -0
  140. data/opals/{runtime → opal/runtime}/lib/top_self.rb +0 -0
  141. data/opals/{runtime → opal/runtime}/lib/true_class.rb +0 -0
  142. data/opals/{runtime → opal/runtime}/runtime/browser.js +0 -0
  143. data/opals/{runtime → opal/runtime}/runtime/debug.js +0 -2
  144. data/opals/{runtime → opal/runtime}/runtime/opal.js +0 -2
  145. data/opals/{runtime → opal/runtime}/runtime/post_opal.js +0 -0
  146. data/opals/{runtime → opal/runtime}/runtime/pre_opal.js +0 -0
  147. data/opals/{runtime → opal/runtime}/runtime/server_side.js +0 -0
  148. data/opals/{spec → opal/spec}/LICENSE.txt +0 -0
  149. data/opals/{spec → opal/spec}/Opalfile +0 -0
  150. data/opals/{spec → opal/spec}/bin/spec.rb +0 -0
  151. data/opals/{spec → opal/spec}/lib/spec.rb +0 -0
  152. data/opals/{spec → opal/spec}/lib/spec/dsl.rb +0 -0
  153. data/opals/{spec → opal/spec}/lib/spec/example.rb +0 -0
  154. data/opals/{spec → opal/spec}/lib/spec/example/before_and_after_hooks.rb +0 -0
  155. data/opals/{spec → opal/spec}/lib/spec/example/errors.rb +0 -0
  156. data/opals/{spec → opal/spec}/lib/spec/example/example_group.rb +0 -0
  157. data/opals/{spec → opal/spec}/lib/spec/example/example_group_factory.rb +0 -0
  158. data/opals/{spec → opal/spec}/lib/spec/example/example_group_hierarchy.rb +0 -0
  159. data/opals/{spec → opal/spec}/lib/spec/example/example_group_methods.rb +0 -0
  160. data/opals/{spec → opal/spec}/lib/spec/example/example_group_proxy.rb +0 -0
  161. data/opals/{spec → opal/spec}/lib/spec/example/example_methods.rb +0 -0
  162. data/opals/{spec → opal/spec}/lib/spec/example/example_proxy.rb +0 -0
  163. data/opals/{spec → opal/spec}/lib/spec/expectations.rb +0 -0
  164. data/opals/{spec → opal/spec}/lib/spec/expectations/errors.rb +0 -0
  165. data/opals/{spec → opal/spec}/lib/spec/expectations/fail_with.rb +0 -0
  166. data/opals/{spec → opal/spec}/lib/spec/expectations/handler.rb +0 -0
  167. data/opals/{spec → opal/spec}/lib/spec/matchers.rb +0 -0
  168. data/opals/{spec → opal/spec}/lib/spec/matchers/be.rb +0 -0
  169. data/opals/{spec → opal/spec}/lib/spec/matchers/generated_descriptions.rb +0 -0
  170. data/opals/{spec → opal/spec}/lib/spec/matchers/operator_matcher.rb +0 -0
  171. data/opals/{spec → opal/spec}/lib/spec/runner.rb +0 -0
  172. data/opals/{spec → opal/spec}/lib/spec/runner/example_group_runner.rb +0 -0
  173. data/opals/{spec → opal/spec}/lib/spec/runner/formatter/html_formatter.rb +0 -0
  174. data/opals/{spec → opal/spec}/lib/spec/runner/formatter/terminal_formatter.rb +0 -0
  175. data/opals/{spec → opal/spec}/lib/spec/runner/options.rb +0 -0
  176. data/opals/{spec → opal/spec}/lib/spec/runner/reporter.rb +0 -0
  177. data/opals/{spec → opal/spec}/resources/index.html +0 -0
  178. data/opals/{spec → opal/spec}/resources/spec.css +0 -0
  179. metadata +170 -238
  180. data/opals/aristo/README.md +0 -16
  181. data/opals/cherry_kit/Opalfile +0 -6
  182. data/opals/cherry_kit/bin/cherry_kit.rb +0 -11
  183. data/opals/cherry_kit/lib/cherry_kit.rb +0 -29
  184. data/opals/foundation/Opalfile +0 -11
  185. data/opals/foundation/bin/foundation.rb +0 -12
  186. data/opals/foundation/lib/foundation.rb +0 -32
  187. data/opals/foundation/lib/foundation/__table_view_desktop/outline_view.rb +0 -57
  188. data/opals/foundation/lib/foundation/__table_view_desktop/table_column.rb +0 -59
  189. data/opals/foundation/lib/foundation/__table_view_desktop/table_header_view.rb +0 -34
  190. data/opals/foundation/lib/foundation/__table_view_desktop/table_view.rb +0 -304
  191. data/opals/foundation/lib/foundation/controllers/array_controller.rb +0 -54
  192. data/opals/foundation/lib/foundation/controllers/controller.rb +0 -74
  193. data/opals/foundation/lib/foundation/controllers/controller_selection_proxy.rb +0 -67
  194. data/opals/foundation/lib/foundation/controllers/object_controller.rb +0 -145
  195. data/opals/foundation/lib/foundation/controllers/view.rb +0 -40
  196. data/opals/foundation/lib/foundation/core/application.rb +0 -476
  197. data/opals/foundation/lib/foundation/core/attributes.rb +0 -146
  198. data/opals/foundation/lib/foundation/core/bindings.rb +0 -125
  199. data/opals/foundation/lib/foundation/core/builder.rb +0 -101
  200. data/opals/foundation/lib/foundation/core/event.rb +0 -112
  201. data/opals/foundation/lib/foundation/core/index_path.rb +0 -49
  202. data/opals/foundation/lib/foundation/core/index_set.rb +0 -97
  203. data/opals/foundation/lib/foundation/core/notification.rb +0 -113
  204. data/opals/foundation/lib/foundation/core/observable.rb +0 -275
  205. data/opals/foundation/lib/foundation/core/observable_array.rb +0 -30
  206. data/opals/foundation/lib/foundation/core/responder.rb +0 -85
  207. data/opals/foundation/lib/foundation/core/run_loop.rb +0 -89
  208. data/opals/foundation/lib/foundation/core/touch.rb +0 -95
  209. data/opals/foundation/lib/foundation/gestures/gesture_recognizer.rb +0 -35
  210. data/opals/foundation/lib/foundation/rendering/render_context.rb +0 -100
  211. data/opals/foundation/lib/foundation/rendering/renderer.rb +0 -137
  212. data/opals/foundation/lib/foundation/rendering/root_theme.rb +0 -77
  213. data/opals/foundation/lib/foundation/rendering/root_theme/button.rb +0 -62
  214. data/opals/foundation/lib/foundation/rendering/root_theme/control.rb +0 -72
  215. data/opals/foundation/lib/foundation/rendering/root_theme/label.rb +0 -54
  216. data/opals/foundation/lib/foundation/rendering/root_theme/scroller.rb +0 -58
  217. data/opals/foundation/lib/foundation/rendering/root_theme/slider.rb +0 -72
  218. data/opals/foundation/lib/foundation/rendering/root_theme/table_view.rb +0 -97
  219. data/opals/foundation/lib/foundation/rendering/root_theme/text_field.rb +0 -55
  220. data/opals/foundation/lib/foundation/rendering/root_theme/view.rb +0 -81
  221. data/opals/foundation/lib/foundation/rendering/theme.rb +0 -38
  222. data/opals/foundation/lib/foundation/table_view/cell.rb +0 -39
  223. data/opals/foundation/lib/foundation/table_view/table.rb +0 -171
  224. data/opals/foundation/lib/foundation/views/button.rb +0 -63
  225. data/opals/foundation/lib/foundation/views/checkbox.rb +0 -28
  226. data/opals/foundation/lib/foundation/views/clip.rb +0 -47
  227. data/opals/foundation/lib/foundation/views/control.rb +0 -199
  228. data/opals/foundation/lib/foundation/views/label.rb +0 -54
  229. data/opals/foundation/lib/foundation/views/scroll.rb +0 -294
  230. data/opals/foundation/lib/foundation/views/scroll_view_desktop.rb +0 -152
  231. data/opals/foundation/lib/foundation/views/scroller.rb +0 -54
  232. data/opals/foundation/lib/foundation/views/slider.rb +0 -93
  233. data/opals/foundation/lib/foundation/views/text_field.rb +0 -83
  234. data/opals/foundation/lib/foundation/views/view.rb +0 -426
  235. data/opals/foundation/lib/foundation/windows/window.rb +0 -191
  236. data/opals/foundation/resources/button/button.css +0 -23
  237. data/opals/foundation/resources/foundation.css +0 -53
  238. data/opals/foundation/resources/scroll/scroll.css +0 -22
  239. data/opals/foundation/resources/scroll_view/scroll_view.css +0 -3
  240. data/opals/foundation/resources/scroll_view/scroller.css +0 -3
  241. data/opals/foundation/resources/slider/regular/slider.css +0 -3
  242. data/opals/foundation/resources/slider/slider.css +0 -27
  243. data/opals/foundation/resources/table_view/outline_view.css +0 -3
  244. data/opals/foundation/resources/table_view/table_view.css +0 -15
  245. data/opals/foundation/resources/text_field/text_field.css +0 -71
  246. data/opals/foundation/spec/spec_helper.rb +0 -1
  247. data/opals/foundation/spec/system/attributes/get_attribute_spec.rb +0 -69
  248. data/opals/foundation/spec/system/attributes/get_path_spec.rb +0 -44
  249. data/opals/foundation/spec/system/attributes/set_path_spec.rb +0 -24
  250. data/opals/foundation/spec/system/attributes/set_spec.rb +0 -58
  251. data/opals/foundation/spec/system/bindings/bindings.rb +0 -85
  252. data/opals/foundation/spec/system/key_value_binding/bind_spec.rb +0 -43
  253. data/opals/foundation/spec/system/observable/dependant_keys_spec.rb +0 -74
  254. data/opals/foundation/spec/system/observable/observe_spec.rb +0 -292
  255. data/opals/foundation/spec/system/observable/remove_observer_spec.rb +0 -60
@@ -0,0 +1,175 @@
1
+ var opal={};
2
+ (function(a,b){if(typeof console==="undefined")a.console={};var c=null,h=null,p=null,q=null,w=null,H=null,u=c=c=c=c=null,r=null,A=null,x=null,y=null,z=null,D=null;b.top_self=null;a.vnNil=null;a.vnTrue=null;a.vnFalse=null;a.vnH=function(){var f,g,j=new A.allocator;j.__keys__=[];j.__assocs__={};j.__default__=vnNil;for(var n=0;n<arguments.length;n++){f=arguments[n];g=arguments[n+1];n++;j.__keys__.push(f);j.__assocs__[f.hash()]=g}return j};a.vnR=function(f){var g=new y.allocator;g.__reg__=f;return g};
3
+ var C={},B=0;if(!Array.prototype.indexOf)Array.prototype.indexOf=function(f){for(var g=0;g<this.length;g++)if(this[g]==f)return g;return-1};b.entry_point=function(f){return f()};var o=function(){this.id=B++};o.prototype.hash=function(){return this.id};o.prototype.mid2jsid=function(f){return("$"+f).replace(/=/g,"$e").replace(/\?/g,"$q")};o.prototype.define_class=function(f,g,j,n){var G=this;if(G.flags&4)G=G.isa;switch(n){case 0:if(f===vnNil)f=q;f=E(G,g,f);break;case 1:f=g.singleton_class();break;case 2:f=
4
+ e(G,g);break;default:throw"define_class: unknown flag: "+n;}return j.apply(f)};o.prototype.singleton_class=function(){var f;if(this.info&4096)f=this.isa;else if(this.info&1||this.info&2)if(this.__attached__)return this.__attached__;else{var g=d(this.class_name,this.isa);g.info|=4096;this.__attached__=this.isa=g;g.__attached__=this;return g}else{this.info|=4096;g=d(this.class_name,this.isa);g.info|=2048;var j=this.isa;f=this.isa=g;g.__instance__=this;g.constants=j.constants}return f};o.prototype.dm=
5
+ function(f,g,j){var n="$"+f;g.method_id=f;g.jsid=n;g.displayName=f;g.opal_class=this;if(j)if(this.info&1||this.info&2){this.constructor.prototype[n]=g;this.constructor.prototype.method_table[n]=g}else this[n]=g;else if(this.info&1||this.info&2){if(this.info&4096){this.__attached__.constructor.prototype[n]=g;this.__attached__.constructor.prototype.method_table[n]=g}else{this.allocator.prototype[n]=g;this.allocator.prototype.method_table[n]=g}if(this.info&2048){this.__instance__[n]=g;console.log("adding method "+
6
+ f+" which is "+n)}}else{f=this.singleton_class();f.allocator.prototype[n]=g;f.allocator.prototype.method_table[n]=g;g.opal_class=f;this[n]=g}return this.n};o.prototype.const_set=function(f,g){var j=this;if(j.info&4)j=j.isa;return j.constants[f]=g};o.prototype.const_defined=function(f){var g=this;if(g.info&4)g=g.isa;if(g.constants[f])return true;return false};o.prototype.const_get=function(f){var g=this;if(g.info&4)g=g.isa;if(g.constants[f])return g.constants[f];g=g.opal_parent;for(var j;g;){if(j=
7
+ g.const_get(f))return j;g=g.opal_parent}throw{toString:function(){return"NameError: uninitialized constant: "+f}};};o.prototype.ig=function(f){if(this.hasOwnProperty(f))return this[f];return vnNil};o.prototype.is=function(f,g){return this[f]=g};o.prototype.include=function(f){if(!this.included_modules)this.included_modules=[];if(this.included_modules.indexOf(f)==-1){this.included_modules.push(f);f.included_in.push(this);for(method in f.allocator.prototype.method_table){this.allocator.prototype.method_table[method]=
8
+ f.allocator.prototype.method_table[method];this.allocator.prototype[method]=f.allocator.prototype.method_table[method]}for(var g in f.constants)if(f.constants.hasOwnProperty(g)&&!this.constants[g])this.constants[g]=f.constants[g]}};o.prototype.extend=function(f){for(method in f.allocator.prototype.method_table){this.constructor.prototype.method_table[method]=f.allocator.prototype.method_table[method];this.constructor.prototype[method]=f.allocator.prototype.method_table[method]}};o.prototype.r=true;
9
+ o.prototype.a=function(f,g){if(f.r)return g.apply(this);return f};o.prototype.o=function(f,g){if(f.r)return f;return g.apply(this)};o.prototype.rbYield=function(f,g){if(!f)throw{toString:function(){return"Yield: no block given"}};return f.apply(f.__self__,g)};o.prototype.rbWhile=function(f,g,j){try{for(j&&g.apply(this);f.apply(this);)g.apply(this);return this.n}catch(n){if(n.__keyword__=="break")return n.opal_value||this.n;if(n.__keyword__=="next")return arguments.callee.apply(this,[f,g]);if(n.__keyword__==
10
+ "redo")return arguments.callee.apply(this,[f,g,true]);throw n;}};o.prototype.rbRedo=function(){throw{toString:function(){return"uncaught redo"},__keyword__:"redo"};};o.prototype.rbBreak=function(f){throw{toString:function(){return"uncaught break"},__keyword__:"break",opal_value:f==undefined?this.n:f};};o.prototype.rbNext=function(f){throw{toString:function(){return"uncaught next"},__keyword__:"next",opal_value:f||this.n};};o.prototype.rbReturn=function(f){throw{toString:function(){return"uncaught rbReturn"},
11
+ __keyword__:"return",opal_value:f||this.n};};o.prototype.P=function(f){f.__self__=this;return f};o.prototype.L=function(f){f.__self__=this;f.__lambda__=true;return f};o.prototype.Y=function(f){if(C.hasOwnProperty(f))return C[f];var g=new H.allocator;g.__ptr__=f;return C[f]=g};o.prototype.R=function(f,g,j){var n=new z.allocator;n.__start__=f;n.__end__=g;n.__exclusive__=j;n.__real_end__=j?g-1:g;return n};o.prototype.opal_super=function(f,g){var j=f.opal_class,n=j.super_class;if(!n)throw"NativeError: no super class found from "+
12
+ j;j=n.allocator.prototype[f.jsid];if(!j)throw"NativeError: no superclass method found for "+f.method_id;return j.apply(this,g)};o.prototype.rbNativeError=function(f){var g=D.$new();g.is("@message",f.toString());return g};o.prototype.TN=64;o.prototype.TS=16;o.prototype.TP=128;o.prototype.TA=32;o.prototype.TH=512;var E=function(f,g,j){if(f.const_defined(g))return f.const_get(g);j||(j=q);j=d(g,j);j.constructor.prototype.opal_parent=f;f.const_set(g,j);return j};w=function(f,g){var j=d(f,q),n=j.allocator.prototype;
13
+ j.allocator=g;for(var G in n)g.prototype[G]=n[G];q.const_set(f,j);return j};var d=b.__subclass=function(f,g){var j=function(){this.id=B++};j.prototype=new g.allocator;j.prototype.method_table={};j.prototype.constructor=j;j.prototype.class_name=f;j.prototype.super_class=g;j.prototype.info=4;var n=function(){this.id=B++};n.prototype=new g.constructor;n.prototype.method_table={};n.prototype.allocator=j;n.prototype.class_name=f;n.prototype.super_class=g;n.prototype.info=1;n.prototype.constructor=n;n.prototype.constants=
14
+ new g.constants_alloc;n.prototype.constants_alloc=function(){};n.prototype.constants_alloc.prototype=n.prototype.constants;n=new n;return j.prototype.isa=n},e=function(f,g){if(f.const_defined(g))return f.const_get(g);var j=E(f,g,h);j.included_in=[];j.info=2;j.allocator.prototype.info=2;return j};c=function(f,g){var j=function(){this.id=B++};j.prototype=g?new g:new o;j.prototype.method_table={};j.prototype.constructor=j;j.prototype.class_name=f;j.prototype.super_class=g;j.prototype.info=4;return j};
15
+ p=function(f,g){var j=function(){this.id=B++};j.prototype=new g;j.prototype.included_in=[];j.prototype.method_table={};j.prototype.allocator=f;j.prototype.constructor=j;j.prototype.class_name=f.prototype.class_name;j.prototype.super_class=g;j.prototype.info=1;if(f===i){j.prototype.constants_alloc=function(){};j.prototype.constants=j.prototype.constants_alloc.prototype}else{j.prototype.constants=new g.prototype.constants_alloc;j.prototype.constants_alloc=function(){};j.prototype.constants_alloc.prototype=
16
+ j.prototype.constants}j=new j;return f.prototype.isa=j};var i=c("BasicObject",null),k=c("Object",i),m=c("Module",k),l=c("Class",m);c=p(i,l);q=p(k,c.constructor);h=p(m,q.constructor);p=p(l,h.constructor);c.isa=p;q.isa=p;h.isa=p;p.isa=p;q.const_set("BasicObject",c);q.const_set("Object",q);q.const_set("Class",p);q.const_set("Module",h);h.constructor.prototype.dm=function(f,g){js_id="$"+f;o.prototype.dm.apply(this,arguments);for(var j=0;j<this.included_in.length;j++)this.included_in[j].allocator.prototype[js_id]=
17
+ g};p.constructor.prototype.dm=q.constructor.prototype.dm;b.Object=q;b.top_self=new q.allocator;q.include=function(f){for(var g=o.prototype.include.apply(q,[f]),j=[u,x,r,y],n=0;n<j.length;n++)j[n].include(f);return g};q.dm=function(){for(var f=o.prototype.dm.apply(q,arguments),g=[u,x,r,y],j=0;j<g.length;j++)g[j].dm.apply(g[j],arguments);return f};c=w("Proc",Function);c.allocator.prototype.info=132;q.allocator.prototype.super_class=undefined;q.super_class=undefined;z=E(q,"Range",q);z.allocator.prototype.info=
18
+ 1028;c=E(q,"TrueClass",q);vnTrue=new c.allocator;vnTrue.info|=4096;o.prototype.t=vnTrue;c=E(q,"FalseClass",q);vnFalse=new c.allocator;vnFalse.info|=4096;o.prototype.f=vnFalse;vnFalse.r=false;c=E(q,"NilClass",q);vnNil=new c.allocator;vnNil.info|=4096;o.prototype.n=vnNil;vnNil.r=false;A=E(q,"Hash",q);A.allocator.prototype.info=516;A.allocator.prototype.hash_store=function(f,g){var j=f.hash();this.__assocs__.hasOwnProperty(j)||this.__keys__.push(f);return this.__assocs__[j]=g};A.allocator.prototype.hash_delete=
19
+ function(f){var g=f.hash();if(this.__assocs__[g]){var j=this.__assocs__[g];delete this.__assocs__[g];this.__keys__.splice(this.__keys__.indexOf(f),1);return j}return this.__default__};A.allocator.prototype.hash_fetch=function(f){f=f.hash();if(this.__assocs__.hasOwnProperty(f))return this.__assocs__[f];return this.__default__};H=E(q,"Symbol",q);H.allocator.prototype.toString=function(){return":"+this.__ptr__};y=E(q,"Regexp",q);D=E(q,"Exception",q);D.allocator.prototype.toString=function(){var f=this.ig("@message");
20
+ if(f&&f.r)return this.class_name+": "+this.ig("@message").toString();return this.class_name};D.allocator.prototype.raise=function(){throw this;};x=w("Number",Number);x.allocator.prototype.info=68;x.allocator.prototype.hash=function(){return"$$num$$"+this};u=w("String",String);u.allocator.prototype.info=20;u.allocator.prototype.hash=function(){return this};r=w("Array",Array);r.allocator.prototype.info=36;y=w("Regexp",RegExp);y.allocator.prototype.info=4;w=e(q,"Kernel");q.include(w);b.register=function(f){I[f.name]=
21
+ f;t.push(f.name+"/lib/");for(var g in f.files)F[f.name+"/"+g]=f.files[g]};var t=[""],s=null,v=null,I={},F=b.files={};b.run=function(f,g){s=f;b.getwd=v=g;var j;if(!s)throw"Opal: no bin file defined.";var n=s+"/bin/"+s+".rb";if(b.files[n])j=n;else if(b.files[n=f+"/lib/"+f+".rb"])j=n;else if(b.files[n=f+"/"+f+".rb"])j=n;else throw"cannot find bin file";opal.entry_point(function(){b.require("browser");return b.require(j)})};b.require=function(f){var g=f;if(g.substr(g.length-3)!=".rb"&&g.substr(g.length-
22
+ 3)!=".js")g+=".rb";for(var j=0;j<t.length;j++){var n=t[j]+g;if(F.hasOwnProperty(n)){if(F[n].opal_required)return;f=n;g=F[f];g.opal_required=true;return g.apply(b.top_self,[f])}}throw"could not find require: "+f;};b.load_raw_file=function(f,g){return g.apply(b.top_self)};b.browser=function(){var f=navigator.userAgent.toLowerCase();return{version:0,safari:/webkit/.test(f)?1:0,opera:/opera/.test(f)?1:0,msie:/msie/.test(f)&&!/opera/.test(f)?1:0}}();b.setDocumentReadyListener=function(f){var g=function(){opal.entry_point(function(){f.apply(opal.top_self)})};
23
+ (function(){document.addEventListener&&document.addEventListener("DOMContentLoaded",g,false);b.browser.msie&&function(){try{document.documentElement.doScroll("left")}catch(j){setTimeout(arguments.callee,0);return}g()}()})()};b.glob_files=function(f){var g=f.replace(/\*\*\//g,".*").replace(/\*\*/g,".*").replace(/\//g,"\\/");f=[];g=RegExp("^"+g+"$");for(var j in opal.files)g.exec(j)&&f.push(j);return f};b.ruby_platform="browser";b.request=function(){return function(){return new XMLHttpRequest}}()})(this,
24
+ opal);
25
+ opal.load_raw_file("opal/lib/kernel.rb",function(){this.define_class(this.n,"Kernel",function(){this.dm("block_given?",function(){return this.f},false,41);this.dm("!=",function(a){return this["$=="](a).r?this.f:this.t},false,45);this.dm("loop",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];try{for(;;)a.apply(a.__self__,[])}catch(b){if(b.__keyword__=="break")return b.opal_value;throw b;}},false,60);this.dm("is_a?",function(a){for(var b=this.isa;b;){if(b==a)return this.t;b=
26
+ b.super_class}return this.f},false,76);this.dm("nil?",function(){return this.f},false,97);this.dm("respond_to?",function(a){a=a.$to_s().toString();a=this.mid2jsid(a);if(this[a])return this.t;return this.f},false,101);this.dm("===",function(a){return this["$=="](a)},false,110);this.dm("instance_variable_defined?",function(a){return this[a.$to_s().toString()]?this.t:this.f},false,114);this.dm("instance_variable_get",function(a){return this.ig(a.$to_s().toString())},false,118);this.dm("instance_variable_set",
27
+ function(a,b){this.is(a.$to_s().toString(),b);return b},false,122);this.dm("__send__",function(a,b){a=arguments[0];b=Array.prototype.slice.call(arguments,1);return this["$"+a.$to_s()].apply(this,b)},false,127);this.dm("class",function(){return this.isa},false,132);this.dm("superclass",function(){return this.super_class},false,136);this.dm("require",function(a){opal.require(a);return this.t},false,149);this.dm("proc",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];return(!a||
28
+ !a.r?this.f:this.t).r?a:this.$raise("ArgumentError: tried to create Proc object without a block")},false,162);this.dm("puts",function(a){console.log(a.$to_s().toString());return this.n},false,176);this.dm("rand",function(a){if(a==undefined)a=this.n;return a.r?Math.floor(Math.random()*a):Math.random()},false,194);this.dm("to_s",function(){return"#<"+this.class_name+":"+this.id+">"},false,202);this.dm("inspect",function(){return this.$to_s()},false,206);this.dm("object_id",function(){return this.id},
29
+ false,210);this.dm("raise",function(a,b){var c=this.n;c=c=this.n;if(a["$is_a?"](this.const_get("String")).r){c=a;c=this.const_get("RuntimeError").$new(c)}else if(a["$is_a?"](this.const_get("Exception")).r)c=a;else{if(b)c=b;c=a.$new(c)}c.raise()},false,231);this.dm("fail",function(a,b){if(a==undefined)a=this.n;if(b==undefined)b=this.n;return this.$raise(a,b)},false,252);this.dm("instance_eval",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];if((!a||!a.r?this.f:this.t).r)a.apply(this);
30
+ else return this.n},false,256);return this.dm("const_set",function(a,b){return this.const_set(a,b)},false,263)},2);this.define_class(this.n,"String",function(){this.dm("to_s",function(){return this},false,275);return this.dm("inspect",function(){return'"'+this+'"'},false,279)},0);return this.define_class(this.n,"Symbol",function(){return this.dm("to_s",function(){return this.__ptr__},false,285)},0)});
31
+ opal.load_raw_file("opal/lib/module.rb",function(){return this.define_class(this.n,"Module",function(){this.dm("===",function(a){return a["$is_a?"](this)},false,29);this.dm("undef_method",function(a){return this.$puts(["need to undefine method: ",a.$to_s()].join(""))},false,33);this.dm("define_method",function(a,b){var c=b&&b.info&this.TP?b:this.n;this.dm(a.$to_s(),c,false);return this},false,37);this.dm("alias_method",function(a,b){a=a.$to_s();b=b.$to_s();this.dm(a,this.allocator.prototype["$"+b],
32
+ false);return this},false,45);this.dm("attr_accessor",function(a){a=Array.prototype.slice.call(arguments);this.$attr_reader.apply(this,a);this.$attr_writer.apply(this,a);return this},false,57);this.dm("to_s",function(){return this.class_name},false,64);this.dm("attr_reader",function(a){a=Array.prototype.slice.call(arguments);a.$each(this.P(function(b){var c=b.$to_s();this.dm(c,function(){return this.ig("@"+c)},false)}));return this},false,70);this.dm("attr_writer",function(a){a=Array.prototype.slice.call(arguments);
33
+ a.$each(this.P(function(b){var c=b.$to_s();this.dm(c+"=",function(h){return this.is("@"+c,h)},false)}));return this},false,81);this.dm("const_set",function(a,b){return this.const_set(a,b)},false,93);return this.dm("module_eval",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];if((!a||!a.r?this.f:this.t).r)a.apply(this);else return this.n},false,97)},0)});
34
+ opal.load_raw_file("opal/lib/array.rb",function(){return this.define_class(this.n,"Array",function(){this.dm("[]",function(a){return a=Array.prototype.slice.call(arguments)},true,56);this.dm("&",function(a){var b=this.n;b=[];for(var c=[],h=0;h<this.length;h++){var p=this[h],q=p.hash();if(c.indexOf(q)==-1)for(var w=0;w<a.length;w++){var H=a[w].hash();if(q==H&&c.indexOf(q)==-1){c.push(q);b.push(p)}}}return b},false,69);this.dm("*",function(a){if(a["$is_a?"](this.const_get("String")).r)return this.$join(a);
35
+ else{for(var b=[],c=0;c<parseInt(a);c++)b=b.concat(this);return b}},false,101);this.dm("+",function(a){return this.concat(a)},false,122);this.dm("-",function(){return this.$raise("Array#- not implemented")},false,135);this.dm("<<",function(a){this.push(a);return this},false,149);this.dm("push",function(a){a=Array.prototype.slice.call(arguments);for(var b=0;b<a.length;b++)this.push(a[b]);return this},false,165);this.dm("==",function(a){if(this===a)return this.t;if(!(a.info&this.TA))return this.f;if(this.length!==
36
+ a.length)return this.f;for(var b=0;b<this.length;b++)if(!this[b]["$=="](a[b]).r)return this.f;return this.t},false,188);this.dm("[]",function(a,b){if(b==undefined)b=this.n;var c=this.n;c=this.length;if(a["$is_a?"](this.const_get("Range")).r)this.$raise("need to implement range");else if(a<0)a+=c;if(a>=c||a<0)return this.n;if(b.r){if(b<=0)return[];return this.slice(a,a+b)}else return this[a]},false,232);this.$alias_method(this.Y("slice"),this.Y("[]"));this.dm("[]=",function(a,b){return this[a]=b},
37
+ false,253);this.dm("assoc",function(a){for(var b=0;b<this.length;b++){var c=this[b];if(c.info&this.TA&&c[0]!==undefined&&c[0]===a)return c}return this.n},false,271);this.dm("at",function(a){if(a<0)a+=this.length;if(a<0||a>=this.length)return this.n;return this[a]},false,293);this.dm("clear",function(){return this.splice(0,this.length)},false,311);this.dm("collect",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];var b=this.n;b=[];for(var c=0;c<this.length;c++)try{b.push(a.apply(a.__self__,
38
+ [this[c]]))}catch(h){if(h.__keyword__=="break")return h.opal_value;throw h;}return b},false,330);this.$alias_method(this.Y("map"),this.Y("collect"));this.dm("collect!",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=0;b<this.length;b++)try{this[b]=a.apply(a.__self__,[this[b]])}catch(c){if(c.__keyword__=="break")return c.opal_value;throw c;}return this},false,363);this.$alias_method(this.Y("map!"),this.Y("collect!"));this.dm("compact",function(){var a=this.n;
39
+ a=[];for(var b=0;b<this.length;b++)this[b]!==this.n&&a.push(this[b]);return a},false,387);this.dm("compact!",function(){for(var a=this.length,b=0;b<this.length;b++)if(this[b]==this.n){this.splice(b,1);b--}return a==this.length?this.n:this},false,407);this.dm("concat",function(a){for(var b=a.length,c=0;c<b;c++)this.push(a[c]);return this},false,426);this.dm("count",function(a){if(a!==undefined){for(var b=0,c=0;c<this.length;c++)if(this[c]===a)b+=1;return b}else return this.length},false,449);this.dm("delete",
40
+ function(a){for(var b=this.length,c=0;c<this.length;c++)if(this[c]["$=="](a).r){this.splice(c,1);c--}return b==this.length?this.n:a},false,482);this.dm("delete_at",function(a){if(a<0||a>=this.length)return this.n;var b=this[a];this.splice(a,1);return b},false,507);this.dm("delete_if",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=0;b<this.length;b++)try{if(a.apply(a.__self__,[this[b]]).r){this.splice(b,1);b--}}catch(c){throw"Array#delete_if catch not implemented yet";
41
+ }return this},false,527);this.dm("drop",function(a){if(a>this.length)return[];var b=[];for(a=a;a<this.length;a++)b.push(this[a]);return b},false,552);this.dm("drop_while",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=[],c=0;c<this.length;c++)try{if(!a.apply(a.__self__,[this[c]]).r){b=this.slice(c);break}}catch(h){throw"Array#delete_if catch not implemented yet";}return b},false,575);this.dm("each",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=
42
+ arguments[0];for(var b=0;b<this.length;b++)try{a.apply(a.__self__,[this[b]])}catch(c){if(c.__keyword__=="redo")b--;else if(c.__keyword__=="break")return c.opal_value;else throw c;}return this},false,607);this.dm("each_index",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=0;b<this.length;b++)try{a.apply(a.__self__,[b])}catch(c){if(c.__keyword__=="redo")b--;else if(c.__keyword__=="break")return c.opal_value;else throw c;}return this},false,641);this.dm("empty?",
43
+ function(){return this.length==0?this.t:this.f},false,667);this.$alias_method(this.Y("eql?"),this.Y("=="));this.dm("fetch",function(a,b){var c=a;if(a<0)a+=this.length;if(a<0||a>=this.length)if(b===undefined)throw"IndexError..";else return b.info&this.TP?b.apply(b.__self__,[c]):b;return this[a]},false,697);this.dm("index",function(a){if(a===undefined)throw"need to return enumerator";else if(a.info&this.TP)for(var b=0;b<this.length;b++){if(a.apply(a.__self__,[this[b]]).r)return b}else for(b=0;b<this.length;b++)if(this[b]["$=="](a).r)return b;
44
+ return this.n},false,735);this.dm("first",function(a){if(a==undefined)a=this.n;if(a.r)return this.slice(0,a);else{if(this.length==0)return this.n;return this[0]}},false,767);this.dm("flatten",function(a){if(a==undefined)a=this.n;for(var b=[],c=0;c<this.length;c++){var h=this[c];if(h.info&this.TA)if(a==this.n)b=b.concat(h.$flatten());else if(a==0)b.push(h);else b=b.concat(h.$flatten(a-1));else b.push(h)}return b},false,798);this.dm("flatten!",function(a){var b=this.n,c=this.n;c=this.length;b=this.$flatten(a);
45
+ this.$clear();this.$concat(b);if(this.length==c)return this.n;return this},false,837);this.dm("include?",function(a){for(var b=0;b<this.length;b++)if(a["$=="](this[b]).r)return this.t;return this.f},false,856);this.dm("replace",function(a){this.splice(0,this.length);for(var b=0;b<a.length;b++)this.push(a[b]);return this},false,877);this.dm("insert",function(a,b){a=arguments[0];b=Array.prototype.slice.call(arguments,1);if(a<0)a+=this.length+1;if(a<0||a>=this.length)throw"IndexError... out of range";
46
+ this.splice.apply(this,[a,0].concat(b));return this},false,898);this.dm("join",function(a){if(a==undefined)a="";for(var b=[],c=0;c<this.length;c++)b.push(this[c].$to_s());return b.join(a)},false,919);this.dm("keep_if",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=0;b<this.length;b++)try{if(!a.apply(a.__self__,[this[b]]).r){this.splice(b,1);b--}}catch(c){throw"Array#keep_if catch not implemented yet";}return this},false,940);this.dm("last",function(a){if(a==
47
+ undefined)a=this.n;if(a.r)return this.slice(this.length-a,this.length);else{if(this.length==0)return this.n;return this[this.length-1]}},false,968);this.dm("length",function(){return this.length},false,986);this.$alias_method(this.Y("size"),this.Y("length"));this.dm("pop",function(a){if(a==undefined)a=this.n;if(a.r)return this.splice(this.length-a,this.length);else{if(this.length)return this.pop();return this.n}},false,1009);this.dm("push",function(a){a=Array.prototype.slice.call(arguments);for(var b=
48
+ 0;b<a.length;b++)this.push(a[b]);return this},false,1031);this.dm("rassoc",function(a){for(var b=0;b<this.length;b++){var c=this[b];if(c.info&this.TA&&c[1]!==undefined&&c[1]===a)return c}return this.n},false,1051);this.dm("reject",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=[],c=0;c<this.length;c++)try{a.apply(a.__self__,[this[c]]).r||b.push(this[c])}catch(h){throw"Array#reject catch not implemented yet";}return b},false,1076);this.dm("reject!",function(){if(arguments.length>
49
+ 0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=this.length,c=0;c<this.length;c++)try{if(a.apply(a.__self__,[this[c]]).r){this.splice(c,1);c--}}catch(h){throw"Array#reject catch not implemented yet";}return this.length==b?this.n:this},false,1110);this.dm("reverse",function(){for(var a=[],b=this.length-1;b>=0;b--)a.push(this[b]);return a},false,1136);this.dm("reverse!",function(){return this.reverse()},false,1154);this.dm("reverse_each",function(){if(arguments.length>0&&arguments[0].info&
50
+ this.TP)var a=arguments[0];for(var b=this.length-1;b>=0;b--)try{a.apply(a.__self__,[this[b]])}catch(c){if(c.__keyword__=="redo")b++;else if(c.__keyword__=="break")return c.opal_value;else throw c;}return this},false,1168);this.dm("rindex",function(a){if(a===undefined)throw"need to return enumerator";else if(a.info&this.TP)for(var b=this.length-1;b>0;b--){if(a.apply(a.__self__,[this[b]]).r)return b}else for(b=this.length-1;b>0;b--)if(this[b]["$=="](a).r)return b;return this.n},false,1202);this.dm("select",
51
+ function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=[],c=0;c<this.length;c++)try{a.apply(a.__self__,[this[c]]).r&&b.push(this[c])}catch(h){throw"Array#select catch not implemented yet";}return b},false,1232);this.dm("select!",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=this.length,c=0;c<this.length;c++)try{if(!a.apply(a.__self__,[this[c]]).r){this.splice(c,1);c--}}catch(h){throw"Array#select! catch not implemented yet";
52
+ }return this.length==b?this.n:this},false,1266);this.dm("shift",function(a){if(a==undefined)a=this.n;if(a.r)return this.splice(0,a);else{if(this.length)return this.shift();return this.n}},false,1303);this.dm("slice!",function(a,b){if(b==undefined)b=this.n;var c=this.n;c=this.length;if(a["$is_a?"](this.const_get("Range")).r)this.$raise("need to implement range");else if(a<0)a+=c;if(a>=c||a<0)return this.n;if(b.r){if(b<=0||b>this.length)return this.n;return this.splice(a,a+b)}else return this.splice(a,
53
+ 1)[0]},false,1338);this.dm("take",function(a){return this.slice(0,a)},false,1364);this.dm("take_while",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=[],c=0;c<this.length;c++)try{if(a.apply(a.__self__,[this[c]]).r)b.push(this[c]);else break}catch(h){throw"Array#take_while catch not implemented yet";}return b},false,1381);this.dm("to_a",function(){return this},false,1407);this.dm("to_ary",function(){return this},false,1419);this.dm("uniq",function(){for(var a=
54
+ [],b=[],c=0;c<this.length;c++){var h=this[c],p=h.hash().toString();if(b.indexOf(p)==-1){b.push(p);a.push(h)}}return a},false,1433);this.dm("uniq!",function(){for(var a=[],b=this.length,c=0;c<this.length;c++){var h=this[c].hash().toString();if(a.indexOf(h)==-1)a.push(h);else{this.splice(c,1);c--}}return this.length==b?this.n:this},false,1456);this.dm("unshift",function(a){a=Array.prototype.slice.call(arguments);for(var b=a.length-1;b>=0;b--)this.unshift(a[b]);return this},false,1481);this.dm("each_with_index",
55
+ function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=0;b<this.length;b++)try{a.apply(a.__self__,[this[b],b])}catch(c){if(c.__keyword__=="redo")b--;else if(c.__keyword__=="break")return c.opal_value;else throw c;}return this},false,1488);return this.dm("inspect",function(){var a=this.n;a=["["];this.$each_with_index(this.P(function(b,c){c["$>"](0).r&&a["$<<"](", ");return a["$<<"](b.$inspect())}));a["$<<"]("]");return a.$join("")},false,1507)},0)});
56
+ opal.load_raw_file("opal/lib/basic_object.rb",function(){return this.define_class(this.n,"BasicObject",function(){this.dm("initialize",function(){return this.n},false,29);this.dm("==",function(a){return this===a?this.t:this.f},false,33);this.dm("equal?",function(){return this.n},false,37);this.dm("!",function(){return this.f},false,41);return this.dm("!=",function(a){return this["$=="](a).r?this.f:this.t},false,45)},0)});
57
+ opal.load_raw_file("opal/lib/class.rb",function(){return this.define_class(this.n,"Class",function(){this.dm("include",function(a){return this.include(a)},false,29);this.dm("extend",function(a){return this.extend(a)},false,33);this.dm("allocate",function(){return new this.allocator},false,37);this.dm("new",function(a){return opal.__subclass("",a)},true,41);this.dm("new",function(){var a=this.n;a=this.$allocate();a.$initialize.apply(a,arguments);return a},false,45);return this.dm("initialize",function(){return this.$puts("in Class.new initialize")},
58
+ false,51)},0)});opal.load_raw_file("opal/lib/dir.rb",function(){return this.define_class(this.n,"Dir",function(){this.dm("getwd",function(){return opal.getwd},true,29);return this.dm("glob",function(a){return opal.glob_files(a)},true,33)},0)});
59
+ opal.load_raw_file("opal/lib/error.rb",function(){this.define_class(this.n,"Exception",function(){this.dm("message",function(){return this.ig("@message")},false,30);return this.dm("initialize",function(a){if(!a)a=this.n;return this.is("@message",a)},false,34)},0);this.define_class(this.const_get("Exception"),"RuntimeError",function(){},0);return this.define_class(this.const_get("Exception"),"StandardError",function(){},0)});
60
+ opal.load_raw_file("opal/lib/false_class.rb",function(){return this.define_class(this.n,"FalseClass",function(){this.dm("inspect",function(){return"false"},false,29);this.dm("to_s",function(){return"false"},false,33);this.dm("!",function(){return this.t},false,37);this.dm("&",function(){return this.f},false,41);this.dm("|",function(a){return a.r?this.t:this.f},false,45);return this.dm("^",function(a){return a.r?this.t:this.f},false,49)},0)});
61
+ opal.load_raw_file("opal/lib/file.rb",function(){return this.define_class(this.n,"File",function(){this.dm("join",function(a){a=Array.prototype.slice.call(arguments);return a.join("/")},true,33);this.dm("dirname",function(a){return a.substr(0,a.lastIndexOf("/"))},true,47);return this.dm("expand_path",function(a){if(a==undefined)a="";var b=a[0]==="/";a=a.split("/");for(var c=[],h,p=0;p<a.length;p++){h=a[p];switch(h){case "..":c.pop();break;case ".":break;case "":break;default:c.push(h)}}return b?"/"+
62
+ c.join("/"):opal.getwd+"/"+c.join("/")},true,51)},0)});
63
+ opal.load_raw_file("opal/lib/hash.rb",function(){return this.define_class(this.n,"Hash",function(){this.dm("[]",function(a){a=Array.prototype.slice.call(arguments);return vnH.apply(this,a)},true,44);this.dm("==",function(a){if(this===a)return this.t;if(!(a.info&this.TH))return this.f;if(this.__keys__.length!==a.__keys__.length)return this.f;for(var b=0;b<this.__keys__.length;b++){var c=this.__keys__[b].hash();if(!this.__assocs__[c]["$=="](a.__assocs__[c]).r)return this.f}return this.t},false,66);
64
+ this.$alias_method(this.Y("eql?"),this.Y("=="));this.dm("[]",function(a){return this.hash_fetch(a)},false,91);this.dm("[]=",function(a,b){return this.hash_store(a,b)},false,111);this.$alias_method(this.Y("store"),this.Y("[]="));this.dm("assoc",function(a){for(var b,c=0;c<this.__keys__.length;c++){b=this.__keys__[c];if(b["$=="](a).r)return[b,this.__assocs__[b.hash()]]}return this.n},false,130);this.dm("clear",function(){this.__keys__=[];this.__assocs__={};return this},false,149);this.dm("default",
65
+ function(){return this.__default__},false,171);this.dm("default=",function(a){return this.__default__=a},false,189);this.dm("delete",function(a){return this.hash_delete(a)},false,209);this.dm("delete_if",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b,c,h=0;h<this.__keys__.length;h++){b=this.__keys__[h];c=this.__assocs__[b.hash()];if(a.apply(a.__self__,[b,c]).r){this.hash_delete(b);h--}}return this},false,226);this.dm("each",function(){if(arguments.length>
66
+ 0&&arguments[0].info&this.TP)var a=arguments[0];for(var b,c,h=0;h<this.__keys__.length;h++){b=this.__keys__[h];c=this.__assocs__[b.hash()];a.apply(a.__self__,[b,c])}return this},false,253);this.$alias_method(this.Y("each_pair"),this.Y("each"));this.dm("each_key",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b,c=0;c<this.__keys__.length;c++){b=this.__keys__[c];a.apply(a.__self__,[b])}return this},false,274);this.dm("each_value",function(){if(arguments.length>
67
+ 0&&arguments[0].info&this.TP)var a=arguments[0];for(var b,c=0;c<this.__keys__.length;c++){b=this.__keys__[c];b=this.__assocs__[b.hash()];a.apply(a.__self__,[b])}return this},false,292);this.dm("empty?",function(){return this.__keys__.length==0?this.t:this.f},false,309);this.dm("fetch",function(a,b){var c=this.__assocs__[a.hash()];if(c!==undefined)return c;else if(b===undefined)throw"KeyError: key not found";else return b.info&this.TP?b.apply(b.__self__,[a]):b},false,333);this.dm("flatten",function(a){if(a==
68
+ undefined)a=1;for(var b=[],c,h,p=0;p<this.__keys__.length;p++){c=this.__keys__[p];h=this.__assocs__[c.hash()];b.push(c);if(h.info&this.TA)if(a==1)b.push(h);else{c=h.$flatten(a-1);b=b.concat(c)}else b.push(h)}return b},false,361);this.dm("has_key?",function(a){return this.__assocs__.hasOwnProperty(a.hash())?this.t:this.f},false,392);this.$alias_method(this.Y("include?"),this.Y("has_key?"));this.$alias_method(this.Y("key?"),this.Y("has_key?"));this.$alias_method(this.Y("member?"),this.Y("has_key?"));
69
+ this.dm("has_value?",function(a){for(var b,c=0;c<this.__keys__.length;c++){b=this.__keys__[c];b=this.__assocs__[b.hash()];if(a["$=="](b).r)return this.t}return this.f},false,411);this.$alias_method(this.Y("value?"),this.Y("has_value?"));this.dm("replace",function(a){this.__keys__=[];this.__assocs__={};for(var b=0;b<a.__keys__.length;b++){key=a.__keys__[b];val=a.__assocs__[key.hash()];this.hash_store(key,val)}return this},false,434);this.dm("inspect",function(){for(var a=["{"],b,c,h=0;h<this.__keys__.length;h++){b=
70
+ this.__keys__[h];c=this.__assocs__[b.hash()];h>0&&a.push(", ");a.push(b.$inspect());a.push("=>");a.push(c.$inspect())}a.push("}");return a.join("")},false,452);this.$alias_method(this.Y("to_s"),this.Y("inspect"));this.dm("invert",function(){for(var a=vnH(),b=0;b<this.__keys__.length;b++){key=this.__keys__[b];value=this.__assocs__[key.hash()];a.hash_store(value,key)}return a},false,477);this.dm("keep_if",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b,c,h=0;h<
71
+ this.__keys__.length;h++){b=this.__keys__[h];c=this.__assocs__[b.hash()];if(!a.apply(a.__self__,[b,c]).r){this.hash_delete(b);h--}}return this},false,500);this.dm("key",function(a){for(var b,c,h=0;h<this.__keys__.length;h++){b=this.__keys__[h];c=this.__assocs__[b.hash()];if(a["$=="](c).r)return b}return this.n},false,524);this.dm("keys",function(){return this.__keys__.slice()},false,545);this.dm("length",function(){return this.__keys__.length},false,560);this.$alias_method(this.Y("size"),this.Y("length"));
72
+ this.dm("merge",function(a){for(var b=vnH(),c,h,p=0;p<this.__keys__.length;p++){c=this.__keys__[p];h=this.__assocs__[c.hash()];b.hash_store(c,h)}for(p=0;p<a.__keys__.length;p++){c=a.__keys__[p];h=a.__assocs__[c.hash()];b.hash_store(c,h)}return b},false,584);this.dm("merge!",function(a){for(var b,c,h=0;h<a.__keys__.length;h++){b=a.__keys__[h];c=a.__assocs__[b.hash()];this.hash_store(b,c)}return this},false,617);this.$alias_method(this.Y("update"),this.Y("merge!"));this.dm("rassoc",function(a){for(var b,
73
+ c,h=0;h<this.__keys__.length;h++){b=this.__keys__[h];c=this.__assocs__[b.hash()];if(c["$=="](a).r)return[b,c]}return this.n},false,642);this.dm("reject",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=vnH(),c,h,p=0;p<this.__keys__.length;p++){c=this.__keys__[p];h=this.__assocs__[c.hash()];a.apply(a.__self__,[c,h]).r||b.hash_store(c,h)}return b},false,657);this.dm("reject!",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b,
74
+ c,h=this.__keys__.length,p=0;p<this.__keys__.length;p++){b=this.__keys__[p];c=this.__assocs__[b.hash()];if(a.apply(a.__self__,[b,c]).r){this.hash_delete(b);p--}}return this.__keys__.length==h?this.n:this},false,672);this.dm("select",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=vnH(),c,h,p=0;p<this.__keys__.length;p++){c=this.__keys__[p];h=this.__assocs__[c.hash()];a.apply(a.__self__,[c,h]).r&&b.hash_store(c,h)}return b},false,697);this.dm("select!",function(){if(arguments.length>
75
+ 0&&arguments[0].info&this.TP)var a=arguments[0];for(var b,c,h=this.__keys__.length,p=0;p<this.__keys__.length;p++){b=this.__keys__[p];c=this.__assocs__[b.hash()];if(!a.apply(a.__self__,[b,c]).r){this.hash_delete(b);p--}}return this.__keys__.length==h?this.n:this},false,712);this.dm("shift",function(){var a,b;if(this.__keys__.length>0){a=this.__keys__[0];b=this.__assocs__[a.hash()];this.hash_delete(a);return[a,b]}else return this.__default__},false,738);this.dm("to_a",function(){for(var a=[],b,c,h=
76
+ 0;h<this.__keys__.length;h++){b=this.__keys__[h];c=this.__assocs__[b.hash()];a.push([b,c])}return a},false,758);this.dm("to_hash",function(){return this},false,771);return this.dm("values",function(){for(var a=[],b=0;b<this.__keys__.length;b++)a.push(this.__assocs__[this.__keys__[b].hash()]);return a},false,783)},0)});
77
+ opal.load_raw_file("opal/lib/io.rb",function(){return this.define_class(this.n,"IO",function(){return this.dm("puts",function(a){a=Array.prototype.slice.call(arguments);a.$length()["$=="](0).r||a.$each(this.P(function(){}));return this.n},false,29)},0)});
78
+ opal.load_raw_file("opal/lib/match_data.rb",function(){return this.define_class(this.n,"MatchData",function(){this.dm("initialize",function(a){return this.is("@data",a)},false,29);return this.dm("inspect",function(){return["#<MatchData '",this.ig("@data")["$[]"](0).$to_s(),"'>"].join("")},false,33)},0)});
79
+ opal.load_raw_file("opal/lib/nil_class.rb",function(){return this.define_class(this.n,"NilClass",function(){this.dm("nil?",function(){return this.t},false,29);this.dm("!",function(){return this.t},false,33);this.dm("to_i",function(){return 0},false,37);this.dm("to_f",function(){return 0},false,41);this.dm("to_s",function(){return""},false,45);this.dm("to_a",function(){return[]},false,49);this.dm("inspect",function(){return"nil"},false,53);this.dm("&",function(){return this.f},false,57);this.dm("|",
80
+ function(a){return a.r?this.t:this.f},false,61);return this.dm("^",function(a){return a.r?this.t:this.f},false,65)},0)});
81
+ opal.load_raw_file("opal/lib/number.rb",function(){return this.define_class(this.n,"Number",function(){this.dm("+@",function(){return this},false,36);this.dm("-@",function(){return-this},false,47);this.dm("%",function(a){return this%a},false,55);this.$alias_method(this.Y("modulo"),this.Y("%"));this.dm("&",function(a){return this&a},false,65);this.dm("*",function(a){return this*a},false,73);this.dm("**",function(a){return Math.pow(this,a)},false,81);this.dm("+",function(a){return this+a},false,89);
82
+ this.dm("-",function(a){return this-a},false,97);this.dm("/",function(a){return this/a},false,105);this.dm("<",function(a){return this<a?this.t:this.f},false,114);this.dm("<=",function(a){return this<=a?this.t:this.f},false,123);this.dm(">",function(a){return this>a?this.t:this.f},false,132);this.dm(">=",function(a){return this>=a?this.t:this.f},false,141);this.dm("<<",function(a){return this<<a},false,149);this.dm(">>",function(a){return this>>a},false,157);this.dm("<=>",function(a){if(a.info&this.TN)if(this<
83
+ a)return-1;else{if(this>a)return 1}else return this.n;return 0},false,166);this.dm("==",function(a){return this.valueOf()===a.valueOf()?this.t:this.f},false,177);this.dm("^",function(a){return this^a},false,185);this.dm("abs",function(){return Math.abs(this)},false,198);this.$alias_method(this.Y("magnitude"),this.Y("abs"));this.dm("even?",function(){return this%2==0?this.t:this.f},false,207);this.dm("odd?",function(){return this%2==0?this.f:this.t},false,214);this.dm("next",function(){return parseInt(this)+
84
+ 1},false,227);this.$alias_method(this.Y("succ"),this.Y("next"));this.dm("pred",function(){return parseInt(this)-1},false,242);this.dm("upto",function(a,b){for(var c=b&&b.info&this.TP?b:this.n,h=this;h<=a;h++)c.apply(c.__self__,[h]);return this},false,264);this.dm("downto",function(a,b){for(var c=b&&b.info&this.TP?b:this.n,h=this;h>=a;h--)c.apply(c.__self__,[h]);return this},false,288);this.dm("times",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];for(var b=0;b<this;b++)a.apply(a.__self__,
85
+ [b]);return this},false,310);this.dm("|",function(a){return this|a},false,321);this.dm("zero?",function(){return this.valueOf()===0?this.t:this.f},false,328);this.dm("nonzero?",function(){return this.valueOf()===0?this.n:this},false,335);this.dm("~",function(){return~this},false,342);this.dm("ceil",function(){return Math.ceil(this)},false,359);this.dm("floor",function(){return Math.floor(this)},false,372);this.dm("integer?",function(){return this%1===0?this.t:this.f},false,379);this.dm("inspect",
86
+ function(){return this.toString()},false,383);this.dm("to_s",function(){return this.toString()},false,387);return this.dm("to_i",function(){return parseInt(this)},false,392)},0)});
87
+ opal.load_raw_file("opal/lib/proc.rb",function(){return this.define_class(this.n,"Proc",function(){this.dm("to_proc",function(){return this},false,29);this.dm("call",function(){if(this.__lambda__)try{return this.apply(this.__self__,[])}catch(a){if(a.__keyword__=="break")return a.opal_value;if(a.__keyword__=="next")return a.opal_value;if(a.__keyword__=="return")return a.opal_value;if(a.__keyword__=="redo")return arguments.callee.apply(this);throw a;}else return this.apply(this.__self__)},false,33);
88
+ this.dm("to_s",function(){return"#<"+this.class_name+":"+this.id+">"},false,70);return this.dm("inspect",function(){return this.$to_s()},false,74)},0)});
89
+ opal.load_raw_file("opal/lib/range.rb",function(){return this.define_class(this.n,"Range",function(){this.dm("new",function(a,b,c){if(!c)c=this.f;return this.R(a,b,c.r)},true,29);this.dm("length",function(){return this.__end__-this.__start__},false,36);this.dm("begin",function(){return this.__start__},false,40);this.dm("end",function(){return this.__end__},false,44);this.dm("===",function(a){return this["$include?"](a)},false,48);this.dm("cover?",function(a){return this["$include?"](a)},false,52);
90
+ this.dm("include?",function(a){return this.__start__<=a&&a<=this.__real_end__?this.t:this.f},false,56);return this.dm("exclude_end?",function(){return this.__exclusive__?this.t:this.f},false,60)},0)});
91
+ opal.load_raw_file("opal/lib/regexp.rb",function(){return this.define_class(this.n,"Regexp",function(){this.dm("inspect",function(){return this.toString()},false,44);this.dm("==",function(a){return this.toString()===a.toString()?this.t:this.f},false,59);this.dm("===",function(a){return this.exec(a)?this.t:this.f},false,77);this.$alias_method(this.Y("eql?"),this.Y("=="));return this.dm("match",function(a){var b=this.n;b=this.n;return(b=this.exec(a))?this.const_get("MatchData").$new(b):this.n},false,
92
+ 102)},0)});opal.load_raw_file("opal/lib/ruby.rb",function(){this.const_set("RUBY_PLATFORM",opal.ruby_platform)});
93
+ opal.load_raw_file("opal/lib/string.rb",function(){return this.define_class(this.n,"String",function(){this.dm("new",function(a){if(a==undefined)a="";return new String(a)},true,44);this.dm("*",function(a){for(var b=[],c=0;c<a;c++)b.push(this);return b.join("")},false,56);this.dm("+",function(a){return this+a},false,73);this.dm("<=>",function(a){if(a.info&this.TS)if(this>a)return 1;else{if(this<a)return-1}else return this.n;return 0},false,92);this.dm("==",function(a){return this.valueOf()===a.valueOf()?
94
+ this.t:this.f},false,104);this.dm("capitalize",function(){return this[0].toUpperCase()+this.substr(1).toLowerCase()},false,120);this.dm("casecmp",function(a){var b=this.toLowerCase();a=a.toLowerCase();if(a.info&b.TS)if(b>a)return 1;else{if(b<a)return-1}else return this.n;return 0},false,138);this.dm("downcase",function(){return this.toLowerCase()},false,154);this.dm("empty?",function(){return this==""?this.t:this.f},false,167);this.dm("end_with?",function(a){if(a==undefined)a="";return a!=""&&this.lastIndexOf(a)==
95
+ this.length-a.length?this.t:this.f},false,179);this.dm("eql?",function(a){return this==a?this.t:this.f},false,187);this.dm("include?",function(a){if(this.indexOf(a)!=-1)return this.t;return this.f},false,203);this.dm("index",function(a){a=this.indexOf(a);if(a!=-1)return a;return this.n},false,228);this.dm("inspect",function(){return'"'+this+'"'},false,247);this.dm("intern",function(){return this.Y(this)},false,274);this.$alias_method(this.Y("to_sym"),this.Y("intern"));this.dm("length",function(){return this.length},
96
+ false,283);this.$alias_method(this.Y("size"),this.Y("length"));this.dm("lstrip",function(){return this.replace(/^\s*/,"")},false,299);this.dm("reverse",function(){return this.split("").reverse().join("")},false,310);this.dm("slice",function(a,b){return this.substr(a,b)},false,316);this.dm("to_s",function(){return this},false,320);return this.dm("split",function(a){return this.split(a)},false,324)},0)});
97
+ opal.load_raw_file("opal/lib/symbol.rb",function(){return this.define_class(this.n,"Symbol",function(){this.dm("inspect",function(){return":"+this.__ptr__},false,29);this.dm("to_s",function(){return this.__ptr__},false,33);return this.dm("to_sym",function(){return this},false,37)},0)});opal.load_raw_file("opal/lib/top_self.rb",function(){this.dm("to_s",function(){return"main"},false,27);return this.dm("include",function(a){return this.const_get("Object").$include(a)},false,31)});
98
+ opal.load_raw_file("opal/lib/true_class.rb",function(){return this.define_class(this.n,"TrueClass",function(){this.dm("to_s",function(){return"true"},false,29);this.dm("&",function(a){return a.r?this.t:this.f},false,33);this.dm("|",function(){return this.t},false,37);return this.dm("^",function(a){return a.r?this.f:this.t},false,41)},0)});opal.register({name:"opal",files:{}});
99
+ opal.register({name:"browser",files:{"lib/browser/builder.rb":function(){return this.define_class(this.n,"Element",function(){return this.define_class(this.n,"Builder",function(){},0)},0)},"lib/browser/canvas_context.rb":function(){return this.define_class(this.n,"Element",function(){return this.define_class(this.n,"CanvasContext",function(){this.dm("initialize",function(a){this.__ctx__=a.__element__.getContext("2d");this.$begin_path();this.$move_to(30,30);this.$line_to(150,150);this.$bezier_curve_to(60,
100
+ 70,60,70,70,150);this.$line_to(30,30);return this.$fill(vnH(this.Y("fill_style"),"blue"))},false,45);this.dm("fill_style=",function(a){this.__ctx__.fillStyle=a;return this},false,59);this.dm("begin_path",function(){this.__ctx__.beginPath();return this},false,64);this.dm("move_to",function(a,b){this.__ctx__.moveTo(a,b);return this},false,69);this.dm("line_to",function(a,b){this.__ctx__.lineTo(a,b);return this},false,74);this.dm("bezier_curve_to",function(a,b,c,h,p,q){this.__ctx__.bezierCurveTo(a,b,
101
+ c,h,p,q);return this},false,79);this.dm("fill",function(a){if(a==undefined)a=vnH();this.$save();this.$set(a);this.__ctx__.fill();this.$restore();return this},false,84);this.dm("save",function(){this.__ctx__.save();return this},false,97);this.dm("restore",function(){this.__ctx__.restore();return this},false,102);return this.dm("set",function(a){if(a==undefined)a=vnH();a.$each(this.P(function(b,c){this.$puts(["sending ",b.$to_s(),"="].join(""));return this.$__send__([b.$to_s(),"="].join(""),c)}));return this},
102
+ false,107)},0)},0)},"lib/browser/dimensions.rb":function(){return this.define_class(this.n,"Element",function(){this.dm("size",function(){var a=this.n;a=this.__element__;return this.const_get("Size").$new(a.offsetWidth,a.offsetHeight)},false,37);return this.dm("position",function(){return this.n},false,47)},0)},"lib/browser/document.rb":function(){return this.define_class(this.n,"Document",function(){this.dm("[]",function(a){var b=this.n;b=a;return this.const_get("Symbol")["$==="](b).r?this.$find_by_id(a):
103
+ /^#/["$==="](b).r?this.$find_by_id(a.$slice(1,a.$length())):this.const_get("Element").$find_in_context(a,this)},true,59);this.dm("find_by_id",function(a){return this.const_get("Element").$from_native(document.getElementById(a.$to_s()))},true,75);this.is("@on_ready_actions",[]);this.is("@__ready__",this.f);this.dm("ready?",function(){if(arguments.length>0&&arguments[0].info&this.TP)var a=arguments[0];if((!a||!a.r?this.f:this.t).r)this.ig("@__ready__").r?this.rbYield(a,[]):this.ig("@on_ready_actions")["$<<"](a);
104
+ return this.ig("@__ready__")},true,83);this.dm("__make_ready",function(){this.is("@__ready__",this.t);return this.ig("@on_ready_actions").$each(this.P(function(a){return a.$call()}))},true,99);this.dm("body",function(){return this.const_get("Element").$from_native(document.body)},true,110);this.dm("traverse",function(a,b,c,h){c=[];for(a=a.__element__[b];a&&a.nodeType==1;){if(h.r)c.push(this.const_get("Element").$from_native(a));else return this.const_get("Element").$from_native(a);a=a[b]}return c},
105
+ true,122);opal.setDocumentReadyListener(function(){this.const_get("Document").$__make_ready()});this.__element__=document},2)},"lib/browser/element/attributes.rb":function(){return this.define_class(this.n,"Element",function(){this.dm("data",function(){return this.o(this.ig("@data"),function(){return this.is("@data",this.const_get("DataAttributeAccessor").$new(this))})},false,47);return this.define_class(this.n,"DataAttributeAccessor",function(){this.dm("initialize",function(a){this.is("@element",
106
+ a);this.__element__=a.__element__},false,53);this.dm("[]",function(){return this.n},false,62);this.dm("[]=",function(){return this.n},false,70);this.dm("has_key?",function(){return this.f},false,74);this.dm("include?",function(a){return this["$has_key?"](a)},false,78);return this.dm("member?",function(a){return this["$has_key?"](a)},false,82)},0)},0)},"lib/browser/element/css.rb":function(){return this.define_class(this.n,"Element",function(){this.dm("css",function(a,b,c){if(c==undefined)c=this.f;
107
+ var h=this.n;b=b.$to_s();h=a.__element__.style||a.__element__;b=b.replace(/[_-]\D/g,function(p){return p.charAt(1).toUpperCase()});return c["$=="](this.f).r?h[b]||"":h[b]=c},true,40);this.dm("css",function(a){if(a==undefined)a=this.n;var b=this.n;b=a;return this.n["$==="](b).r?this.o(this.ig("@style"),function(){return this.is("@style",this.const_get("StyleDeclaration").$new(this))}):this.const_get("Hash")["$==="](b).r?a.$each(this.P(function(c,h){return this.const_get("Element").$css(this,c,h)})):
108
+ this.const_get("String")["$==="](b).r||this.const_get("Symbol")["$==="](b).r?this.const_get("Element").$css(this,a):this.n},false,64);this.$alias_method(this.Y("style"),this.Y("css"));this.dm("has_class?",function(a){return this.$class_name().$__contains__(a.$to_s()," ")},false,93);this.dm("add_class",function(a){this["$has_class?"](a).r||this["$class_name="](this.$class_name()["$+"]([" ",a.$to_s()].join("")));return this},false,102);this.dm("add_classes",function(a){a=Array.prototype.slice.call(arguments);
109
+ a.$each(this.P(function(b){return this.$add_class(b)}));return this},false,111);this.dm("remove_class",function(a){a=a.$to_s();this.__element__.className=this.$class_name().replace(RegExp("(^|\\s)"+a+"(?:\\s|$)"),"$1");return this},false,122);this.dm("toggle_class",function(a){a=a.$to_s();this["$has_class?"](a).r?this.$remove_class(a):this.$add_class(a);return this},false,133);this.$alias_method(this.Y("__class__"),this.Y("class"));this.dm("class_name=",function(a){this.__element__.className=a.toString();
110
+ return this},false,147);this.$alias_method(this.Y("class="),this.Y("class_name="));this.dm("class",function(){return this.__element__.className||""},false,158);this.$alias_method(this.Y("class_name"),this.Y("class"));this.dm("set_class_names",function(a){var b=this.n;b=this.$class_name().$split(" ");a.$each(this.P(function(c,h){return b["$include?"](c).r?h.r?this.n:b.$delete(c):h.r?b["$<<"](c):this.n}));return this["$class_name="](b.$join(" "))},false,165);this.dm("visible?",function(){return this.const_get("Element").$css(this,
111
+ "display")["$!="]("none")},false,197);this.dm("hidden?",function(){return this.const_get("Element").$css(this,"display")["$=="]("none")},false,215);this.dm("hide",function(){this.const_get("Element").$css(this,this.Y("display"),"none");return this},false,231);this.dm("show",function(){this.const_get("Element").$css(this,this.Y("display"),"");return this},false,248);this.dm("toggle",function(){this["$visible?"]().r?this.$hide():this.$show();return this},false,258);this.dm("opacity=",function(){return this.$raise("not implemented")},
112
+ false,266);return this.define_class(this.n,"StyleDeclaration",function(){this.dm("initialize",function(a){this.__element__=a.__element__;this.__style__=a.__element__.style||a.__element__},false,277);this.dm("[]",function(a){return this.const_get("Element").$css(this,a)},false,282);return this.dm("[]=",function(a,b){return this.const_get("Element").$css(this,a,b)},false,286)},0)},0)},"lib/browser/element/form.rb":function(){return this.define_class(this.n,"Element",function(){this.dm("disable",function(){this.__element__.disabled=
113
+ true;return this},false,35);this.dm("enable",function(){this.__element__.disabled=false;return this},false,44);this.dm("enabled=",function(a){return a.r?this.$enable():this.$disable()},false,53);this.dm("enabled?",function(){return this.__element__.disabled?this.f:this.t},false,60);this.dm("disabled?",function(){return this.__element__.disabled?this.t:this.f},false,67);this.dm("focus",function(){this.__element__.focus();return this},false,74);this.dm("select",function(){this.__element__.select();
114
+ return this},false,82);this.dm("value=",function(a){var b=this.__element__,c=b.tagName.toLowerCase();if(c==="input"){b=this.__element__.type.toLowerCase();if(b=="checkbox"||b=="radio")throw"need to handle checkbox/radio";else this.__element__.value=a}else if(c=="textarea")b.value=a;return a},false,87);this.dm("value",function(){var a=this.__element__,b=a.tagName.toLowerCase();if(b=="input"){b=a.type.toLowerCase();if(b=="checkbox"||b=="radio")throw"need to handle checkbox.radio";else return a.value}else if(b==
115
+ "textarea")return a.value},false,107);this.dm("checked?",function(){return this.__element__.checked?this.t:this.f},false,127);this.dm("on?",function(){return this["$checked?"]()},false,132);this.dm("off?",function(){return this["$checked?"]()["$!"]()},false,137);return this.dm("checked=",function(){return this.n},false,141)},0)},"lib/browser/element.rb":function(){this.define_class(this.n,"Element",function(){this.dm("initialize",function(a,b){if(b==undefined)b=vnH();b||(b=vnH());this.__element__=
116
+ document.createElement(a.$to_s());return this.$set(b)},false,46);this.dm("from_native",function(a){var b=this.n;if(!a)return this.n;b=this.$allocate();b.__element__=a;return b},true,64);this.dm("body",function(){if(this.ig("@body_element").r)return this.ig("@body_element");this.is("@body_element",this.$from_native(document.body));return this.ig("@body_element")},true,78);this.dm("find_in_context",function(a,b){var c=this.n;if(a["$is_a?"](this.const_get("Symbol")).r)a="#"+a.$to_s();c=Sizzle(a,b.__element__);
117
+ return c.$map(this.P(function(h){return this.$from_native(h)}))},true,98);this.dm("find",function(a){return this.$class().$find_in_context(a,this)},false,113);this.dm("tag",function(){return this.o(this.ig("@tag"),function(){return this.is("@tag",this.Y(this.__element__.tagName.toLowerCase()))})},false,127);this.dm("html=",function(a){this.__element__.innerHTML=a;return this},false,146);this.dm("text",function(){var a=this.__element__;return a.innerText==null?a.textContent:a.innerText},false,160);
118
+ this.dm("text=",function(a){var b=this.__element__;if(b.textContent!==undefined)b.textContent=a.toString();else b.innerText=a.toString();return this},false,178);this.$alias_method(this.Y("content="),this.Y("text="));this.dm("id=",function(a){this.__element__.id=a.$to_s();return this},false,204);this.dm("id",function(){return this.__element__.id||this.n},false,220);this.dm("body?",function(){return this.f},false,231);this.dm("inspect",function(){var a=this.n;a=[["#<Element ",this.$tag().$to_s()].join("")];
119
+ this.$class_name()["$=="]("").r||a["$<<"]([" class_name='",this.$class_name().$to_s(),"'"].join(""));this.$id()["$=="]("").r||a["$<<"]([" id='",this.$id().$to_s(),"'"].join(""));a["$<<"](">");return a.$join("")},false,235);this.dm("set",function(a){return a.$each(this.P(function(b,c){return this.$__send__([b.$to_s(),"="].join(""),c)}))},false,257);this.dm("<<",function(a){return this.$append(a)},false,271);this.dm("append",function(a){this.__element__.appendChild(a.__element__);return this},false,
120
+ 279);this.dm("before",function(a){var b=this.__element__.parentNode;b&&b.insertBefore(a.__element__,this.__element__);return this},false,288);this.dm("after",function(a){var b=this.__element__.parentNode;b&&b.insertBefore(a.__element__,this.__element__.nextSibling);return this},false,300);this.dm("remove",function(){var a=this.__element__;a.parentNode&&a.parentNode.removeChild(a);return this},false,325);this.dm("destroy",function(){return this.$remove()},false,337);this.dm("empty?",function(){return/^\s*$/.test(this.__element__.innerHTML)?
121
+ this.t:this.f},false,361);this.dm("clear",function(){for(var a=this.__element__.childNodes,b=a.length;b>0;){var c=a[--b];c.parentNode&&c.parentNode.removeChild(c)}return this},false,383);this.dm("context",function(){return this.const_get("CanvasContext").$new(this)},false,400);this.dm("parent",function(){return this.const_get("Document").$traverse(this,"parentNode",this.n,this.f)},false,413);this.dm("parents",function(){return this.const_get("Document").$traverse(this,"parentNode",this.n,this.t)},
122
+ false,417);this.dm("next",function(){return this.const_get("Document").$traverse(this,"nextSibling",this.n,this.f)},false,421);this.dm("prev",function(){return this.const_get("Document").$traverse(this,"previousSibling",this.n,this.f)},false,425);this.dm("first",function(){return this.const_get("Document").$traverse(this,"firstChild",this.n,this.f)},false,429);this.dm("last",function(){return this.const_get("Document").$traverse(this,"lastChild",this.n,this.f)},false,433);this.dm("<<",function(a){this.$append(a);
123
+ return this},false,440);this.dm("element_offset",function(){var a=this.n,b=this.n;b=a=0;for(var c=this.__element__;c;){a+=c.offsetLeft;b+=c.offsetTop;c=c.offsetParent}return this.const_get("Point").$new(a,b)},false,450);this.const_set("VALID_HTML_TAGS",[this.Y("html"),this.Y("head"),this.Y("title"),this.Y("base"),this.Y("meta"),this.Y("link"),this.Y("style"),this.Y("script"),this.Y("body"),this.Y("div"),this.Y("dl"),this.Y("dt"),this.Y("dd"),this.Y("span"),this.Y("pre")]);return this.const_get("VALID_HTML_TAGS").$each(this.P(function(a){return this.$define_method(a,
124
+ this.P(function(b){var c=this.n;c=this.const_get("Element").$new(a,b);this["$<<"](c);return c}))}))},0);this.$require("browser/element/attributes");this.$require("browser/element/css");return this.$require("browser/element/form")},"lib/browser/event/dom_events.rb":function(){this.define_class(this.n,"Event",function(){return this.define_class(this.n,"DOMEvents",function(){this.dm("on",function(a,b){var c=b&&b.info&this.TP?b:this.n,h=this.n;h=this.const_get("Event");var p=function(w){w=h.$from_native(w);
125
+ w=c.apply(c.__self__,[w]);return w!==undefined&&w.r},q=this.__element__;q.addEventListener?q.addEventListener(a.$to_s(),p,false):q.attachEvent("on"+a.$to_s(),p);return this},false,38);return["mousedown","mouseup","mousemove"].$each(this.P(function(a){return this.$define_method(a,this.P(function(b){return b&&b.info&this.TP?this.$on(a,b):console.log("need to fire event: "+a)}))}))},2)},0);this.const_get("Element").$include(this.const_get("Event").const_get("DOMEvents"));return this.const_get("Document").$extend(this.const_get("Event").const_get("DOMEvents"))},
126
+ "lib/browser/event/event.rb":function(){this.define_class(this.n,"Event",function(){this.dm("from_native",function(a){var b=this.n;b=this.$allocate();a=a||window.event;var c=a.type,h=a.target||a.srcElement,p=a.which||a.keyCode,q=this.const_get("Event").const_get("KEYS")["$[]"](p);for(q.r||(q=this.Y(String.fromCharCode(p).toLowerCase()));h&&h.nodeType==3;)h=h.parentNode;b.__shift__=a.shiftKey?this.t:this.f;b.__alt__=a.altKey?this.t:this.f;b.__ctrl__=a.ctrlKey?this.t:this.f;b.__meta__=a.metaKey?this.t:
127
+ this.f;b.__code__=p;b.__key__=q;b.__event__=a;b.__type__=c;return b},true,35);this.dm("stop_propagation",function(){var a=this.__event__;if(a.stopPropagation)a.stopPropagation();else a.cancelBubble=true;return this},false,67);this.dm("prevent_default",function(){var a=this.__event__;if(a.preventDefault)a.preventDefault();else a.returnValue=false;return this},false,80);this.dm("stop!",function(){this.$stop_propagation();return this.$prevent_default()},false,93);this.dm("type",function(){this.ig("@type").r||
128
+ this.is("@type",vnY(this.__event__.type));return this.ig("@type")},false,101);this.dm("type=",function(a){return this.is("@type",a)},false,115);this.const_set("KEYS",vnH(8,this.Y("backspace"),9,this.Y("tab"),13,this.Y("enter"),27,this.Y("escape"),32,this.Y("space"),37,this.Y("left"),38,this.Y("up"),39,this.Y("right"),40,this.Y("down"),46,this.Y("delete")));this.dm("key",function(){return this.__key__||this.n},false,142);this.dm("shift?",function(){return this.__shift__},false,149);this.dm("alt?",
129
+ function(){return this.__alt__},false,156);this.dm("ctrl?",function(){return this.__ctrl__},false,163);return this.dm("meta?",function(){return this.__meta__},false,170)},0);this.$require("browser/event/trigger_events");return this.$require("browser/event/dom_events")},"lib/browser/event/trigger_events.rb":function(){return this.define_class(this.n,"Event",function(){return this.define_class(this.n,"TriggerEvents",function(){this.dm("on",function(a,b){var c=b&&b.info&this.TP?b:this.n;a=a.$to_sym();
130
+ this.is("@trigger_events",this.o(this.ig("@trigger_events"),function(){return vnH()}));this.o(this.ig("@trigger_events")["$[]"](a),function(){return this.ig("@trigger_events")["$[]="](a,[c])});return this},false,32);return this.dm("trigger",function(a,b){a=arguments[0];b=Array.prototype.slice.call(arguments,1);var c=this.n;this.$puts(["triggering ",a.$to_s()].join(""));a=a.$to_sym();this.a(this.ig("@trigger_events"),function(){return c=this.ig("@trigger_events")["$[]"](a)}).r&&c.$each(this.P(function(h){return h.$call(b["$[]"](0),
131
+ b["$[]"](1),b["$[]"](2))}));return this},false,40)},2)},0)},"lib/browser/geometry.rb":function(){this.define_class(this.n,"Point",function(){this.$attr_accessor(this.Y("x"),this.Y("y"));return this.dm("initialize",function(a,b){this.is("@x",a);return this.is("@y",b)},false,31)},0);this.define_class(this.n,"Size",function(){this.$attr_accessor(this.Y("height"),this.Y("width"));this.dm("initialize",function(a,b){this.is("@width",a);return this.is("@height",b)},false,41);return this.dm("inspect",function(){return["#<Size ",
132
+ this.ig("@width").$to_s(),", ",this.ig("@height").$to_s(),">"].join("")},false,46)},0);return this.define_class(this.n,"Rect",function(){this.$attr_accessor(this.Y("size"),this.Y("origin"));this.dm("initialize",function(a,b,c,h){this.is("@origin",this.const_get("Point").$new(a,b));return this.is("@size",this.const_get("Size").$new(c,h))},false,55);this.dm("x",function(){return this.$origin().$x()},false,60);this.dm("x=",function(a){return this.$origin()["$x="](a)},false,64);this.dm("y",function(){return this.$origin().$y()},
133
+ false,68);this.dm("y=",function(a){return this.$origin()["$y="](a)},false,72);this.dm("width",function(){return this.$size().$width()},false,76);this.dm("width=",function(a){return this.$size()["$width="](a)},false,80);this.dm("height",function(){return this.$size().$height()},false,84);this.dm("height=",function(a){return this.$size()["$height="](a)},false,88);return this.dm("contains_point?",function(a){return this.$x()<a.$x()&&this.$y()<a.$y()&&this.$x()+this.$width()>a.$x()&&this.$y()+this.$height()>
134
+ a.$y()?this.t:this.f},false,92)},0)},"lib/browser/json.rb":function(){return this.define_class(this.n,"JSON",function(){return this.dm("parse",function(a){if(a==undefined)a="";return a["$=="]("").r?this.$raise("JSON.parse empty string"):this.n},true,29)},2)},"lib/browser/request/request.rb":function(){this.$require("browser/event/trigger_events");return this.define_class(this.n,"Request",function(){this.$include(this.const_get("Event").const_get("TriggerEvents"));this.const_set("OPTIONS",vnH(this.Y("url"),
135
+ "",this.Y("data"),vnH(),this.Y("async"),this.t,this.Y("format"),this.n,this.Y("method"),"POST",this.Y("link"),"ignore",this.Y("is_success"),this.n,this.Y("emulation"),this.t,this.Y("url_encoded"),this.t,this.Y("encoding"),"utf-8",this.Y("eval_scripts"),this.f,this.Y("eval_response"),this.f,this.Y("timeout"),0,this.Y("no_cache"),this.f));this.$attr_reader(this.Y("status"));this.$attr_reader(this.Y("text"));this.dm("initialize",function(a){if(a==undefined)a=vnH();this.__xhr__=opal.request();this.is("@options",
136
+ this.const_get("OPTIONS").$merge(a));this.is("@headers",this.ig("@options")["$[]"](this.Y("headers")));this.is("@running",this.f);this.is("@status",0);return this.is("@text","")},false,84);["get","post","put","delete","GET","POST","PUT","DELETE"].$each(this.P(function(a){return this.$define_method(a,this.P(function(b){return this.$send(vnH(this.Y("data"),b,this.Y("method"),a))}))}));this.dm("send",function(a){if(a==undefined)a=vnH();var b=this.n,c=this.n,h=this.n;this.is("@running",this.t);b=this.Y("post");
137
+ c=this.o(a["$[]"](this.Y("url")),function(){return""});h=this;this.__xhr__.onreadystatechange=function(){h.$state_change()};this.__xhr__.open(b.$to_s().toUpperCase(),c,true);this.$trigger(this.Y("request"),this);this.__xhr__.send(null)},false,108);this.dm("running?",function(){return this.ig("@running")},false,137);this.dm("success?",function(){return this.ig("@status")>=200&&this.ig("@status")<300?this.t:this.f},false,144);this.dm("failed?",function(){return this["$success?"]()["$!"]()},false,151);
138
+ this.dm("state_change",function(){if(!(this.__xhr__.readyState!==4||!this.ig("@running").r)){this.__xhr__.onreadystatechange=function(){};this.is("@running",this.f);this.is("@status",0);try{this.is("@status",this.__xhr__.status)}catch(a){a=a.mid2jsid?a:this.rbNativeError(a);this.$puts("warning")}this.$puts(["our status is now ",this.ig("@status").$to_s()].join(""));if(this["$success?"]().r){this.is("@text",this.__xhr__.responseText||"");this.$trigger(this.Y("success"),this)}else{console.log(this.ig("@status"));
139
+ this.$puts(["aww :( ",this.ig("@status").$to_s()].join(""));this.$trigger(this.Y("failure"),this)}return this.$trigger(this.Y("complete"),this)}},false,155);return this.dm("cancel",function(){if(!this.ig("@running").r)return this;this.is("@running",this.f);this.__xhr__.abort();this.__xhr__.onreadystatechange=function(){};this.__xhr__=opal.request();this.$trigger(this.Y("cancel"));return this},false,191)},0)},"lib/browser/string.rb":function(){return this.define_class(this.n,"String",function(){return this.dm("__contains__",
140
+ function(a,b){if(b==undefined)b="";return(b+this+b).indexOf(b+a+b)>-1?this.t:this.f},false,35)},0)},"lib/browser/touch.rb":function(){return this.define_class(this.n,"Event",function(){return this.dm("changed_touches",function(){if(this.ig("@changed_touches").r)return this.ig("@changed_touches");return this.is("@changed_touches",this.__event__.changedTouches.$map(this.P(function(a){this.const_get("Touch").$from_native(a)})))},false,30)},0)},"lib/browser/window.rb":function(){return this.define_class(this.n,
141
+ "Window",function(){this.dm("window",function(){return this},true,29);return this.dm("document",function(){return this.const_get("Document")},true,33)},0)},"lib/browser.rb":function(){this.define_class(this.n,"Browser",function(){this.dm("opera?",function(){return this.o(this.ig("@__is_opera__"),function(){return this.is("@__is_opera__",opal.browser.opera?this.t:this.f)})},true,35);this.dm("safari?",function(){return this.o(this.ig("@__is_safari__"),function(){return this.is("@__is_safari__",opal.browser.safari?
142
+ this.t:this.f)})},true,42);this.dm("msie?",function(){return this.o(this.ig("@__is_msie__"),function(){return this.is("@__is_msie__",opal.browser.msie?this.t:this.f)})},true,50);this.dm("firefox?",function(){return this.o(this.ig("@__is_firefox__"),function(){return this.is("@__is_firefox__",opal.browser.firefox?this.t:this.f)})},true,57);this.dm("touch?",function(){return this.o(this.ig("@__is_touch__"),function(){return this.is("@__is_touch__","createTouch"in document?this.t:this.f)})},true,63);
143
+ this.dm("document",function(){if(this.ig("@document_element").r)return this.ig("@document_element");this.is("@document_element",this.const_get("Element").$from_native(document));return this.ig("@document_element")},true,75);this.dm("window",function(){if(this.ig("@window_element").r)return this.ig("@window_element");this.is("@window_element",this.const_get("Element").$from_native(window));return this.ig("@window_element")},true,87);return this.dm("alert",function(a){if(a==undefined)a="";return alert(a)},
144
+ true,98)},2);this.$require("browser/string");this.$require("browser/window");this.$require("browser/document");this.$require("browser/sizzle.js");this.$require("browser/element");this.$require("browser/event/event");this.$require("browser/geometry");this.$require("browser/request/request");this.$require("browser/builder");this.$require("browser/canvas_context");this.$require("browser/vml_context.js");this.$require("browser/dimensions");return this.$require("browser/touch")},"lib/browser/json_parse.js":function(){if(!this.JSON)this.JSON=
145
+ {};(function(){function a(r){return r<10?"0"+r:r}function b(r){p.lastIndex=0;return p.test(r)?'"'+r.replace(p,function(A){var x=H[A];return typeof x==="string"?x:"\\u"+("0000"+A.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+r+'"'}function c(r,A){var x,y,z,D,C=q,B,o=A[r];if(o&&typeof o==="object"&&typeof o.toJSON==="function")o=o.toJSON(r);if(typeof u==="function")o=u.call(A,r,o);switch(typeof o){case "string":return b(o);case "number":return isFinite(o)?String(o):"null";case "boolean":case "null":return String(o);
146
+ case "object":if(!o)return"null";q+=w;B=[];if(Object.prototype.toString.apply(o)==="[object Array]"){D=o.length;for(x=0;x<D;x+=1)B[x]=c(x,o)||"null";z=B.length===0?"[]":q?"[\n"+q+B.join(",\n"+q)+"\n"+C+"]":"["+B.join(",")+"]";q=C;return z}if(u&&typeof u==="object"){D=u.length;for(x=0;x<D;x+=1){y=u[x];if(typeof y==="string")if(z=c(y,o))B.push(b(y)+(q?": ":":")+z)}}else for(y in o)if(Object.hasOwnProperty.call(o,y))if(z=c(y,o))B.push(b(y)+(q?": ":":")+z);z=B.length===0?"{}":q?"{\n"+q+B.join(",\n"+q)+
147
+ "\n"+C+"}":"{"+B.join(",")+"}";q=C;return z}}if(typeof Date.prototype.toJSON!=="function"){Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+a(this.getUTCMonth()+1)+"-"+a(this.getUTCDate())+"T"+a(this.getUTCHours())+":"+a(this.getUTCMinutes())+":"+a(this.getUTCSeconds())+"Z":null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()}}var h=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
148
+ p=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,q,w,H={"\u0008":"\\b","\t":"\\t","\n":"\\n","\u000c":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},u;if(typeof JSON.stringify!=="function")JSON.stringify=function(r,A,x){var y;w=q="";if(typeof x==="number")for(y=0;y<x;y+=1)w+=" ";else if(typeof x==="string")w=x;if((u=A)&&typeof A!=="function"&&(typeof A!=="object"||typeof A.length!=="number"))throw Error("JSON.stringify");return c("",
149
+ {"":r})};if(typeof JSON.parse!=="function")JSON.parse=function(r,A){function x(z,D){var C,B,o=z[D];if(o&&typeof o==="object")for(C in o)if(Object.hasOwnProperty.call(o,C)){B=x(o,C);if(B!==undefined)o[C]=B;else delete o[C]}return A.call(z,D,o)}var y;r=String(r);h.lastIndex=0;if(h.test(r))r=r.replace(h,function(z){return"\\u"+("0000"+z.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(r.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
150
+ "]").replace(/(?:^|:|,)(?:\s*\[)+/g,""))){y=eval("("+r+")");return typeof A==="function"?x({"":y},""):y}throw new SyntaxError("JSON.parse");}})()},"lib/browser/sizzle.js":function(){(function(){function a(d){for(var e="",i,k=0;d[k];k++){i=d[k];if(i.nodeType===3||i.nodeType===4)e+=i.nodeValue;else if(i.nodeType!==8)e+=a(i.childNodes)}return e}function b(d,e,i,k,m,l){m=0;for(var t=k.length;m<t;m++){var s=k[m];if(s){s=s[d];for(var v=false;s;){if(s.sizcache===i){v=k[s.sizset];break}if(s.nodeType===1&&
151
+ !l){s.sizcache=i;s.sizset=m}if(s.nodeName.toLowerCase()===e){v=s;break}s=s[d]}k[m]=v}}}function c(d,e,i,k,m,l){m=0;for(var t=k.length;m<t;m++){var s=k[m];if(s){s=s[d];for(var v=false;s;){if(s.sizcache===i){v=k[s.sizset];break}if(s.nodeType===1){if(!l){s.sizcache=i;s.sizset=m}if(typeof e!=="string"){if(s===e){v=true;break}}else if(u.filter(e,[s]).length>0){v=s;break}}s=s[d]}k[m]=v}}}var h=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
152
+ p=0,q=Object.prototype.toString,w=false,H=true;[0,0].sort(function(){H=false;return 0});var u=function(d,e,i,k){i=i||[];var m=e=e||document;if(e.nodeType!==1&&e.nodeType!==9)return[];if(!d||typeof d!=="string")return i;var l=[],t,s,v,I,F=true,f=o(e),g=d,j;do{h.exec("");if(t=h.exec(g)){g=t[3];l.push(t[1]);if(t[2]){I=t[3];break}}}while(t);if(l.length>1&&A.exec(d))if(l.length===2&&r.relative[l[0]])s=E(l[0]+l[1],e);else for(s=r.relative[l[0]]?[e]:u(l.shift(),e);l.length;){d=l.shift();if(r.relative[d])d+=
153
+ l.shift();s=E(d,s)}else{if(!k&&l.length>1&&e.nodeType===9&&!f&&r.match.ID.test(l[0])&&!r.match.ID.test(l[l.length-1])){t=u.find(l.shift(),e,f);e=t.expr?u.filter(t.expr,t.set)[0]:t.set[0]}if(e){t=k?{expr:l.pop(),set:z(k)}:u.find(l.pop(),l.length===1&&(l[0]==="~"||l[0]==="+")&&e.parentNode?e.parentNode:e,f);s=t.expr?u.filter(t.expr,t.set):t.set;if(l.length>0)v=z(s);else F=false;for(;l.length;){t=j=l.pop();if(r.relative[j])t=l.pop();else j="";if(t==null)t=e;r.relative[j](v,t,f)}}else v=[]}v||(v=s);v||
154
+ u.error(j||d);if(q.call(v)==="[object Array]")if(F)if(e&&e.nodeType===1)for(d=0;v[d]!=null;d++){if(v[d]&&(v[d]===true||v[d].nodeType===1&&B(e,v[d])))i.push(s[d])}else for(d=0;v[d]!=null;d++)v[d]&&v[d].nodeType===1&&i.push(s[d]);else i.push.apply(i,v);else z(v,i);if(I){u(I,m,i,k);u.uniqueSort(i)}return i};u.uniqueSort=function(d){if(C){w=H;d.sort(C);if(w)for(var e=1;e<d.length;e++)d[e]===d[e-1]&&d.splice(e--,1)}return d};u.matches=function(d,e){return u(d,null,null,e)};u.find=function(d,e,i){var k;
155
+ if(!d)return[];for(var m=0,l=r.order.length;m<l;m++){var t=r.order[m],s;if(s=r.leftMatch[t].exec(d)){var v=s[1];s.splice(1,1);if(v.substr(v.length-1)!=="\\"){s[1]=(s[1]||"").replace(/\\/g,"");k=r.find[t](s,e,i);if(k!=null){d=d.replace(r.match[t],"");break}}}}k||(k=e.getElementsByTagName("*"));return{set:k,expr:d}};u.filter=function(d,e,i,k){for(var m=d,l=[],t=e,s,v,I=e&&e[0]&&o(e[0]);d&&e.length;){for(var F in r.filter)if((s=r.leftMatch[F].exec(d))!=null&&s[2]){var f=r.filter[F],g,j;j=s[1];v=false;
156
+ s.splice(1,1);if(j.substr(j.length-1)!=="\\"){if(t===l)l=[];if(r.preFilter[F])if(s=r.preFilter[F](s,t,i,l,k,I)){if(s===true)continue}else v=g=true;if(s)for(var n=0;(j=t[n])!=null;n++)if(j){g=f(j,s,n,t);var G=k^!!g;if(i&&g!=null)if(G)v=true;else t[n]=false;else if(G){l.push(j);v=true}}if(g!==undefined){i||(t=l);d=d.replace(r.match[F],"");if(!v)return[];break}}}if(d===m)if(v==null)u.error(d);else break;m=d}return t};u.error=function(d){throw"Syntax error, unrecognized expression: "+d;};var r=u.selectors=
157
+ {order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},
158
+ leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(d){return d.getAttribute("href")}},relative:{"+":function(d,e){var i=typeof e==="string",k=i&&!/\W/.test(e);i=i&&!k;if(k)e=e.toLowerCase();k=0;for(var m=d.length,l;k<m;k++)if(l=d[k]){for(;(l=l.previousSibling)&&l.nodeType!==1;);d[k]=i||l&&l.nodeName.toLowerCase()===e?l||false:l===e}i&&u.filter(e,d,true)},">":function(d,e){var i=typeof e==="string",k,m=0,l=d.length;if(i&&!/\W/.test(e))for(e=e.toLowerCase();m<l;m++){if(k=
159
+ d[m]){i=k.parentNode;d[m]=i.nodeName.toLowerCase()===e?i:false}}else{for(;m<l;m++)if(k=d[m])d[m]=i?k.parentNode:k.parentNode===e;i&&u.filter(e,d,true)}},"":function(d,e,i){var k=p++,m=c,l;if(typeof e==="string"&&!/\W/.test(e)){l=e=e.toLowerCase();m=b}m("parentNode",e,k,d,l,i)},"~":function(d,e,i){var k=p++,m=c,l;if(typeof e==="string"&&!/\W/.test(e)){l=e=e.toLowerCase();m=b}m("previousSibling",e,k,d,l,i)}},find:{ID:function(d,e,i){if(typeof e.getElementById!=="undefined"&&!i)return(d=e.getElementById(d[1]))?
160
+ [d]:[]},NAME:function(d,e){if(typeof e.getElementsByName!=="undefined"){for(var i=[],k=e.getElementsByName(d[1]),m=0,l=k.length;m<l;m++)k[m].getAttribute("name")===d[1]&&i.push(k[m]);return i.length===0?null:i}},TAG:function(d,e){return e.getElementsByTagName(d[1])}},preFilter:{CLASS:function(d,e,i,k,m,l){d=" "+d[1].replace(/\\/g,"")+" ";if(l)return d;l=0;for(var t;(t=e[l])!=null;l++)if(t)if(m^(t.className&&(" "+t.className+" ").replace(/[\t\n]/g," ").indexOf(d)>=0))i||k.push(t);else if(i)e[l]=false;
161
+ return false},ID:function(d){return d[1].replace(/\\/g,"")},TAG:function(d){return d[1].toLowerCase()},CHILD:function(d){if(d[1]==="nth"){var e=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(d[2]==="even"&&"2n"||d[2]==="odd"&&"2n+1"||!/\D/.test(d[2])&&"0n+"+d[2]||d[2]);d[2]=e[1]+(e[2]||1)-0;d[3]=e[3]-0}d[0]=p++;return d},ATTR:function(d,e,i,k,m,l){e=d[1].replace(/\\/g,"");if(!l&&r.attrMap[e])d[1]=r.attrMap[e];if(d[2]==="~=")d[4]=" "+d[4]+" ";return d},PSEUDO:function(d,e,i,k,m){if(d[1]==="not")if((h.exec(d[3])||
162
+ "").length>1||/^\w/.test(d[3]))d[3]=u(d[3],null,null,e);else{d=u.filter(d[3],e,i,true^m);i||k.push.apply(k,d);return false}else if(r.match.POS.test(d[0])||r.match.CHILD.test(d[0]))return true;return d},POS:function(d){d.unshift(true);return d}},filters:{enabled:function(d){return d.disabled===false&&d.type!=="hidden"},disabled:function(d){return d.disabled===true},checked:function(d){return d.checked===true},selected:function(d){return d.selected===true},parent:function(d){return!!d.firstChild},empty:function(d){return!d.firstChild},
163
+ has:function(d,e,i){return!!u(i[3],d).length},header:function(d){return/h\d/i.test(d.nodeName)},text:function(d){return"text"===d.type},radio:function(d){return"radio"===d.type},checkbox:function(d){return"checkbox"===d.type},file:function(d){return"file"===d.type},password:function(d){return"password"===d.type},submit:function(d){return"submit"===d.type},image:function(d){return"image"===d.type},reset:function(d){return"reset"===d.type},button:function(d){return"button"===d.type||d.nodeName.toLowerCase()===
164
+ "button"},input:function(d){return/input|select|textarea|button/i.test(d.nodeName)}},setFilters:{first:function(d,e){return e===0},last:function(d,e,i,k){return e===k.length-1},even:function(d,e){return e%2===0},odd:function(d,e){return e%2===1},lt:function(d,e,i){return e<i[3]-0},gt:function(d,e,i){return e>i[3]-0},nth:function(d,e,i){return i[3]-0===e},eq:function(d,e,i){return i[3]-0===e}},filter:{PSEUDO:function(d,e,i,k){var m=e[1],l=r.filters[m];if(l)return l(d,i,e,k);else if(m==="contains")return(d.textContent||
165
+ d.innerText||a([d])||"").indexOf(e[3])>=0;else if(m==="not"){e=e[3];i=0;for(k=e.length;i<k;i++)if(e[i]===d)return false;return true}else u.error("Syntax error, unrecognized expression: "+m)},CHILD:function(d,e){var i=e[1],k=d;switch(i){case "only":case "first":for(;k=k.previousSibling;)if(k.nodeType===1)return false;if(i==="first")return true;k=d;case "last":for(;k=k.nextSibling;)if(k.nodeType===1)return false;return true;case "nth":i=e[2];var m=e[3];if(i===1&&m===0)return true;var l=e[0],t=d.parentNode;
166
+ if(t&&(t.sizcache!==l||!d.nodeIndex)){var s=0;for(k=t.firstChild;k;k=k.nextSibling)if(k.nodeType===1)k.nodeIndex=++s;t.sizcache=l}k=d.nodeIndex-m;return i===0?k===0:k%i===0&&k/i>=0}},ID:function(d,e){return d.nodeType===1&&d.getAttribute("id")===e},TAG:function(d,e){return e==="*"&&d.nodeType===1||d.nodeName.toLowerCase()===e},CLASS:function(d,e){return(" "+(d.className||d.getAttribute("class"))+" ").indexOf(e)>-1},ATTR:function(d,e){var i=e[1];i=r.attrHandle[i]?r.attrHandle[i](d):d[i]!=null?d[i]:
167
+ d.getAttribute(i);var k=i+"",m=e[2],l=e[4];return i==null?m==="!=":m==="="?k===l:m==="*="?k.indexOf(l)>=0:m==="~="?(" "+k+" ").indexOf(l)>=0:!l?k&&i!==false:m==="!="?k!==l:m==="^="?k.indexOf(l)===0:m==="$="?k.substr(k.length-l.length)===l:m==="|="?k===l||k.substr(0,l.length+1)===l+"-":false},POS:function(d,e,i,k){var m=r.setFilters[e[2]];if(m)return m(d,i,e,k)}}},A=r.match.POS,x=function(d,e){return"\\"+(e-0+1)};for(var y in r.match){r.match[y]=RegExp(r.match[y].source+/(?![^\[]*\])(?![^\(]*\))/.source);
168
+ r.leftMatch[y]=RegExp(/(^(?:.|\r|\n)*?)/.source+r.match[y].source.replace(/\\(\d+)/g,x))}var z=function(d,e){d=Array.prototype.slice.call(d,0);if(e){e.push.apply(e,d);return e}return d};try{Array.prototype.slice.call(document.documentElement.childNodes,0)}catch(D){z=function(d,e){var i=e||[],k=0;if(q.call(d)==="[object Array]")Array.prototype.push.apply(i,d);else if(typeof d.length==="number")for(var m=d.length;k<m;k++)i.push(d[k]);else for(;d[k];k++)i.push(d[k]);return i}}var C;if(document.documentElement.compareDocumentPosition)C=
169
+ function(d,e){if(!d.compareDocumentPosition||!e.compareDocumentPosition){if(d==e)w=true;return d.compareDocumentPosition?-1:1}var i=d.compareDocumentPosition(e)&4?-1:d===e?0:1;if(i===0)w=true;return i};else if("sourceIndex"in document.documentElement)C=function(d,e){if(!d.sourceIndex||!e.sourceIndex){if(d==e)w=true;return d.sourceIndex?-1:1}var i=d.sourceIndex-e.sourceIndex;if(i===0)w=true;return i};else if(document.createRange)C=function(d,e){if(!d.ownerDocument||!e.ownerDocument){if(d==e)w=true;
170
+ return d.ownerDocument?-1:1}var i=d.ownerDocument.createRange(),k=e.ownerDocument.createRange();i.setStart(d,0);i.setEnd(d,0);k.setStart(e,0);k.setEnd(e,0);i=i.compareBoundaryPoints(Range.START_TO_END,k);if(i===0)w=true;return i};(function(){var d=document.createElement("div"),e="script"+(new Date).getTime();d.innerHTML="<a name='"+e+"'/>";var i=document.documentElement;i.insertBefore(d,i.firstChild);if(document.getElementById(e)){r.find.ID=function(k,m,l){if(typeof m.getElementById!=="undefined"&&
171
+ !l)return(m=m.getElementById(k[1]))?m.id===k[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===k[1]?[m]:undefined:[]};r.filter.ID=function(k,m){var l=typeof k.getAttributeNode!=="undefined"&&k.getAttributeNode("id");return k.nodeType===1&&l&&l.nodeValue===m}}i.removeChild(d);i=d=null})();(function(){var d=document.createElement("div");d.appendChild(document.createComment(""));if(d.getElementsByTagName("*").length>0)r.find.TAG=function(e,i){var k=i.getElementsByTagName(e[1]);
172
+ if(e[1]==="*"){for(var m=[],l=0;k[l];l++)k[l].nodeType===1&&m.push(k[l]);k=m}return k};d.innerHTML="<a href='#'></a>";if(d.firstChild&&typeof d.firstChild.getAttribute!=="undefined"&&d.firstChild.getAttribute("href")!=="#")r.attrHandle.href=function(e){return e.getAttribute("href",2)};d=null})();document.querySelectorAll&&function(){var d=u,e=document.createElement("div");e.innerHTML="<p class='TEST'></p>";if(!(e.querySelectorAll&&e.querySelectorAll(".TEST").length===0)){u=function(k,m,l,t){m=m||
173
+ document;if(!t&&m.nodeType===9&&!o(m))try{return z(m.querySelectorAll(k),l)}catch(s){}return d(k,m,l,t)};for(var i in d)u[i]=d[i];e=null}}();(function(){var d=document.createElement("div");d.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!d.getElementsByClassName||d.getElementsByClassName("e").length===0)){d.lastChild.className="e";if(d.getElementsByClassName("e").length!==1){r.order.splice(1,0,"CLASS");r.find.CLASS=function(e,i,k){if(typeof i.getElementsByClassName!=="undefined"&&
174
+ !k)return i.getElementsByClassName(e[1])};d=null}}})();var B=document.compareDocumentPosition?function(d,e){return!!(d.compareDocumentPosition(e)&16)}:function(d,e){return d!==e&&(d.contains?d.contains(e):true)},o=function(d){return(d=(d?d.ownerDocument||d:0).documentElement)?d.nodeName!=="HTML":false},E=function(d,e){for(var i=[],k="",m,l=e.nodeType?[e]:e;m=r.match.PSEUDO.exec(d);){k+=m[0];d=d.replace(r.match.PSEUDO,"")}d=r.relative[d]?d+"*":d;m=0;for(var t=l.length;m<t;m++)u(d,l[m],i);return u.filter(k,
175
+ i)};window.Sizzle=u})()},"lib/browser/vml_context.js":function(){if(!document.createElement("canvas").getContext){document.namespaces.add("v","urn:schemas-microsoft-com:vml","#default#VML");document.createStyleSheet().cssText="canvas { overflow:hidden; display:inline-block; width: 300px; height: 150px }"}}}});opal.require("browser");
data/lib/opal.rb CHANGED
@@ -26,6 +26,7 @@
26
26
 
27
27
  require 'fileutils'
28
28
  require 'base64'
29
+ require 'rubygems'
29
30
 
30
31
  module Vienna
31
32
 
@@ -52,12 +52,22 @@ module Vienna
52
52
  # raise "Not a valid project (no Opalfile)"
53
53
  # end
54
54
 
55
+
56
+
55
57
  @opalfile = nil
56
58
  @config = nil
57
59
 
58
60
  @build_options = build_options
59
61
  @project_root = project_root
60
62
  @targets = nil
63
+
64
+ # load_paths are where we might have an opal located - defaults to our
65
+ # system load paths and a 'opals' directory in the project itself. We add
66
+ # the opals dir to the start of the array, so any custom system opals will
67
+ # be used instead of the systems version (for custom/development means)
68
+ setup_load_paths
69
+
70
+
61
71
  # lets begin by loading our root opalfile
62
72
  # @opalfile = Opalfile.new(BASE_OPALFILE)
63
73
  opalfile
@@ -68,6 +78,25 @@ module Vienna
68
78
  # puts "######################################## DONE\n\n\n\n"
69
79
  end
70
80
 
81
+ def setup_load_paths
82
+ @load_paths = []
83
+ # first, add our system 'opals' directory
84
+ @load_paths << File.join(Vienna::PATH, 'opals')
85
+ # add all opals from 'opal', which are runtime, opal, browser, spec
86
+ @load_paths.unshift File.join(Vienna::PATH, 'opals', 'opal')
87
+ # if our project root has an 'opals' dir, add that.
88
+ local_opals = File.join(@project_root, 'opals')
89
+ if File.exist?(local_opals) and File.directory?(local_opals)
90
+ @load_paths.unshift local_opals
91
+ # hardcoded.. if we have an opal directory inside our opals, add each of
92
+ # those as we are using a development version of opal.
93
+ local_opal = File.join(local_opals, 'opal')
94
+ if File.exist?(local_opal) and File.directory?(local_opal)
95
+ @load_paths.unshift local_opal
96
+ end
97
+ end
98
+ end
99
+
71
100
  def project_name
72
101
  @project_name ||= File.basename @project_root
73
102
  end
@@ -140,17 +169,21 @@ module Vienna
140
169
  # if we already know about the target, skip it
141
170
  next if @targets.has_key?(target.to_s)
142
171
  # currently only look in our own opals/ root
143
- try_path = File.join(Vienna::PATH, 'opals', target.to_s)
144
-
145
- if File.exist?(try_path) and File.directory?(try_path)
146
- # found target, so add it
147
- target = add_target :target_name => target.to_s,
172
+ # try_path = File.join(Vienna::PATH, 'opals', target.to_s)
173
+ found = @load_paths.each do |load_path|
174
+ try_path = File.join load_path, target.to_s
175
+ if File.exist?(try_path) and File.directory?(try_path)
176
+ # found target, so add it
177
+ target = add_target :target_name => target.to_s,
148
178
  :target_type => :opal,
149
179
  :target_root => try_path,
150
180
  :project => self
151
- # search this target for all dependencies
152
- find_targets_for target, config
153
- else
181
+ # search this target for all dependencies
182
+ find_targets_for target, config
183
+ break true
184
+ end
185
+ end
186
+ unless found
154
187
  raise "Could not find required opal #{target}. (Required in #{the_target.target_name})"
155
188
  end
156
189
  end
@@ -172,6 +205,10 @@ module Vienna
172
205
  end
173
206
 
174
207
  def build!()
208
+ puts "load_paths:"
209
+ puts @load_paths
210
+
211
+
175
212
  # get main target and put it at the end
176
213
  all_targets = targets.each_value.to_a
177
214
 
@@ -0,0 +1,169 @@
1
+ #
2
+ # build.rb
3
+ # vienna
4
+ #
5
+ # Created by Adam Beynon.
6
+ # Copyright 2010 Adam Beynon.
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ # of this software and associated documentation files (the "Software"), to deal
10
+ # in the Software without restriction, including without limitation the rights
11
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ # copies of the Software, and to permit persons to whom the Software is
13
+ # furnished to do so, subject to the following conditions:
14
+ #
15
+ # The above copyright notice and this permission notice shall be included in
16
+ # all copies or substantial portions of the Software.
17
+ #
18
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ # THE SOFTWARE.
25
+ #
26
+
27
+ require 'optparse'
28
+ require 'fileutils'
29
+
30
+ module Opal
31
+
32
+ def self.build!(args = nil)
33
+ args ||= ARGV
34
+
35
+ options = {}
36
+
37
+ option_parser = OptionParser.new do |opt|
38
+ opt.banner = <<END
39
+ Usage:
40
+ opal build [source] [destination] [options]
41
+
42
+ Description:
43
+ Build the given ruby files to javascript
44
+
45
+ Options:
46
+ END
47
+
48
+ opt.separator ""
49
+
50
+ opt.on('-w', '--watch', 'watch the given files for changes') do
51
+ options[:watch] = true
52
+ end
53
+
54
+ opt.on_tail('-h', '--help', 'show usage') do
55
+ puts option_parser
56
+ exit
57
+ end
58
+
59
+ end
60
+
61
+ option_parser.parse!(args)
62
+
63
+ case args.length
64
+ when 1
65
+ options[:source] = args[0]
66
+ when 2
67
+ options[:source] = args[0]
68
+ options[:destination] = args[1]
69
+ else
70
+ puts option_parser
71
+ exit
72
+ end
73
+
74
+ Builder.new(options).build!
75
+ end
76
+
77
+ # Build some raw opal files into javascript, without the project system.
78
+ class Builder
79
+
80
+ # Options
81
+ #
82
+ # ### :source
83
+ #
84
+ # The source ruby file. Can either be a ruby file, a directory, or a glob
85
+ # for all files to compile
86
+ #
87
+ # ### :destination
88
+ #
89
+ # Where to build the given files to. Can be either a single file, or a
90
+ # directory to place the given files.
91
+ #
92
+ # ### :watch
93
+ #
94
+ # Watch the given sources for changes to automatically compile them.
95
+ #
96
+ # @param [Hash] options
97
+ def initialize(options)
98
+ source = options[:source]
99
+ destination = options[:destination]
100
+ @sources = {}
101
+
102
+ if File.exist?(source) && !File.directory?(source)
103
+ # single file
104
+ @sources[source] = (destination ||= source.gsub(/\.rb/, '.js'))
105
+ FileUtils.mkdir_p File.dirname(destination)
106
+ elsif File.exist?(source)
107
+ # directory
108
+ Dir.glob("#{source}/**/*.rb").each do |src|
109
+ if destination
110
+ dest = File.join(destination, File.basename(src, '.rb')) +'.js'
111
+ else
112
+ dest = File.join(File.dirname(src), File.basename(src, '.rb')) +'.js'
113
+ end
114
+ FileUtils.mkdir_p File.dirname(dest)
115
+ @sources[src] = dest
116
+ end
117
+ elsif /\*/.match source
118
+ puts "glob not yet supported"
119
+ else
120
+ raise "bad source"
121
+ end
122
+
123
+
124
+ # place each file => destination in here (glob + directory watch support)
125
+
126
+ @watch = options[:watch]
127
+ end
128
+
129
+ def build!
130
+ if @watch
131
+ puts "Watching for changes in files."
132
+ @sources.each do |source, destination|
133
+ build_file source, destination
134
+ end
135
+ loop do
136
+ @sources.each do |source, destination|
137
+ if File.stat(source).mtime > File.stat(destination).mtime
138
+ puts "change detected in #{source}"
139
+ build_file source, destination
140
+ end
141
+ end
142
+
143
+ begin
144
+ sleep 1
145
+ rescue Interrupt
146
+ puts
147
+ exit 0
148
+ end
149
+ end
150
+ else
151
+ @sources.each do |source, destination|
152
+ build_file source, destination
153
+ end
154
+ end
155
+ end
156
+
157
+ def build_file(source, destination)
158
+ # puts "need to build #{source} to #{destination}"
159
+ parser = Vienna::RubyParser.new source, File.read(source)
160
+ str = parser.build!
161
+
162
+ File.open(destination, 'w') do |out|
163
+ # fixme: quick hack.. we should be able to tell ruby parser that we want
164
+ # this code to be run (add (); ) by it being main, or something....
165
+ out.puts "#{str}.apply(opal.top_self);"
166
+ end
167
+ end
168
+ end
169
+ end
@@ -51,7 +51,7 @@ module Opal
51
51
  def setup_load_paths
52
52
  @load_paths = []
53
53
  %w{spec}.each do |opal|
54
- @load_paths << File.join(OPALS_PATH, opal, 'lib')
54
+ @load_paths << File.join(OPALS_PATH, 'opal', opal, 'lib')
55
55
  end
56
56
  # current dir is also in the load path..
57
57
  @load_paths << Dir.getwd