therubyracer-st 0.11.0beta5-x86-mingw32

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 (93) hide show
  1. data/.gitignore +23 -0
  2. data/.travis.yml +10 -0
  3. data/Changelog.md +242 -0
  4. data/Gemfile +15 -0
  5. data/README.md +185 -0
  6. data/Rakefile +58 -0
  7. data/benchmarks.rb +217 -0
  8. data/ext/v8/accessor.cc +181 -0
  9. data/ext/v8/array.cc +26 -0
  10. data/ext/v8/backref.cc +54 -0
  11. data/ext/v8/build.rb +53 -0
  12. data/ext/v8/constants.cc +34 -0
  13. data/ext/v8/constraints.cc +52 -0
  14. data/ext/v8/context.cc +130 -0
  15. data/ext/v8/date.cc +18 -0
  16. data/ext/v8/exception.cc +38 -0
  17. data/ext/v8/extconf.rb +23 -0
  18. data/ext/v8/external.cc +43 -0
  19. data/ext/v8/function.cc +58 -0
  20. data/ext/v8/gc.cc +43 -0
  21. data/ext/v8/handles.cc +34 -0
  22. data/ext/v8/heap.cc +31 -0
  23. data/ext/v8/init.cc +39 -0
  24. data/ext/v8/invocation.cc +86 -0
  25. data/ext/v8/locker.cc +77 -0
  26. data/ext/v8/message.cc +51 -0
  27. data/ext/v8/object.cc +334 -0
  28. data/ext/v8/primitive.cc +8 -0
  29. data/ext/v8/rr.cc +83 -0
  30. data/ext/v8/rr.h +883 -0
  31. data/ext/v8/script.cc +80 -0
  32. data/ext/v8/signature.cc +18 -0
  33. data/ext/v8/stack.cc +75 -0
  34. data/ext/v8/string.cc +47 -0
  35. data/ext/v8/template.cc +175 -0
  36. data/ext/v8/trycatch.cc +86 -0
  37. data/ext/v8/v8.cc +87 -0
  38. data/ext/v8/value.cc +239 -0
  39. data/lib/v8.rb +36 -0
  40. data/lib/v8/access.rb +5 -0
  41. data/lib/v8/access/indices.rb +40 -0
  42. data/lib/v8/access/invocation.rb +47 -0
  43. data/lib/v8/access/names.rb +65 -0
  44. data/lib/v8/array.rb +26 -0
  45. data/lib/v8/context.rb +243 -0
  46. data/lib/v8/conversion.rb +35 -0
  47. data/lib/v8/conversion/array.rb +11 -0
  48. data/lib/v8/conversion/class.rb +120 -0
  49. data/lib/v8/conversion/code.rb +38 -0
  50. data/lib/v8/conversion/fundamental.rb +11 -0
  51. data/lib/v8/conversion/hash.rb +11 -0
  52. data/lib/v8/conversion/indentity.rb +31 -0
  53. data/lib/v8/conversion/method.rb +26 -0
  54. data/lib/v8/conversion/object.rb +28 -0
  55. data/lib/v8/conversion/primitive.rb +7 -0
  56. data/lib/v8/conversion/proc.rb +5 -0
  57. data/lib/v8/conversion/reference.rb +16 -0
  58. data/lib/v8/conversion/string.rb +12 -0
  59. data/lib/v8/conversion/symbol.rb +7 -0
  60. data/lib/v8/conversion/time.rb +13 -0
  61. data/lib/v8/error.rb +25 -0
  62. data/lib/v8/error/protect.rb +20 -0
  63. data/lib/v8/error/try.rb +15 -0
  64. data/lib/v8/function.rb +28 -0
  65. data/lib/v8/helper.rb +30 -0
  66. data/lib/v8/object.rb +79 -0
  67. data/lib/v8/util/weakcell.rb +29 -0
  68. data/lib/v8/version.rb +3 -0
  69. data/spec/c/array_spec.rb +17 -0
  70. data/spec/c/constants_spec.rb +20 -0
  71. data/spec/c/exception_spec.rb +26 -0
  72. data/spec/c/external_spec.rb +9 -0
  73. data/spec/c/function_spec.rb +46 -0
  74. data/spec/c/handles_spec.rb +35 -0
  75. data/spec/c/locker_spec.rb +38 -0
  76. data/spec/c/object_spec.rb +46 -0
  77. data/spec/c/script_spec.rb +28 -0
  78. data/spec/c/string_spec.rb +16 -0
  79. data/spec/c/template_spec.rb +30 -0
  80. data/spec/c/trycatch_spec.rb +51 -0
  81. data/spec/mem/blunt_spec.rb +42 -0
  82. data/spec/redjs_spec.rb +10 -0
  83. data/spec/spec_helper.rb +45 -0
  84. data/spec/threading_spec.rb +52 -0
  85. data/spec/v8/context_spec.rb +19 -0
  86. data/spec/v8/conversion_spec.rb +9 -0
  87. data/spec/v8/error_spec.rb +21 -0
  88. data/spec/v8/function_spec.rb +9 -0
  89. data/spec/v8/object_spec.rb +15 -0
  90. data/thefrontside.png +0 -0
  91. data/therubyracer.gemspec +20 -0
  92. data/vendor/v8.dll +0 -0
  93. metadata +161 -0
@@ -0,0 +1,52 @@
1
+ require 'spec_helper'
2
+
3
+ describe "using v8 from multiple threads", :threads => true do
4
+
5
+ it "creates contexts from within threads" do
6
+ 10.times.collect do
7
+ Thread.new do
8
+ V8::Context.new
9
+ end
10
+ end.each {|t| t.join}
11
+ V8::Context.new
12
+ end
13
+
14
+ it "executes codes on multiple threads simultaneously" do
15
+ 5.times.collect{V8::Context.new}.collect do |ctx|
16
+ Thread.new do
17
+ ctx['x'] = 99
18
+ while ctx['x'] > 0
19
+ ctx.eval 'for (i=10000;i;i--){};--x'
20
+ end
21
+ end
22
+ end.each {|t| t.join}
23
+ end
24
+
25
+ it "can access the current thread id" do
26
+ V8::C::Locker() do
27
+ V8::C::V8::GetCurrentThreadId().should_not be_nil
28
+ end
29
+ end
30
+
31
+ it "can pre-empt a running JavaScript thread" do
32
+ pending "need to release the GIL while executing V8 code"
33
+ begin
34
+ V8::C::Locker::StartPreemption(2)
35
+ thread_id = nil
36
+ Thread.new do
37
+ loop until thread_id
38
+ puts "thread id: #{thread_id}"
39
+ V8::C::V8::TerminateExecution(thread_id)
40
+ end
41
+ Thread.new do
42
+ V8::C::Locker() do
43
+ thread_id = V8::C::V8::GetCurrentThreadId()
44
+ V8::Context.new {|cxt| cxt.eval('while (true) {}')}
45
+ end
46
+ end
47
+ V8::C::V8::TerminateExecution(thread_id)
48
+ ensure
49
+ V8::C::Locker::StopPreemption()
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe V8::Context do
4
+ it "can be disposed of" do
5
+ cxt = V8::Context.new
6
+ cxt.enter do
7
+ cxt['object'] = V8::Object.new
8
+ end
9
+ cxt.dispose()
10
+
11
+ lambda {cxt.eval('1 + 1')}.should raise_error
12
+ lambda {cxt['object']}.should raise_error
13
+ end
14
+
15
+ it "can be disposed of any number of times" do
16
+ cxt = V8::Context.new
17
+ 10.times {cxt.dispose()}
18
+ end
19
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+ require 'bigdecimal'
3
+ describe V8::Conversion do
4
+ it "can embed BigDecimal values" do
5
+ cxt = V8::Context.new
6
+ cxt['big'] = BigDecimal.new('1.1')
7
+ cxt['big'].should eql BigDecimal.new('1.1')
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe V8::Error do
4
+ it "uses the same ruby exception through multiple language boundaries" do
5
+ V8::Context.new do |cxt|
6
+ error = StandardError.new('potato')
7
+ cxt['one'] = lambda do
8
+ cxt.eval('two()', 'one.js')
9
+ end
10
+ cxt['two'] = lambda do
11
+ cxt.eval('three()', 'two.js')
12
+ end
13
+ cxt['three'] = lambda do
14
+ raise error
15
+ end
16
+ lambda {
17
+ cxt.eval('three()')
18
+ }.should raise_error {|e| e.should be error}
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,9 @@
1
+ require 'spec_helper'
2
+
3
+ describe V8::Function do
4
+ it "uses the global context if it is invoked with nil as the context" do
5
+ @cxt = V8::Context.new
6
+ @cxt['foo'] = 'bar'
7
+ @cxt.eval('(function() {return this.foo})').methodcall(nil).should eql 'bar'
8
+ end
9
+ end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe V8::Object do
4
+ before do
5
+ @object = V8::Context.new.eval('({foo: "bar", baz: "bang", qux: "qux1"})')
6
+ end
7
+
8
+ it "can list all keys" do
9
+ @object.keys.sort.should eql %w(baz foo qux)
10
+ end
11
+
12
+ it "can list all values" do
13
+ @object.values.sort.should eql %w(bang bar qux1)
14
+ end
15
+ end
Binary file
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/v8/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Charles Lowell", "stereobooster"]
6
+ gem.email = ["javascript-and-friends@googlegroups.com", "stereobooster@gmail.com"]
7
+ gem.summary = "Embed the V8 Javascript interpreter into Ruby"
8
+ gem.description = "Call javascript code and manipulate javascript objects from ruby. Call ruby code and manipulate ruby objects from javascript."
9
+ gem.homepage = "https://github.com/stereobooster/therubyracer/tree/therubyracer-st"
10
+
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = "therubyracer-st"
15
+ gem.extensions = ["ext/v8/extconf.rb"]
16
+ gem.require_paths = ["lib", "ext"]
17
+ gem.version = V8::VERSION
18
+
19
+ gem.add_dependency 'ref'
20
+ end
Binary file
metadata ADDED
@@ -0,0 +1,161 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: therubyracer-st
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.11.0beta5
5
+ prerelease: 6
6
+ platform: x86-mingw32
7
+ authors:
8
+ - Charles Lowell
9
+ - stereobooster
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2012-11-29 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: ref
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ description: Call javascript code and manipulate javascript objects from ruby. Call
32
+ ruby code and manipulate ruby objects from javascript.
33
+ email:
34
+ - javascript-and-friends@googlegroups.com
35
+ - stereobooster@gmail.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - .gitignore
41
+ - .travis.yml
42
+ - Changelog.md
43
+ - Gemfile
44
+ - README.md
45
+ - Rakefile
46
+ - benchmarks.rb
47
+ - ext/v8/accessor.cc
48
+ - ext/v8/array.cc
49
+ - ext/v8/backref.cc
50
+ - ext/v8/build.rb
51
+ - ext/v8/constants.cc
52
+ - ext/v8/constraints.cc
53
+ - ext/v8/context.cc
54
+ - ext/v8/date.cc
55
+ - ext/v8/exception.cc
56
+ - ext/v8/extconf.rb
57
+ - ext/v8/external.cc
58
+ - ext/v8/function.cc
59
+ - ext/v8/gc.cc
60
+ - ext/v8/handles.cc
61
+ - ext/v8/heap.cc
62
+ - ext/v8/init.cc
63
+ - ext/v8/invocation.cc
64
+ - ext/v8/locker.cc
65
+ - ext/v8/message.cc
66
+ - ext/v8/object.cc
67
+ - ext/v8/primitive.cc
68
+ - ext/v8/rr.cc
69
+ - ext/v8/rr.h
70
+ - ext/v8/script.cc
71
+ - ext/v8/signature.cc
72
+ - ext/v8/stack.cc
73
+ - ext/v8/string.cc
74
+ - ext/v8/template.cc
75
+ - ext/v8/trycatch.cc
76
+ - ext/v8/v8.cc
77
+ - ext/v8/value.cc
78
+ - lib/v8.rb
79
+ - lib/v8/access.rb
80
+ - lib/v8/access/indices.rb
81
+ - lib/v8/access/invocation.rb
82
+ - lib/v8/access/names.rb
83
+ - lib/v8/array.rb
84
+ - lib/v8/context.rb
85
+ - lib/v8/conversion.rb
86
+ - lib/v8/conversion/array.rb
87
+ - lib/v8/conversion/class.rb
88
+ - lib/v8/conversion/code.rb
89
+ - lib/v8/conversion/fundamental.rb
90
+ - lib/v8/conversion/hash.rb
91
+ - lib/v8/conversion/indentity.rb
92
+ - lib/v8/conversion/method.rb
93
+ - lib/v8/conversion/object.rb
94
+ - lib/v8/conversion/primitive.rb
95
+ - lib/v8/conversion/proc.rb
96
+ - lib/v8/conversion/reference.rb
97
+ - lib/v8/conversion/string.rb
98
+ - lib/v8/conversion/symbol.rb
99
+ - lib/v8/conversion/time.rb
100
+ - lib/v8/error.rb
101
+ - lib/v8/error/protect.rb
102
+ - lib/v8/error/try.rb
103
+ - lib/v8/function.rb
104
+ - lib/v8/helper.rb
105
+ - lib/v8/object.rb
106
+ - lib/v8/util/weakcell.rb
107
+ - lib/v8/version.rb
108
+ - spec/c/array_spec.rb
109
+ - spec/c/constants_spec.rb
110
+ - spec/c/exception_spec.rb
111
+ - spec/c/external_spec.rb
112
+ - spec/c/function_spec.rb
113
+ - spec/c/handles_spec.rb
114
+ - spec/c/locker_spec.rb
115
+ - spec/c/object_spec.rb
116
+ - spec/c/script_spec.rb
117
+ - spec/c/string_spec.rb
118
+ - spec/c/template_spec.rb
119
+ - spec/c/trycatch_spec.rb
120
+ - spec/mem/blunt_spec.rb
121
+ - spec/redjs_spec.rb
122
+ - spec/spec_helper.rb
123
+ - spec/threading_spec.rb
124
+ - spec/v8/context_spec.rb
125
+ - spec/v8/conversion_spec.rb
126
+ - spec/v8/error_spec.rb
127
+ - spec/v8/function_spec.rb
128
+ - spec/v8/object_spec.rb
129
+ - thefrontside.png
130
+ - therubyracer.gemspec
131
+ - vendor/v8.dll
132
+ - lib/v8/init.so
133
+ homepage: https://github.com/stereobooster/therubyracer/tree/therubyracer-st
134
+ licenses: []
135
+ post_install_message:
136
+ rdoc_options: []
137
+ require_paths:
138
+ - lib
139
+ - ext
140
+ required_ruby_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ segments:
147
+ - 0
148
+ hash: 435717455
149
+ required_rubygems_version: !ruby/object:Gem::Requirement
150
+ none: false
151
+ requirements:
152
+ - - ! '>'
153
+ - !ruby/object:Gem::Version
154
+ version: 1.3.1
155
+ requirements: []
156
+ rubyforge_project:
157
+ rubygems_version: 1.8.24
158
+ signing_key:
159
+ specification_version: 3
160
+ summary: Embed the V8 Javascript interpreter into Ruby
161
+ test_files: []