opal 0.3.20 → 0.3.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/.gitignore +2 -7
  2. data/.rspec +2 -0
  3. data/.travis.yml +11 -0
  4. data/Gemfile +8 -2
  5. data/LICENSE +2 -3
  6. data/README.md +106 -239
  7. data/Rakefile +58 -16
  8. data/bin/opal +1 -0
  9. data/core/array.rb +180 -160
  10. data/core/basic_object.rb +8 -4
  11. data/core/boolean.rb +6 -6
  12. data/core/class.rb +9 -15
  13. data/core/dir.rb +89 -0
  14. data/core/enumerable.rb +83 -86
  15. data/core/error.rb +9 -4
  16. data/core/file.rb +85 -0
  17. data/core/hash.rb +67 -67
  18. data/core/kernel.rb +38 -42
  19. data/core/module.rb +57 -54
  20. data/core/numeric.rb +41 -41
  21. data/core/proc.rb +1 -5
  22. data/core/range.rb +11 -11
  23. data/core/regexp.rb +27 -22
  24. data/core/runtime.js +152 -221
  25. data/core/string.rb +86 -73
  26. data/core/time.rb +22 -18
  27. data/docs/post.html +9 -0
  28. data/docs/pre.html +32 -0
  29. data/lib/opal.rb +43 -3
  30. data/lib/opal/builder.rb +9 -26
  31. data/lib/opal/grammar.rb +1 -1
  32. data/lib/opal/grammar.y +1 -1
  33. data/lib/opal/lexer.rb +21 -15
  34. data/lib/opal/parser.rb +100 -111
  35. data/lib/opal/rake_task.rb +66 -0
  36. data/lib/opal/scope.rb +13 -5
  37. data/lib/opal/version.rb +1 -1
  38. data/opal.gemspec +2 -0
  39. data/spec/browser_spec.rb +28 -0
  40. data/spec/builder/lib_name_for_spec.rb +1 -6
  41. data/spec/grammar/alias_spec.rb +1 -1
  42. data/spec/grammar/and_spec.rb +1 -1
  43. data/spec/grammar/array_spec.rb +1 -1
  44. data/spec/grammar/attrasgn_spec.rb +1 -1
  45. data/spec/grammar/begin_spec.rb +1 -1
  46. data/spec/grammar/block_spec.rb +1 -1
  47. data/spec/grammar/break_spec.rb +1 -1
  48. data/spec/grammar/call_spec.rb +1 -1
  49. data/spec/grammar/class_spec.rb +1 -1
  50. data/spec/grammar/const_spec.rb +1 -1
  51. data/spec/grammar/cvar_spec.rb +1 -1
  52. data/spec/grammar/def_spec.rb +1 -1
  53. data/spec/grammar/false_spec.rb +1 -1
  54. data/spec/grammar/file_spec.rb +1 -1
  55. data/spec/grammar/gvar_spec.rb +1 -1
  56. data/spec/grammar/hash_spec.rb +1 -1
  57. data/spec/grammar/iasgn_spec.rb +1 -1
  58. data/spec/grammar/if_spec.rb +1 -1
  59. data/spec/grammar/iter_spec.rb +1 -1
  60. data/spec/grammar/ivar_spec.rb +1 -1
  61. data/spec/grammar/lambda_spec.rb +1 -1
  62. data/spec/grammar/lasgn_spec.rb +1 -1
  63. data/spec/grammar/line_spec.rb +1 -1
  64. data/spec/grammar/lvar_spec.rb +1 -1
  65. data/spec/grammar/masgn_spec.rb +1 -1
  66. data/spec/grammar/module_spec.rb +1 -1
  67. data/spec/grammar/nil_spec.rb +1 -1
  68. data/spec/grammar/not_spec.rb +1 -1
  69. data/spec/grammar/op_asgn1_spec.rb +1 -1
  70. data/spec/grammar/op_asgn2_spec.rb +1 -1
  71. data/spec/grammar/or_spec.rb +1 -1
  72. data/spec/grammar/return_spec.rb +1 -1
  73. data/spec/grammar/sclass_spec.rb +1 -1
  74. data/spec/grammar/self_spec.rb +1 -1
  75. data/spec/grammar/str_spec.rb +1 -1
  76. data/spec/grammar/super_spec.rb +1 -1
  77. data/spec/grammar/true_spec.rb +1 -1
  78. data/spec/grammar/undef_spec.rb +1 -1
  79. data/spec/grammar/unless_spec.rb +1 -1
  80. data/spec/grammar/while_spec.rb +1 -1
  81. data/spec/grammar/xstr_spec.rb +1 -1
  82. data/spec/grammar/yield_spec.rb +1 -1
  83. data/spec/spec_helper.rb +6 -1
  84. data/test/core/array/minus_spec.rb +13 -0
  85. data/test/core/enumerable/drop_while_spec.rb +0 -5
  86. data/test/core/range/case_compare_spec.rb +0 -1
  87. data/test/index.html +1 -1
  88. data/test/index.min.html +12 -0
  89. data/test/language/alias_spec.rb +0 -4
  90. data/test/language/fixtures/next.rb +62 -0
  91. data/test/language/metaclass_spec.rb +4 -4
  92. data/test/language/next_spec.rb +0 -63
  93. data/test/language/send_spec.rb +0 -5
  94. data/test/language/singleton_class_spec.rb +4 -0
  95. data/test/opal/array/subclassing_spec.rb +1 -1
  96. data/test/opal/class/bridge_class_spec.rb +2 -2
  97. data/test/opal/runtime/class_hierarchy_spec.rb +1 -2
  98. data/test/opal/runtime/method_missing_spec.rb +17 -0
  99. data/test/spec_helper.rb +4 -1
  100. metadata +32 -28
  101. data/docs/CNAME +0 -1
  102. data/docs/Rakefile +0 -55
  103. data/docs/css/styles.css +0 -50
  104. data/docs/css/syntax.css +0 -63
  105. data/docs/layout/post.html +0 -3
  106. data/docs/layout/pre.html +0 -11
  107. data/examples/dependencies/.gitignore +0 -1
  108. data/examples/dependencies/Gemfile +0 -6
  109. data/examples/dependencies/README.md +0 -41
  110. data/examples/dependencies/Rakefile +0 -10
  111. data/examples/dependencies/app.rb +0 -19
  112. data/examples/dependencies/build/.gitkeep +0 -0
  113. data/examples/dependencies/index.html +0 -13
  114. data/examples/hello_world/.gitignore +0 -1
  115. data/examples/hello_world/Gemfile +0 -3
  116. data/examples/hello_world/README.md +0 -27
  117. data/examples/hello_world/Rakefile +0 -23
  118. data/examples/hello_world/app.rb +0 -7
  119. data/examples/hello_world/index.html +0 -12
  120. data/lib/opal/builder_task.rb +0 -91
  121. data/spec/builder/build_order_spec.rb +0 -20
  122. data/test/opal/runtime/_methods_spec.rb +0 -48
@@ -1,20 +0,0 @@
1
- require File.expand_path('../../spec_helper', __FILE__)
2
-
3
- describe "Builder#build_order" do
4
- before do
5
- @builder = Opal::Builder.new
6
- end
7
-
8
- it "should return the list of files in the right order to build" do
9
- @builder.build_order({ "a" => [], "b" => ["a"] }).should == ["a", "b"]
10
- @builder.build_order({ "c" => ["d"], "d" => [] }).should == ["d", "c"]
11
- end
12
-
13
- it "should ignore dependencies not in local files" do
14
- @builder.build_order({ "a" => ["b", "c"], "c" => [] }).should == ["c", "a"]
15
- end
16
-
17
- it "should include any files that don't get required" do
18
- @builder.build_order({ "a" => [], "b" => [], "c" => [] }).should == ["a", "b", "c"]
19
- end
20
- end
@@ -1,48 +0,0 @@
1
- class RuntimeMethodsSpec
2
- end
3
-
4
- class RuntimeMethodsSpec2
5
- def foo; end
6
- def bar; end
7
- end
8
-
9
- class RuntimeMethodsSpec3
10
- def woosh; end
11
- end
12
-
13
- class RuntimeMethodsSpec3
14
- def kapow; end
15
- end
16
-
17
- module RuntimeMethodsSpec4
18
- def ding; end
19
- end
20
-
21
- module RuntimeMethodsSpec4
22
- def dong; end
23
- end
24
-
25
- class RuntimeMethodsSpec5
26
- include RuntimeMethodsSpec4
27
-
28
- def thor; end
29
- end
30
-
31
- describe "Class._methods private array" do
32
- it "should store a list of all defined methods on classes as jsid's" do
33
- `#{RuntimeMethodsSpec}._methods`.should == []
34
- `#{RuntimeMethodsSpec2}._methods`.should == ['$foo', '$bar']
35
- end
36
-
37
- it "correctly adds methods when reopening classes" do
38
- `#{RuntimeMethodsSpec3}._methods`.should == ['$woosh', '$kapow']
39
- end
40
-
41
- it "should store methods for modules" do
42
- `#{RuntimeMethodsSpec4}._methods`.should == ['$ding', '$dong']
43
- end
44
-
45
- it "should not include methods from included modules" do
46
- `#{RuntimeMethodsSpec5}._methods`.should == ['$thor']
47
- end
48
- end