opal 0.8.0.rc1 → 0.8.0.rc2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3afa0a5d5b918de046d4985b97fa8464b5e73014
4
- data.tar.gz: a0a71fde911085d35f81cf363dd1d6569cb2119f
3
+ metadata.gz: e61445cf4e1d298823c1de6822ede17c133f10dc
4
+ data.tar.gz: dd4f67da6dde06a3f9ca8c82c15ff8f47b1957f9
5
5
  SHA512:
6
- metadata.gz: a64a3b104c5b74e7fece49e701449e0bc69d55883848622e5697cd69aa228203ad78ca8d692af4da0d81bc3b950b31cfbbb053c99a2ccfa0fe7048aded6787c1
7
- data.tar.gz: c1f7ca3700b01bac88d7c401d7d2affe59985738415a9dd82aebf2217943d81d61a50e37827f1114a727bf30b33e4a511ffad3ab7e8b606cc1c466023c10ddd8
6
+ metadata.gz: 2788eb5f67b8e7d9c7d18b952ebcc2bd40fa32b7e858330de25b87e8ffbfd2993af6e83396a2c4ab9cbe59c2bac2032e3bafc84f938814e67bc8d84fb9fd5aab
7
+ data.tar.gz: 45c31850bda55bb31a838ed42186f354146f98915031fe80d2e0c481a5ca7074a3d66b70049d6173470c3fadfc4bc9cf72051fc6da5c19c525e5eadb671408ed
data/.travis.yml CHANGED
@@ -4,6 +4,10 @@ sudo: false
4
4
 
5
5
  cache:
6
6
  bundler: true
7
+ directories:
8
+ - test/cruby
9
+ - spec/corelib
10
+ - /home/travis/.nvm/
7
11
 
8
12
  matrix:
9
13
  fast_finish: true
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## edge (upcoming 0.8.0)
2
2
 
3
+ * Fix `String#split` when no match is found and a limit is provided
4
+
5
+ * Fix `require_tree(".")` when used from file at the root of the assets paths
6
+
7
+ * `Hash[]` implementation fully compliant with rubyspec
8
+
3
9
  * Removed minitest from stdlib. It's not part of MRI and it never belonged there, checkout the opal-minitest gem instead.
4
10
 
5
11
  * Parser: Allow trailing comma in paren arglists, after normal args as
data/lib/opal/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  # WHEN RELEASING:
3
3
  # Remember to update RUBY_ENGINE_VERSION in opal/corelib/variables.rb too!
4
- VERSION = '0.8.0.rc1'
4
+ VERSION = '0.8.0.rc2'
5
5
  end
data/opal/corelib/hash.rb CHANGED
@@ -6,8 +6,53 @@ class Hash
6
6
  # Mark all hash instances as valid hashes (used to check keyword args, etc)
7
7
  `def.$$is_hash = true`
8
8
 
9
- def self.[](*objs)
10
- `Opal.hash.apply(null, objs)`
9
+ def self.[](*argv)
10
+ %x{
11
+ var hash, i, argc = argv.length;
12
+
13
+ if (argc === 1) {
14
+ hash = #{Opal.coerce_to?(argv[0], Hash, :to_hash)};
15
+ if (hash !== nil) {
16
+ return #{allocate.merge!(`hash`)};
17
+ }
18
+
19
+ argv = #{Opal.coerce_to?(argv[0], Array, :to_ary)};
20
+ if (argv === nil) {
21
+ #{raise ArgumentError, 'odd number of arguments for Hash'}
22
+ }
23
+
24
+ argc = argv.length;
25
+ hash = #{allocate};
26
+
27
+ for (i = 0; i < argc; i++) {
28
+ if (!argv[i].$$is_array) continue;
29
+ switch(argv[i].length) {
30
+ case 1:
31
+ hash.$store(argv[i][0], nil);
32
+ break;
33
+ case 2:
34
+ hash.$store(argv[i][0], argv[i][1]);
35
+ break;
36
+ default:
37
+ #{raise ArgumentError, "invalid number of elements (#{`argv[i].length`} for 1..2)"}
38
+ }
39
+ }
40
+
41
+ return hash;
42
+ }
43
+
44
+ if (argc % 2 !== 0) {
45
+ #{raise ArgumentError, 'odd number of arguments for Hash'}
46
+ }
47
+
48
+ hash = #{allocate};
49
+
50
+ for (i = 0; i < argc; i += 2) {
51
+ hash.$store(argv[i], argv[i + 1]);
52
+ }
53
+
54
+ return hash;
55
+ }
11
56
  end
12
57
 
13
58
  def self.allocate
@@ -1045,6 +1045,7 @@ module Kernel
1045
1045
  # `path` should be the full path to be found in registered modules (`Opal.modules`)
1046
1046
  def require_tree(path)
1047
1047
  path = File.expand_path(path)
1048
+ path = '' if path == '.'
1048
1049
 
1049
1050
  %x{
1050
1051
  for (var name in Opal.modules) {
@@ -991,6 +991,10 @@ class String
991
991
 
992
992
  result = string.split(pattern);
993
993
 
994
+ if (result.length === 1 && result[0] === string) {
995
+ return result;
996
+ }
997
+
994
998
  while ((i = result.indexOf(undefined)) !== -1) {
995
999
  result.splice(i, 1);
996
1000
  }
@@ -19,6 +19,6 @@ $SAFE = 0
19
19
 
20
20
  RUBY_PLATFORM = 'opal'
21
21
  RUBY_ENGINE = 'opal'
22
- RUBY_VERSION = '2.1.1'
23
- RUBY_ENGINE_VERSION = '0.8.0.rc1'
24
- RUBY_RELEASE_DATE = '2015-02-14'
22
+ RUBY_VERSION = '2.1.5'
23
+ RUBY_ENGINE_VERSION = '0.8.0.rc2'
24
+ RUBY_RELEASE_DATE = '2015-07-04'
@@ -1,15 +1,4 @@
1
1
  opal_filter "Hash" do
2
- fails "Hash.[] coerces a single argument which responds to #to_ary"
3
- fails "Hash.[] ignores elements that are not arrays"
4
- fails "Hash.[] calls to_hash"
5
- fails "Hash.[] returns an instance of a subclass when passed an Array"
6
- fails "Hash.[] returns instances of subclasses"
7
- fails "Hash.[] returns an instance of the class it's called on"
8
- fails "Hash.[] does not call #initialize on the subclass instance"
9
- fails "Hash.[] passed an array treats elements that are 1 element arrays as keys with value nil"
10
- fails "Hash.[] passed a single argument which responds to #to_hash coerces it and returns a copy"
11
- fails "Hash.[] removes the default_proc"
12
-
13
2
  fails "Hash#assoc only returns the first matching key-value pair for identity hashes"
14
3
 
15
4
  fails "Hash#default_proc= uses :to_proc on its argument"
@@ -114,7 +114,7 @@ describe "The predefined global constants" do
114
114
 
115
115
  it "includes RUBY_VERSION" do
116
116
  Object.const_defined?(:RUBY_VERSION).should == true
117
- RUBY_VERSION.should == "2.1.1"
117
+ RUBY_VERSION.should == "2.1.5"
118
118
  end
119
119
 
120
120
  it "includes RUBY_RELEASE_DATE" do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0.rc1
4
+ version: 0.8.0.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Beynon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-01 00:00:00.000000000 Z
11
+ date: 2015-07-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sourcemap
@@ -936,7 +936,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
936
936
  version: 1.3.1
937
937
  requirements: []
938
938
  rubyforge_project:
939
- rubygems_version: 2.4.5
939
+ rubygems_version: 2.4.6
940
940
  signing_key:
941
941
  specification_version: 4
942
942
  summary: Ruby runtime and core library for javascript