opal 0.4.1 → 0.4.2
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 +7 -0
- data/CHANGELOG.md +15 -0
- data/Rakefile +34 -10
- data/config.ru +2 -0
- data/lib/opal/cli.rb +12 -0
- data/lib/opal/parser.rb +3 -3
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +1 -0
- data/opal/opal.rb +2 -2
- data/opal/opal/array.rb +55 -12
- data/opal/opal/boolean.rb +1 -1
- data/opal/opal/kernel.rb +14 -2
- data/opal/opal/numeric.rb +1 -1
- data/opal/opal/regexp.rb +1 -1
- data/opal/opal/string.rb +1 -1
- data/spec/index.html +9 -0
- data/spec/opal/kernel/rand_spec.rb +9 -0
- data/spec/opal/runtime/main_methods_spec.rb +27 -0
- data/spec/rubyspec/core/array/new_spec.rb +34 -24
- metadata +21 -32
- data/spec/opal/runtime2/def_spec.rb +0 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 21f31bff5e89852e9643aec27ca8a41008a42130
|
4
|
+
data.tar.gz: 5958461f09fa61100fd1c3b8a95aed70705687bc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 2825d7fea9566cf8e272099bb73e902575aa0ae64aa8e81bde751f5ddbd5d5a0a6150c2faaea775308b666e5bc0925a190d92c05d58b011626967bb7ea457978
|
7
|
+
data.tar.gz: 0a0d9f6d6759512726088751d88518f75041b6c890d9f76a316a7dc75bb74e97bf37aaa250d640eba4e053078fe42d2c3a2a38f1025310fdb96c23fb14c3f5de
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## edge
|
2
|
+
|
3
|
+
## 0.4.2 2013-07-03
|
4
|
+
|
5
|
+
* Added `Kernel#rand`. (fntzr)
|
6
|
+
|
7
|
+
* Restored the `bin/opal` executable in gemspec.
|
8
|
+
|
9
|
+
* Now `.valueOf()` is used in `#to_n` of Boolean, Numeric, Regexp and String
|
10
|
+
to return the naked JavaScript value instead of a wrapping object.
|
11
|
+
|
12
|
+
* Parser now wraps or-ops in paranthesis to stop variable order from
|
13
|
+
leaking out when minified by uglify. We now have code in this
|
14
|
+
format: `(((tmp = lhs) !== false || !==nil) ? tmp : rhs)`.
|
15
|
+
|
1
16
|
## 0.4.1 2013-06-16
|
2
17
|
|
3
18
|
* Move sprockets logic out to external opal-sprockets gem. That now
|
data/Rakefile
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
Bundler.require
|
3
|
+
Bundler::GemHelper.install_tasks
|
3
4
|
|
4
5
|
require 'rack'
|
5
6
|
require 'webrick'
|
@@ -11,19 +12,19 @@ class RunSpec
|
|
11
12
|
|
12
13
|
ENV['OPAL_SPEC'] = file.nil? ? ["#{Dir.pwd}/spec/"].join(',') : file.join(',')
|
13
14
|
|
15
|
+
build_specs
|
16
|
+
|
14
17
|
server = fork do
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
Rack::Server.start(:app => serv, :Port => 9999, :AccessLog => [],
|
18
|
+
app = Rack::Builder.app do
|
19
|
+
use Rack::ShowExceptions
|
20
|
+
run Rack::Directory.new('.')
|
21
|
+
end
|
22
|
+
|
23
|
+
Rack::Server.start(:app => app, :Port => 9999, :AccessLog => [],
|
23
24
|
:Logger => WEBrick::Log.new("/dev/null"))
|
24
25
|
end
|
25
26
|
|
26
|
-
system "phantomjs \"spec/ospec/sprockets.js\" \"http://localhost:9999
|
27
|
+
system "phantomjs \"spec/ospec/sprockets.js\" \"http://localhost:9999/spec/index.html\""
|
27
28
|
success = $?.success?
|
28
29
|
|
29
30
|
exit 1 unless success
|
@@ -32,6 +33,29 @@ class RunSpec
|
|
32
33
|
Process.kill(:SIGINT, server)
|
33
34
|
Process.wait
|
34
35
|
end
|
36
|
+
|
37
|
+
def build_specs
|
38
|
+
env = Opal::Environment.new
|
39
|
+
env.append_path 'spec'
|
40
|
+
env.use_gem 'mspec'
|
41
|
+
|
42
|
+
FileUtils.mkdir_p 'build'
|
43
|
+
puts " * build/specs.js"
|
44
|
+
|
45
|
+
specs = uglify(env['ospec/main'].to_s)
|
46
|
+
File.open('build/specs.js', 'w+') { |o| o << specs }
|
47
|
+
end
|
48
|
+
|
49
|
+
# Only if OPAL_UGLIFY is set
|
50
|
+
def uglify(str)
|
51
|
+
if ENV['OPAL_UGLIFY']
|
52
|
+
require 'uglifier'
|
53
|
+
puts " * uglifying"
|
54
|
+
Uglifier.compile(str)
|
55
|
+
else
|
56
|
+
str
|
57
|
+
end
|
58
|
+
end
|
35
59
|
end
|
36
60
|
|
37
61
|
desc "Run tests through mspec"
|
@@ -55,7 +79,7 @@ task :build_specs do
|
|
55
79
|
puts " * build/specs.js"
|
56
80
|
specs = env['ospec/main'].to_s
|
57
81
|
|
58
|
-
|
82
|
+
puts " * build/specs.min.js"
|
59
83
|
# min = Uglifier.compile(specs)
|
60
84
|
|
61
85
|
File.open('build/specs.js', 'w+') { |o| o << specs }
|
data/config.ru
CHANGED
data/lib/opal/cli.rb
CHANGED
@@ -1,10 +1,22 @@
|
|
1
1
|
require 'opal'
|
2
2
|
|
3
|
+
begin
|
4
|
+
require 'opal-sprockets'
|
5
|
+
rescue LoadError
|
6
|
+
$stderr.puts 'Opal executable requires opal-sprockets to be fully functional.'
|
7
|
+
$stderr.puts 'You can install it with rubygems:'
|
8
|
+
$stderr.puts ''
|
9
|
+
$stderr.puts ' gem install opal-sprockets'
|
10
|
+
exit -1
|
11
|
+
end
|
12
|
+
|
3
13
|
module Opal
|
4
14
|
class CLI
|
5
15
|
attr_reader :options, :filename
|
6
16
|
|
7
17
|
def initialize _filename, options
|
18
|
+
require 'rack'
|
19
|
+
|
8
20
|
@options = options
|
9
21
|
@filename = _filename
|
10
22
|
|
data/lib/opal/parser.rb
CHANGED
@@ -198,7 +198,7 @@ module Opal
|
|
198
198
|
@scope.add_temp "__scope = __opal"
|
199
199
|
@scope.add_temp "$mm = __opal.mm"
|
200
200
|
@scope.add_temp "nil = __opal.nil"
|
201
|
-
@scope.add_temp "def =
|
201
|
+
@scope.add_temp "def = __opal.Object.prototype" if @scope.defines_defn
|
202
202
|
@helpers.keys.each { |h| @scope.add_temp "__#{h} = __opal.#{h}" }
|
203
203
|
|
204
204
|
vars = [fragment(INDENT, sexp), @scope.to_vars, fragment("\n", sexp)]
|
@@ -1210,7 +1210,7 @@ module Opal
|
|
1210
1210
|
elsif @scope.type == :iter
|
1211
1211
|
[fragment("def#{jsid} = ", sexp), result]
|
1212
1212
|
elsif @scope.type == :top
|
1213
|
-
[fragment("#{
|
1213
|
+
[fragment("def#{ jsid } = ", sexp), *result]
|
1214
1214
|
else
|
1215
1215
|
[fragment("def#{jsid} = ", sexp), result]
|
1216
1216
|
end
|
@@ -1804,7 +1804,7 @@ module Opal
|
|
1804
1804
|
with_temp do |tmp|
|
1805
1805
|
lhs = process lhs, :expr
|
1806
1806
|
rhs = process rhs, :expr
|
1807
|
-
|
1807
|
+
[fragment("(((#{tmp} = ", sexp), lhs, fragment(") !== false && #{tmp} !== nil) ? #{tmp} : ", sexp), rhs, fragment(")", sexp)]
|
1808
1808
|
end
|
1809
1809
|
end
|
1810
1810
|
|
data/lib/opal/version.rb
CHANGED
data/opal.gemspec
CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = 'Ruby runtime and core library for javascript.'
|
12
12
|
|
13
13
|
s.files = `git ls-files`.split("\n")
|
14
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
14
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
15
16
|
s.require_paths = ['lib']
|
16
17
|
|
data/opal/opal.rb
CHANGED
data/opal/opal/array.rb
CHANGED
@@ -8,28 +8,71 @@ class Array
|
|
8
8
|
objects
|
9
9
|
end
|
10
10
|
|
11
|
+
def initialize(*args)
|
12
|
+
self.class.new(*args)
|
13
|
+
end
|
14
|
+
|
11
15
|
def self.new(size = undefined, obj = nil, &block)
|
12
16
|
%x{
|
13
|
-
|
17
|
+
|
18
|
+
if (arguments.length > 2)
|
19
|
+
#{raise ArgumentError.new("wrong number of arguments. Array#new")};
|
20
|
+
|
21
|
+
if (arguments.length == 0)
|
22
|
+
return [];
|
23
|
+
|
24
|
+
var size,
|
25
|
+
obj = arguments[1],
|
26
|
+
arr = [];
|
14
27
|
|
15
|
-
if (
|
16
|
-
|
17
|
-
|
28
|
+
if (!obj) {
|
29
|
+
if (size['$to_ary'] && typeof(size['$to_ary']) == 'function'){
|
30
|
+
if (size['$is_a?'](Array))
|
31
|
+
return size;
|
32
|
+
return size['$to_ary']();
|
18
33
|
}
|
19
34
|
}
|
35
|
+
|
36
|
+
if (typeof(arguments[0]) == 'number')
|
37
|
+
size = arguments[0];
|
20
38
|
else {
|
21
|
-
if (
|
22
|
-
|
23
|
-
|
39
|
+
if (arguments[0]['$to_int'] && typeof(arguments[0]['$to_int']) == 'function' ) {
|
40
|
+
size = arguments[0]['$to_int']();
|
41
|
+
if (typeof(size) == 'number') {
|
42
|
+
if (size % 1 !== 0) {
|
43
|
+
#{raise TypeError.new("can't convert to Integer. Array#new")};
|
44
|
+
}
|
45
|
+
} else {
|
46
|
+
#{raise TypeError.new("can't convert to Integer. Array#new")};
|
24
47
|
}
|
48
|
+
} else {
|
49
|
+
#{raise TypeError.new("can't convert to Integer. Array#new")};
|
25
50
|
}
|
26
|
-
|
27
|
-
|
28
|
-
|
51
|
+
}
|
52
|
+
|
53
|
+
if (size < 0) {
|
54
|
+
#{raise ArgumentError.new("negative array size")};
|
55
|
+
}
|
56
|
+
|
57
|
+
if (obj == undefined) {
|
58
|
+
obj = nil;
|
59
|
+
}
|
60
|
+
|
61
|
+
|
62
|
+
if (block === nil)
|
63
|
+
for (var i = 0; i < size; i++) {
|
64
|
+
arr.push(obj);
|
65
|
+
}
|
66
|
+
else {
|
67
|
+
for (var i = 0, value; i < size; i++) {
|
68
|
+
value = block(i);
|
69
|
+
if (value === __breaker) {
|
70
|
+
return __breaker.$v;
|
29
71
|
}
|
72
|
+
arr[i] = block(i);
|
30
73
|
}
|
31
|
-
}
|
32
|
-
|
74
|
+
}
|
75
|
+
|
33
76
|
return arr;
|
34
77
|
}
|
35
78
|
end
|
data/opal/opal/boolean.rb
CHANGED
data/opal/opal/kernel.rb
CHANGED
@@ -378,14 +378,26 @@ module Kernel
|
|
378
378
|
end
|
379
379
|
|
380
380
|
def rand(max = undefined)
|
381
|
-
|
381
|
+
%x{
|
382
|
+
if(!max) {
|
383
|
+
return Math.random();
|
384
|
+
} else {
|
385
|
+
if (max._isRange) {
|
386
|
+
var arr = max.$to_a();
|
387
|
+
return arr[#{rand(`arr.length`)}];
|
388
|
+
} else {
|
389
|
+
return Math.floor(Math.random() * Math.abs(parseInt(max)));
|
390
|
+
}
|
391
|
+
}
|
392
|
+
}
|
382
393
|
end
|
383
394
|
|
384
395
|
def respond_to?(name)
|
385
396
|
`!!#{self}['$' + name]`
|
386
397
|
end
|
387
398
|
|
388
|
-
alias send
|
399
|
+
alias send __send__
|
400
|
+
alias public_send __send__
|
389
401
|
|
390
402
|
def singleton_class
|
391
403
|
%x{
|
data/opal/opal/numeric.rb
CHANGED
data/opal/opal/regexp.rb
CHANGED
data/opal/opal/string.rb
CHANGED
data/spec/index.html
ADDED
@@ -7,6 +7,15 @@ describe "Kernel.rand" do
|
|
7
7
|
rand(77).should be_kind_of(Integer)
|
8
8
|
end
|
9
9
|
|
10
|
+
it "return member from range" do
|
11
|
+
r = (1..10)
|
12
|
+
r.to_a.include?(rand(r)).should == true
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should convert negative number and convert to integer" do
|
16
|
+
rand(-0.1).should == 0
|
17
|
+
end
|
18
|
+
|
10
19
|
it "returns a numeric in opal" do
|
11
20
|
rand.should be_kind_of(Numeric)
|
12
21
|
rand(77).should be_kind_of(Numeric)
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
$OPAL_TOP_LEVEL_OBJECT = self
|
4
|
+
|
5
|
+
def self.some_main_method
|
6
|
+
3.142
|
7
|
+
end
|
8
|
+
|
9
|
+
def some_top_level_method_is_defined
|
10
|
+
42
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "Defining normal methods at the top level" do
|
14
|
+
it "should define them on Object, not main" do
|
15
|
+
Object.new.some_top_level_method_is_defined.should == 42
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
describe "Defining singleton methods on main" do
|
20
|
+
it "should define it on main directly" do
|
21
|
+
$OPAL_TOP_LEVEL_OBJECT.some_main_method.should == 3.142
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should not define the method for all Objects" do
|
25
|
+
lambda { Object.new.some_main_method }.should raise_error(NoMethodError)
|
26
|
+
end
|
27
|
+
end
|
@@ -10,9 +10,9 @@ describe "Array.new" do
|
|
10
10
|
ArraySpecs::MyArray.new(1, 2).should be_an_instance_of(ArraySpecs::MyArray)
|
11
11
|
end
|
12
12
|
|
13
|
-
|
13
|
+
it "raise an ArgumentError if passed 3 or more arguments" do
|
14
14
|
lambda do
|
15
|
-
|
15
|
+
Array.new(1, 'x', true)
|
16
16
|
end.should raise_error(ArgumentError)
|
17
17
|
lambda do
|
18
18
|
[1, 2].send(:initialize, 1, 'x', true) {}
|
@@ -21,7 +21,7 @@ describe "Array.new" do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "Array.new with no arguments" do
|
24
|
-
|
24
|
+
it "returns an empty array" do
|
25
25
|
Array.new.should be_empty
|
26
26
|
end
|
27
27
|
|
@@ -40,20 +40,19 @@ describe "Array.new with (array)" do
|
|
40
40
|
lambda{ Array.new([1, 2]) { raise } }.should_not raise_error
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
it "calls #to_ary to convert the value to an array" do
|
44
44
|
a = mock("array")
|
45
|
-
a.
|
46
|
-
a.should_not_receive(:to_int)
|
45
|
+
def a.to_ary; [1,2]; end
|
47
46
|
Array.new(a).should == [1, 2]
|
48
47
|
end
|
49
48
|
|
50
|
-
|
49
|
+
it "does not call #to_ary on instances of Array or subclasses of Array" do
|
51
50
|
a = [1, 2]
|
52
|
-
a.
|
53
|
-
Array.new(a)
|
51
|
+
def a.to_ary; [1,2,3]; end
|
52
|
+
Array.new(a).should == [1,2]
|
54
53
|
end
|
55
54
|
|
56
|
-
|
55
|
+
it "raises a TypeError if an Array type argument and a default object" do
|
57
56
|
lambda { Array.new([1, 2], 1) }.should raise_error(TypeError)
|
58
57
|
end
|
59
58
|
end
|
@@ -67,11 +66,11 @@ describe "Array.new with (size, object=nil)" do
|
|
67
66
|
a[1].should equal(obj)
|
68
67
|
end
|
69
68
|
|
70
|
-
it "returns an array of size filled with nil when object is omitted" do
|
69
|
+
it "returns an array of size filled with nil when object is omitted" do
|
71
70
|
Array.new(3).should == [nil, nil, nil]
|
72
71
|
end
|
73
72
|
|
74
|
-
|
73
|
+
it "raises an ArgumentError if size is negative" do
|
75
74
|
lambda { Array.new(-1, :a) }.should raise_error(ArgumentError)
|
76
75
|
lambda { Array.new(-1) }.should raise_error(ArgumentError)
|
77
76
|
end
|
@@ -92,22 +91,30 @@ describe "Array.new with (size, object=nil)" do
|
|
92
91
|
end
|
93
92
|
end
|
94
93
|
|
95
|
-
|
94
|
+
it "calls #to_int to convert the size argument to an Integer when object is given" do
|
96
95
|
obj = mock('1')
|
97
|
-
obj.
|
96
|
+
def obj.to_int; 1; end
|
98
97
|
Array.new(obj, :a).should == [:a]
|
99
98
|
end
|
100
99
|
|
101
|
-
|
100
|
+
it "calls #to_int to convert the size argument to an Integer when object is not given" do
|
102
101
|
obj = mock('1')
|
103
|
-
obj.
|
102
|
+
def obj.to_int; 1; end
|
104
103
|
Array.new(obj).should == [nil]
|
105
104
|
end
|
106
105
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
lambda{ Array.new(
|
106
|
+
it "raises a TypeError if the size argument is not an Integer type" do
|
107
|
+
obj1 = mock('nonnumeric')
|
108
|
+
def obj1.to_int; [1,2]; end
|
109
|
+
lambda{ Array.new(obj1, :a) }.should raise_error(TypeError)
|
110
|
+
|
111
|
+
obj2 = mock('nonnumeric')
|
112
|
+
def obj2.to_int; "123"; end
|
113
|
+
lambda{ Array.new(obj2, :a) }.should raise_error(TypeError)
|
114
|
+
|
115
|
+
obj3 = mock('nonnumeric')
|
116
|
+
def obj3.to_int; 1.2; end
|
117
|
+
lambda{ Array.new(obj3, :a) }.should raise_error(TypeError)
|
111
118
|
end
|
112
119
|
|
113
120
|
it "yields the index of the element and sets the element to the value of the block" do
|
@@ -118,12 +125,15 @@ describe "Array.new with (size, object=nil)" do
|
|
118
125
|
Array.new(3, :obj) { |i| i.to_s }.should == ['0', '1', '2']
|
119
126
|
end
|
120
127
|
|
121
|
-
|
122
|
-
|
128
|
+
it "returns the value passed to break" do
|
129
|
+
Array.new(3) do |i|
|
123
130
|
break if i == 2
|
124
131
|
i.to_s
|
125
|
-
end
|
132
|
+
end.should == nil
|
126
133
|
|
127
|
-
|
134
|
+
Array.new(3) do |i|
|
135
|
+
break 3 if i == 2
|
136
|
+
i.to_s
|
137
|
+
end.should == 3
|
128
138
|
end
|
129
139
|
end
|
metadata
CHANGED
@@ -1,36 +1,32 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.2
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Adam Beynon
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-07-03 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: source_map
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: mspec
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - '='
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,7 +34,6 @@ dependencies:
|
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - '='
|
44
39
|
- !ruby/object:Gem::Version
|
@@ -46,55 +41,48 @@ dependencies:
|
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: uglifier
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rake
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: racc
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: opal-sprockets
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
87
|
- - ~>
|
100
88
|
- !ruby/object:Gem::Version
|
@@ -102,14 +90,14 @@ dependencies:
|
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
94
|
- - ~>
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: 0.1.0
|
110
97
|
description: Ruby runtime and core library for javascript.
|
111
98
|
email: adam.beynon@gmail.com
|
112
|
-
executables:
|
99
|
+
executables:
|
100
|
+
- opal
|
113
101
|
extensions: []
|
114
102
|
extra_rdoc_files: []
|
115
103
|
files:
|
@@ -190,6 +178,7 @@ files:
|
|
190
178
|
- opal/source_map/vlq.rb
|
191
179
|
- opal/strscan.rb
|
192
180
|
- opal/yaml.rb
|
181
|
+
- spec/index.html
|
193
182
|
- spec/mspec/guards/block_device.rb
|
194
183
|
- spec/mspec/guards/endian.rb
|
195
184
|
- spec/mspec/helpers/environment.rb
|
@@ -243,10 +232,10 @@ files:
|
|
243
232
|
- spec/opal/proc/proc_tricks_spec.rb
|
244
233
|
- spec/opal/runtime/block_send_spec.rb
|
245
234
|
- spec/opal/runtime/eval_spec.rb
|
235
|
+
- spec/opal/runtime/main_methods_spec.rb
|
246
236
|
- spec/opal/runtime/send_spec.rb
|
247
237
|
- spec/opal/runtime2/call_spec.rb
|
248
238
|
- spec/opal/runtime2/class_hierarchy_spec.rb
|
249
|
-
- spec/opal/runtime2/def_spec.rb
|
250
239
|
- spec/opal/runtime2/defined_spec.rb
|
251
240
|
- spec/opal/runtime2/super_spec.rb
|
252
241
|
- spec/opal/source_map_spec.rb
|
@@ -715,29 +704,29 @@ files:
|
|
715
704
|
- spec/spec_helper.rb
|
716
705
|
homepage: http://opalrb.org
|
717
706
|
licenses: []
|
707
|
+
metadata: {}
|
718
708
|
post_install_message:
|
719
709
|
rdoc_options: []
|
720
710
|
require_paths:
|
721
711
|
- lib
|
722
712
|
required_ruby_version: !ruby/object:Gem::Requirement
|
723
|
-
none: false
|
724
713
|
requirements:
|
725
|
-
- -
|
714
|
+
- - '>='
|
726
715
|
- !ruby/object:Gem::Version
|
727
716
|
version: '0'
|
728
717
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
729
|
-
none: false
|
730
718
|
requirements:
|
731
|
-
- -
|
719
|
+
- - '>='
|
732
720
|
- !ruby/object:Gem::Version
|
733
721
|
version: '0'
|
734
722
|
requirements: []
|
735
723
|
rubyforge_project:
|
736
|
-
rubygems_version:
|
724
|
+
rubygems_version: 2.0.3
|
737
725
|
signing_key:
|
738
|
-
specification_version:
|
726
|
+
specification_version: 4
|
739
727
|
summary: Ruby runtime and core library for javascript
|
740
728
|
test_files:
|
729
|
+
- spec/index.html
|
741
730
|
- spec/mspec/guards/block_device.rb
|
742
731
|
- spec/mspec/guards/endian.rb
|
743
732
|
- spec/mspec/helpers/environment.rb
|
@@ -791,10 +780,10 @@ test_files:
|
|
791
780
|
- spec/opal/proc/proc_tricks_spec.rb
|
792
781
|
- spec/opal/runtime/block_send_spec.rb
|
793
782
|
- spec/opal/runtime/eval_spec.rb
|
783
|
+
- spec/opal/runtime/main_methods_spec.rb
|
794
784
|
- spec/opal/runtime/send_spec.rb
|
795
785
|
- spec/opal/runtime2/call_spec.rb
|
796
786
|
- spec/opal/runtime2/class_hierarchy_spec.rb
|
797
|
-
- spec/opal/runtime2/def_spec.rb
|
798
787
|
- spec/opal/runtime2/defined_spec.rb
|
799
788
|
- spec/opal/runtime2/super_spec.rb
|
800
789
|
- spec/opal/source_map_spec.rb
|
@@ -1,23 +0,0 @@
|
|
1
|
-
def def_test_bar
|
2
|
-
42
|
3
|
-
end
|
4
|
-
|
5
|
-
def self.def_test_foo
|
6
|
-
"bar"
|
7
|
-
end
|
8
|
-
|
9
|
-
$top_level_object = self
|
10
|
-
|
11
|
-
describe "Defining top level methods" do
|
12
|
-
it "should work with def self.x" do
|
13
|
-
$top_level_object.def_test_foo.should == "bar"
|
14
|
-
end
|
15
|
-
|
16
|
-
it "should work with def x" do
|
17
|
-
$top_level_object.def_test_bar.should == 42
|
18
|
-
end
|
19
|
-
|
20
|
-
it "defines methods on singleton class" do
|
21
|
-
Object.new.respond_to?(:def_test_bar).should == false
|
22
|
-
end
|
23
|
-
end
|