therubyracer-freebsd 0.10.1 → 0.11.1p2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. metadata +37 -109
  2. data/.gitignore +0 -13
  3. data/.rspec +0 -1
  4. data/.travis.yml +0 -8
  5. data/.yardopts +0 -1
  6. data/Changelog.md +0 -231
  7. data/Gemfile +0 -3
  8. data/README.md +0 -167
  9. data/Rakefile +0 -26
  10. data/bin/therubyracer +0 -11
  11. data/ext/v8/extconf.rb +0 -26
  12. data/ext/v8/rr.cpp +0 -189
  13. data/ext/v8/rr.h +0 -41
  14. data/ext/v8/v8.cpp +0 -48
  15. data/ext/v8/v8_array.cpp +0 -48
  16. data/ext/v8/v8_array.h +0 -8
  17. data/ext/v8/v8_callbacks.cpp +0 -81
  18. data/ext/v8/v8_callbacks.h +0 -8
  19. data/ext/v8/v8_context.cpp +0 -92
  20. data/ext/v8/v8_context.h +0 -6
  21. data/ext/v8/v8_date.cpp +0 -40
  22. data/ext/v8/v8_date.h +0 -6
  23. data/ext/v8/v8_debug.cpp +0 -17
  24. data/ext/v8/v8_debug.h +0 -6
  25. data/ext/v8/v8_exception.cpp +0 -133
  26. data/ext/v8/v8_exception.h +0 -11
  27. data/ext/v8/v8_external.cpp +0 -70
  28. data/ext/v8/v8_external.h +0 -8
  29. data/ext/v8/v8_function.cpp +0 -69
  30. data/ext/v8/v8_function.h +0 -11
  31. data/ext/v8/v8_handle.cpp +0 -186
  32. data/ext/v8/v8_handle.h +0 -48
  33. data/ext/v8/v8_locker.cpp +0 -139
  34. data/ext/v8/v8_locker.h +0 -6
  35. data/ext/v8/v8_message.cpp +0 -67
  36. data/ext/v8/v8_message.h +0 -10
  37. data/ext/v8/v8_object.cpp +0 -122
  38. data/ext/v8/v8_object.h +0 -10
  39. data/ext/v8/v8_script.cpp +0 -36
  40. data/ext/v8/v8_script.h +0 -8
  41. data/ext/v8/v8_string.cpp +0 -52
  42. data/ext/v8/v8_string.h +0 -9
  43. data/ext/v8/v8_template.cpp +0 -344
  44. data/ext/v8/v8_template.h +0 -8
  45. data/ext/v8/v8_try_catch.cpp +0 -70
  46. data/ext/v8/v8_try_catch.h +0 -5
  47. data/ext/v8/v8_v8.cpp +0 -34
  48. data/ext/v8/v8_v8.h +0 -6
  49. data/ext/v8/v8_value.cpp +0 -175
  50. data/ext/v8/v8_value.h +0 -10
  51. data/ext/v8/v8_weakref.cpp +0 -61
  52. data/ext/v8/v8_weakref.h +0 -29
  53. data/lib/v8/access.rb +0 -92
  54. data/lib/v8/array.rb +0 -17
  55. data/lib/v8/c/locker.rb +0 -18
  56. data/lib/v8/cli.rb +0 -133
  57. data/lib/v8/context.rb +0 -111
  58. data/lib/v8/error.rb +0 -130
  59. data/lib/v8/function.rb +0 -44
  60. data/lib/v8/object.rb +0 -69
  61. data/lib/v8/portal/caller.rb +0 -37
  62. data/lib/v8/portal/constructor.rb +0 -98
  63. data/lib/v8/portal/function.rb +0 -63
  64. data/lib/v8/portal/interceptors.rb +0 -152
  65. data/lib/v8/portal/proxies.rb +0 -151
  66. data/lib/v8/portal/templates.rb +0 -73
  67. data/lib/v8/portal.rb +0 -86
  68. data/lib/v8/stack.rb +0 -66
  69. data/lib/v8/tap.rb +0 -9
  70. data/lib/v8/version.rb +0 -3
  71. data/lib/v8.rb +0 -23
  72. data/spec/ext/array_spec.rb +0 -15
  73. data/spec/ext/cxt_spec.rb +0 -57
  74. data/spec/ext/ext_spec_helper.rb +0 -27
  75. data/spec/ext/func_spec.rb +0 -64
  76. data/spec/ext/object_spec.rb +0 -10
  77. data/spec/ext/string_spec.rb +0 -11
  78. data/spec/ext/try_catch_spec.rb +0 -60
  79. data/spec/redjs_spec.rb +0 -9
  80. data/spec/spec_helper.rb +0 -9
  81. data/spec/v8/error_spec.rb +0 -131
  82. data/spec/v8/portal/proxies_spec.rb +0 -106
  83. data/specmem/handle_memspec.rb +0 -41
  84. data/specmem/object_memspec.rb +0 -14
  85. data/specmem/proxies_memspec.rb +0 -49
  86. data/specmem/spec_helper.rb +0 -24
  87. data/specthread/spec_helper.rb +0 -2
  88. data/specthread/threading_spec.rb +0 -13
  89. data/thefrontside.png +0 -0
  90. data/therubyracer.gemspec +0 -27
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: therubyracer-freebsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
5
- prerelease:
4
+ version: 0.11.1p2
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Charles Lowell
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-06-09 00:00:00.000000000 Z
13
+ date: 2012-11-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: libv8-freebsd
17
- requirement: &70247217313560 !ruby/object:Gem::Requirement
17
+ requirement: !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ~>
@@ -22,10 +22,15 @@ dependencies:
22
22
  version: 3.3.10
23
23
  type: :runtime
24
24
  prerelease: false
25
- version_requirements: *70247217313560
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ version: 3.3.10
26
31
  - !ruby/object:Gem::Dependency
27
32
  name: rake
28
- requirement: &70247217312860 !ruby/object:Gem::Requirement
33
+ requirement: !ruby/object:Gem::Requirement
29
34
  none: false
30
35
  requirements:
31
36
  - - ! '>='
@@ -33,10 +38,15 @@ dependencies:
33
38
  version: '0'
34
39
  type: :development
35
40
  prerelease: false
36
- version_requirements: *70247217312860
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
37
47
  - !ruby/object:Gem::Dependency
38
48
  name: rspec
39
- requirement: &70247217311660 !ruby/object:Gem::Requirement
49
+ requirement: !ruby/object:Gem::Requirement
40
50
  none: false
41
51
  requirements:
42
52
  - - ~>
@@ -44,10 +54,15 @@ dependencies:
44
54
  version: '2.0'
45
55
  type: :development
46
56
  prerelease: false
47
- version_requirements: *70247217311660
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ~>
61
+ - !ruby/object:Gem::Version
62
+ version: '2.0'
48
63
  - !ruby/object:Gem::Dependency
49
64
  name: rake-compiler
50
- requirement: &70247217310960 !ruby/object:Gem::Requirement
65
+ requirement: !ruby/object:Gem::Requirement
51
66
  none: false
52
67
  requirements:
53
68
  - - ! '>='
@@ -55,112 +70,25 @@ dependencies:
55
70
  version: '0'
56
71
  type: :development
57
72
  prerelease: false
58
- version_requirements: *70247217310960
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
59
79
  description: Call javascript code and manipulate javascript objects from ruby. Call
60
80
  ruby code and manipulate ruby objects from javascript.
61
81
  email: cowboyd@thefrontside.net
62
- executables:
63
- - therubyracer
64
- extensions:
65
- - ext/v8/extconf.rb
82
+ executables: []
83
+ extensions: []
66
84
  extra_rdoc_files: []
67
- files:
68
- - .gitignore
69
- - .rspec
70
- - .travis.yml
71
- - .yardopts
72
- - Changelog.md
73
- - Gemfile
74
- - README.md
75
- - Rakefile
76
- - bin/therubyracer
77
- - ext/v8/extconf.rb
78
- - ext/v8/rr.cpp
79
- - ext/v8/rr.h
80
- - ext/v8/v8.cpp
81
- - ext/v8/v8_array.cpp
82
- - ext/v8/v8_array.h
83
- - ext/v8/v8_callbacks.cpp
84
- - ext/v8/v8_callbacks.h
85
- - ext/v8/v8_context.cpp
86
- - ext/v8/v8_context.h
87
- - ext/v8/v8_date.cpp
88
- - ext/v8/v8_date.h
89
- - ext/v8/v8_debug.cpp
90
- - ext/v8/v8_debug.h
91
- - ext/v8/v8_exception.cpp
92
- - ext/v8/v8_exception.h
93
- - ext/v8/v8_external.cpp
94
- - ext/v8/v8_external.h
95
- - ext/v8/v8_function.cpp
96
- - ext/v8/v8_function.h
97
- - ext/v8/v8_handle.cpp
98
- - ext/v8/v8_handle.h
99
- - ext/v8/v8_locker.cpp
100
- - ext/v8/v8_locker.h
101
- - ext/v8/v8_message.cpp
102
- - ext/v8/v8_message.h
103
- - ext/v8/v8_object.cpp
104
- - ext/v8/v8_object.h
105
- - ext/v8/v8_script.cpp
106
- - ext/v8/v8_script.h
107
- - ext/v8/v8_string.cpp
108
- - ext/v8/v8_string.h
109
- - ext/v8/v8_template.cpp
110
- - ext/v8/v8_template.h
111
- - ext/v8/v8_try_catch.cpp
112
- - ext/v8/v8_try_catch.h
113
- - ext/v8/v8_v8.cpp
114
- - ext/v8/v8_v8.h
115
- - ext/v8/v8_value.cpp
116
- - ext/v8/v8_value.h
117
- - ext/v8/v8_weakref.cpp
118
- - ext/v8/v8_weakref.h
119
- - lib/v8.rb
120
- - lib/v8/access.rb
121
- - lib/v8/array.rb
122
- - lib/v8/c/locker.rb
123
- - lib/v8/cli.rb
124
- - lib/v8/context.rb
125
- - lib/v8/error.rb
126
- - lib/v8/function.rb
127
- - lib/v8/object.rb
128
- - lib/v8/portal.rb
129
- - lib/v8/portal/caller.rb
130
- - lib/v8/portal/constructor.rb
131
- - lib/v8/portal/function.rb
132
- - lib/v8/portal/interceptors.rb
133
- - lib/v8/portal/proxies.rb
134
- - lib/v8/portal/templates.rb
135
- - lib/v8/stack.rb
136
- - lib/v8/tap.rb
137
- - lib/v8/version.rb
138
- - spec/ext/array_spec.rb
139
- - spec/ext/cxt_spec.rb
140
- - spec/ext/ext_spec_helper.rb
141
- - spec/ext/func_spec.rb
142
- - spec/ext/object_spec.rb
143
- - spec/ext/string_spec.rb
144
- - spec/ext/try_catch_spec.rb
145
- - spec/redjs_spec.rb
146
- - spec/spec_helper.rb
147
- - spec/v8/error_spec.rb
148
- - spec/v8/portal/proxies_spec.rb
149
- - specmem/handle_memspec.rb
150
- - specmem/object_memspec.rb
151
- - specmem/proxies_memspec.rb
152
- - specmem/spec_helper.rb
153
- - specthread/spec_helper.rb
154
- - specthread/threading_spec.rb
155
- - thefrontside.png
156
- - therubyracer.gemspec
85
+ files: []
157
86
  homepage: http://github.com/cowboyd/therubyracer
158
87
  licenses: []
159
88
  post_install_message:
160
89
  rdoc_options: []
161
90
  require_paths:
162
91
  - lib
163
- - ext
164
92
  required_ruby_version: !ruby/object:Gem::Requirement
165
93
  none: false
166
94
  requirements:
@@ -170,12 +98,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
98
  required_rubygems_version: !ruby/object:Gem::Requirement
171
99
  none: false
172
100
  requirements:
173
- - - ! '>='
101
+ - - ! '>'
174
102
  - !ruby/object:Gem::Version
175
- version: '0'
103
+ version: 1.3.1
176
104
  requirements: []
177
105
  rubyforge_project: therubyracer
178
- rubygems_version: 1.8.11
106
+ rubygems_version: 1.8.23
179
107
  signing_key:
180
108
  specification_version: 3
181
109
  summary: Embed the V8 Javascript interpreter into Ruby
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- .bundle
2
- .rvmrc
3
- Gemfile.lock
4
- v8.bundle
5
- v8.so
6
- *.o
7
- *.gem
8
- *.rbc
9
- *.log
10
- *~
11
- pkg/
12
- tmp/
13
- .yardoc/
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --colour
data/.travis.yml DELETED
@@ -1,8 +0,0 @@
1
- rvm:
2
- - 1.9.2
3
- - 1.9.3
4
- - 1.8.7
5
- notifications:
6
- recipients:
7
- - cowboyd@thefrontside.net
8
- script: bundle exec rake compile spec
data/.yardopts DELETED
@@ -1 +0,0 @@
1
- lib/**/*.rb ext/**/*.cpp
data/Changelog.md DELETED
@@ -1,231 +0,0 @@
1
- # Changelog
2
-
3
- ## 0.x
4
-
5
- * include redjs http://github.com/cowboyd/redjs as gem
6
-
7
- ## 0.10.1 2012/04/05
8
-
9
- * [bugfix] V8::Object#respond_to? did not call super
10
-
11
- ## 0.10.0 2012/03/28
12
-
13
- * [incompatible] embedded lambdas now take JS `this` object as first object
14
- * add sponsorship image to the README
15
- * enable Travis CI
16
-
17
- ## 0.9.9 2012/11/08
18
-
19
- * remove GCC specific C++ extension to fix llvm build.
20
-
21
- ## 0.9.8 2012/11/07
22
-
23
- * let Rake version float again.
24
-
25
- ## 0.9.7 2012/10/06
26
- * build fixes
27
- * fix rake dependency at 0.8.7 while the Rake team sorts some shit out.
28
-
29
- ## 0.9.6 2012/10/06
30
-
31
- * make build compatible with Gentoo
32
-
33
- ## 0.9.5 - 2012/10/05
34
-
35
- * remove GCC specific code to enable build on BSD
36
- * let Rake dependency float
37
-
38
- ## 0.9.4 - 2011/08/22
39
-
40
- * Fix an issue with the compilation include paths which allowed compilation against conflicting libv8's
41
-
42
- ## 0.9.3 - 2011/08/11
43
-
44
- * Better documentation for the C extension memory management
45
- * Always lock V8 operations, always.
46
- * GH-86 Context#[], Context#[]= always looks up values from the JavaScript scope, even when it's a Ruby object
47
-
48
- ## 0.9.2 - 2011/06/23
49
-
50
- * fix issue with 1.8.7 where object allocation inside of GC was segfaulting
51
-
52
- ## 0.9.1 - 2011/06/17
53
-
54
- * never perform V8 operations inside Ruby GC
55
- * refactor locking interface
56
- * add documentation for v8_handle
57
-
58
- ## 0.9.0 - 2011/06/10
59
-
60
- * extract libv8 into installable binary for most platforms
61
- * fix numerous memory leaks
62
- * expose the V8 debugger via V8::C::Debug::EnableAgent()
63
- * force UTf-8 encoding on strings returned from javascript in ruby 1.9
64
- * remove deprecated evaluate() methods
65
- * make the currently executing JavaScript stack available via Context#stack
66
-
67
- ## 0.8.1 - 2011/03/07
68
-
69
- * upgrade to v8 3.1.8
70
- * remove bin/v8 which conflicted with v8 executeable
71
- * decruft all the crap that had accumulated in the gem
72
- * Javascript Objects are now always mapped to the same V8::Object when read from the context
73
-
74
- ## 0.8.0 - 2010/12/02
75
-
76
- * every V8 Context gets its own unique access strategy
77
- * ruby methods and procs embedded in javascript always return the same function per context.
78
- * ruby classes and subclasses are now all connected via the javascript prototype chain
79
- * better error reporting on syntax errors
80
- * upgrade to rspec 2
81
- * several bug fixes and stability fixes
82
-
83
- ## 0.7.5 - 1010/08/03
84
-
85
- * upgrade to V8 2.3.3
86
- * property interceptors from ruby via [] and []=
87
- * indexed property access via [] and []=
88
- * property
89
- * several bugfixes
90
- * stability: eliminate many segfaults
91
- * don't enumerate property setters such as foo= from javascript
92
-
93
- ## 0.7.4 - 2010/06/15
94
-
95
- * bug fix for rvm ruby installs incorrectly detected as 32bit
96
-
97
- ## 0.7.3 - 2010/06/15
98
-
99
- * don't catch SystemExit and NoMemoryError
100
- * fix bug bundling gem
101
-
102
- ## 0.7.2 - 2010/06/14
103
-
104
- * embed ruby classes as constructors
105
- * support for rubinius
106
- * uniform backtrace() function on JSError mixes the ruby
107
- * String::NewSymbol() is now scriptable
108
- * InstanceTemplate(), PrototypeTemplate(), Inherit() methods on v8::FunctionTemplate now scriptable.
109
- * reuse the standard ruby object access template
110
- * fix a bunch of compile warnings
111
- * Store any ruby object in V8 with V8::C::External
112
-
113
- ## 0.7.1 - 2010/06/03
114
-
115
- * Function#call() now uses the global scope for 'this' by default
116
- * Function#methodcall() added to allow passing in 'this' object
117
- * Function#new() method to invoke javascript constructor from ruby
118
- * access javascript properties and call javascript methods from ruby
119
- * bundled Jasmine DOM-Less browser testing framework.
120
-
121
- * added Object::GetHiddenValue() to v8 metal
122
- * added Handle::IsEmpty() to v8 metal
123
- * fixed bug where iterating over arrays sometimes failed
124
- * numerous bug /segfault fixes.
125
-
126
- ## 0.7.0 - 2010/05/31
127
-
128
- * upgraded to V8 2.1.10
129
- * added low level scripting interface for V8 objects
130
- * ruby object property/method access is now implemented in ruby
131
- * auto-convert javascript arrays to rb arrays and vice-versa
132
- * auto-convert ruby hashes into javascript objects
133
- * auto-convert javascript Date into ruby Time object and vice versa.
134
- * better exception handling when passing through multiple language boundaries
135
- * objects maintain referential integrity when passing objects from ruby to javascript and vice-versa
136
- * added debug compile option for getting C/C++ backtraces whenever segfaults occur.
137
- * official support for REE 1.8.7
138
- * fixed numerous segfaults
139
- * implemented V8::Value#to_s
140
- * the global scope is available to every V8::Context as the 'scope' attribute
141
- * properly convert ruby boolean values into V8 booleans.
142
-
143
- ## 0.6.3 - 2010/05/07
144
-
145
- * FIX: linkage error on OSX /usr/bin/ruby
146
-
147
- ## 0.6.2 - 2010/05/06
148
-
149
- * FIX: linkage error on OSX 10.5
150
-
151
- ## 0.6.1 - 2010/05/03
152
-
153
- * call JavaScript functions from Ruby
154
-
155
- ## 0.6.0 - 2010/03/31
156
-
157
- * ruby 1.9 compatible
158
- * full featured command line bin/v8 and bin/therubyracer
159
- * self validating install (v8 --selftest)
160
- * Only dependency to build gem from source is rubygems.
161
-
162
- ## 0.5.5 - 2010/03/15
163
-
164
- * fix string encoding issue that was breaking RHEL 5.x
165
- * fix pthread linking issue on RHEL 5.2
166
-
167
- ## 0.5.4 - 2010/03/09
168
-
169
- * add ext directory to gem require paths which was causing problems for non-binary gems
170
-
171
- ## 0.5.3 - 2010/03/01
172
-
173
- * added full back trace to javascript code
174
-
175
- ## 0.5.2 - 2010/02/26
176
-
177
- * added javascript shell (bin/therubyracer)
178
- * added to_s method for embedded ruby objects
179
- * added line number and file name to error message.
180
-
181
- ## 0.5.1 - 2010/02/17
182
-
183
- * fix bug in 1.8.6 by creating Object#tap if it does not exist
184
-
185
- ## 0.5.0 - 2010/02/17
186
-
187
- * support for Linux 64 bit
188
-
189
- ## 0.4.9 - 2010/02/16
190
-
191
- * support for Linux 32 bit
192
-
193
- ## 0.4.8 - 2010/02/08
194
-
195
- * expose line number and source name on JavascriptErrors.
196
-
197
- ## 0.4.5 - 2010/01/18
198
-
199
- * case munging so that ruby methods(perl_case) are accessed through javascript in camelCase.
200
- * access 0-arity ruby methods as javascript properties
201
- * invoke ruby setters from javascript as properties
202
- * contexts detect whether they are open or not and open when needed
203
-
204
- ## 0.4.4 - 2010/01/14
205
-
206
- * Ruby objects embedded into javascript are passed back to ruby as themselves and not a wrapped V8 object wrapping a ruby object.
207
- * Use any ruby object as the scope of eval().
208
- * quick and dirty V8.eval() method added
209
- * native objects have a reference to the context that created them.
210
- * context now has equality check.
211
- * expose InContext() and GetCurrent() methods.
212
- * fix a couple of segmentation faults
213
-
214
- ## 0.4.3 - 2010/10/11
215
-
216
- * access properties on Ruby objects with their camel case equivalents
217
- * reflect JavaScript objects into Ruby and access their properties
218
- * load JavaScript source from an IO object or by filename
219
-
220
- ## 0.4.2 - 2010/10/10
221
-
222
- * embed Ruby Objects into Javascript and call their methods
223
-
224
- ## 0.4.1 - 2010/01/09
225
-
226
- * embed bare Proc and Method objects into JavaScript and call them
227
- * catch JavaScript exceptions from Ruby
228
-
229
- ## 0.4.0 - 2009/12/21
230
-
231
- * evaluate JavaScript code from inside Ruby.
data/Gemfile DELETED
@@ -1,3 +0,0 @@
1
- source 'http://rubygems.org'
2
- gemspec
3
- gem 'redjs', :git => 'git://github.com/cowboyd/redjs.git', :tag => "v0.6.0", :group => :test
data/README.md DELETED
@@ -1,167 +0,0 @@
1
- # therubyracer
2
-
3
- * [http://github.com/cowboyd/therubyracer](http://github.com/cowboyd/therubyracer)
4
- * [http://groups.google.com/group/therubyracer](http://groups.google.com/group/therubyracer)
5
- * [irc://irc.freenode.net/therubyracer](http://groups.google.com/group/therubyracer)
6
- * [Documentation](https://github.com/cowboyd/therubyracer/wiki)
7
-
8
- ## DESCRIPTION
9
-
10
- Embed the V8 Javascript interpreter into Ruby.
11
-
12
-
13
- ## FEATURES
14
-
15
- * Evaluate Javascript from with in Ruby
16
- * Embed your Ruby objects into the Javascript world
17
- * Manipulate JavaScript objects and call JavaScript functions from Ruby
18
- * API compatible with the The Ruby Rhino (for JRuby: http://github.com/cowboyd/therubyrhino)
19
-
20
- ## SYNOPSIS
21
-
22
- gem install therubyracer ;: stable
23
- gem install therubyracer --pre ;: bleeding edge
24
-
25
- then in your ruby code
26
-
27
- require 'v8'
28
-
29
- evaluate some simple javascript
30
-
31
- cxt = V8::Context.new
32
- cxt.eval('7 * 6') #=> 42
33
-
34
- embed values into the scope of your context
35
-
36
- cxt['foo'] = "bar"
37
- cxt.eval('foo') # => "bar"
38
-
39
- embed ruby code into your scope and call it from javascript
40
-
41
- cxt["say"] = lambda {|this, word, times| word * times}
42
- cxt.eval("say('Hello', 3)") #=> HelloHelloHello
43
-
44
- embed a ruby object into your scope and access its properties/methods from javascript
45
-
46
- class MyMath
47
- def plus(lhs, rhs)
48
- lhs + rhs
49
- end
50
- end
51
-
52
- cxt['math'] = MyMath.new
53
- cxt.eval("math.plus(20,22)") #=> 42
54
-
55
- make a ruby object *be* your global javascript scope.
56
-
57
- math = MyMath.new
58
- V8::Context.new(:with => math) do |cxt|
59
- cxt.eval("plus(20,22)") #=> 42
60
- end
61
-
62
- you can do the same thing with Object#eval_js
63
-
64
- math.eval_js("plus(20,22)")
65
-
66
- ## Different ways of loading javascript source
67
-
68
- In addition to just evaluating strings, you can also use streams such as files.
69
-
70
- evaluate bytes read from any File/IO object:
71
-
72
- File.open("mysource.js") do |file|
73
- cxt.eval(file, "mysource.js")
74
- end
75
-
76
- or load it by filename
77
-
78
- cxt.load("mysource.js")
79
-
80
-
81
- ## Safe by default, dangerous by demand
82
-
83
- The Ruby Racer is designed to let you evaluate javascript as safely as possible unless you tell it to do something more
84
- dangerous. The default context is a hermetically sealed javascript environment with only the standard javascript objects
85
- and functions. Nothing from the ruby world is accessible at all.
86
-
87
- For ruby objects that you explicitly embed into javascript, by default only the _public_ methods _below_ `Object` are
88
- exposed by default. E.g.
89
-
90
- class A
91
- def a
92
- "a"
93
- end
94
-
95
- def to_s
96
- super
97
- end
98
- end
99
-
100
- class B < A
101
- def b
102
- "b"
103
- end
104
- end
105
-
106
-
107
- V8::Context.new do |cxt|
108
- cxt['a'] = A.new
109
- cxt['b'] = B.new
110
- cxt.eval("a.a") # => 'a'
111
- cxt.eval("b.b") # => 'b'
112
- cxt.eval("b.a") # => 'a'
113
- cxt.eval("b.to_s") # => #<B:0x101776be8> (because A explicitly defined it)
114
- cxt.eval("b.object_id") #=> undefined, object_id is on Object
115
- end
116
-
117
- If needed, you can override the [Ruby Access](https://github.com/cowboyd/therubyracer/blob/master/lib/v8/access.rb)
118
- to allow whatever behavior you'd like
119
-
120
- More documentation can be found on the [github wiki](https://github.com/cowboyd/therubyracer/wiki)
121
-
122
- ## REQUIREMENTS:
123
-
124
- * python >= 2.5 (required to compile v8)
125
- * C++ compiler
126
-
127
- ## Rails/Bundler
128
-
129
- To use the ruby racer in rails, or any application using Bundler to manage gems, add the following to your Gemfile
130
-
131
- gem "therubyracer", :require => 'v8'
132
- gem "therubyracer", "~> 0.8.2.pre" #bleeding edge.
133
-
134
- ## DEVELOP
135
- git clone git://github.com/cowboyd/therubyracer.git
136
- cd therubyracer
137
- git submodule update --init
138
- bundle install
139
- rake compile
140
-
141
- ## Sponsored by
142
- <a href="http://thefrontside.net">![The Frontside](http://github.com/cowboyd/therubyracer/raw/master/thefrontside.png)</a>
143
-
144
- ## LICENSE:
145
-
146
- (The MIT License)
147
-
148
- Copyright (c) 2009,2010,2011 Charles Lowell
149
-
150
- Permission is hereby granted, free of charge, to any person obtaining
151
- a copy of this software and associated documentation files (the
152
- 'Software'), to deal in the Software without restriction, including
153
- without limitation the rights to use, copy, modify, merge, publish,
154
- distribute, sublicense, and/or sell copies of the Software, and to
155
- permit persons to whom the Software is furnished to do so, subject to
156
- the following conditions:
157
-
158
- The above copyright notice and this permission notice shall be
159
- included in all copies or substantial portions of the Software.
160
-
161
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
162
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
163
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
164
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
165
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
166
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
167
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,26 +0,0 @@
1
- require 'bundler'
2
- require 'bundler/setup'
3
- require "rake/extensiontask"
4
- require "rspec/core/rake_task"
5
- Bundler::GemHelper.install_tasks
6
-
7
- task :default => :spec
8
-
9
- desc "remove all generated artifacts except built v8 objects"
10
- task :clean do
11
- sh "rm -rf pkg"
12
- sh "rm -rf ext/v8/*.bundle ext/v8/*.so"
13
- sh "rm -rf lib/v8/*.bundle lib/v8/*.so"
14
- end
15
-
16
- Rake::ExtensionTask.new("v8", eval(File.read("therubyracer.gemspec"))) do |ext|
17
- ext.lib_dir = "lib/v8"
18
- ext.source_pattern = "*.{cpp,h}"
19
- end
20
-
21
- RSpec::Core::RakeTask.new(:spec) do |spec|
22
- spec.rspec_opts = ['--color', "--format documentation"]
23
- end
24
-
25
-
26
-
data/bin/therubyracer DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- begin
4
- require 'v8'
5
- rescue LoadError
6
- require 'rubygems'
7
- require 'v8'
8
- end
9
- require 'v8/cli'
10
-
11
- V8::CLI.run(File.basename(__FILE__), ARGV)