therubyracer-freebsd 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +13 -0
- data/.rspec +1 -0
- data/.travis.yml +8 -0
- data/.yardopts +1 -0
- data/Changelog.md +231 -0
- data/Gemfile +3 -0
- data/README.md +167 -0
- data/Rakefile +26 -0
- data/bin/therubyracer +11 -0
- data/ext/v8/extconf.rb +26 -0
- data/ext/v8/rr.cpp +189 -0
- data/ext/v8/rr.h +41 -0
- data/ext/v8/v8.cpp +48 -0
- data/ext/v8/v8_array.cpp +48 -0
- data/ext/v8/v8_array.h +8 -0
- data/ext/v8/v8_callbacks.cpp +81 -0
- data/ext/v8/v8_callbacks.h +8 -0
- data/ext/v8/v8_context.cpp +92 -0
- data/ext/v8/v8_context.h +6 -0
- data/ext/v8/v8_date.cpp +40 -0
- data/ext/v8/v8_date.h +6 -0
- data/ext/v8/v8_debug.cpp +17 -0
- data/ext/v8/v8_debug.h +6 -0
- data/ext/v8/v8_exception.cpp +133 -0
- data/ext/v8/v8_exception.h +11 -0
- data/ext/v8/v8_external.cpp +70 -0
- data/ext/v8/v8_external.h +8 -0
- data/ext/v8/v8_function.cpp +69 -0
- data/ext/v8/v8_function.h +11 -0
- data/ext/v8/v8_handle.cpp +186 -0
- data/ext/v8/v8_handle.h +48 -0
- data/ext/v8/v8_locker.cpp +139 -0
- data/ext/v8/v8_locker.h +6 -0
- data/ext/v8/v8_message.cpp +67 -0
- data/ext/v8/v8_message.h +10 -0
- data/ext/v8/v8_object.cpp +122 -0
- data/ext/v8/v8_object.h +10 -0
- data/ext/v8/v8_script.cpp +36 -0
- data/ext/v8/v8_script.h +8 -0
- data/ext/v8/v8_string.cpp +52 -0
- data/ext/v8/v8_string.h +9 -0
- data/ext/v8/v8_template.cpp +344 -0
- data/ext/v8/v8_template.h +8 -0
- data/ext/v8/v8_try_catch.cpp +70 -0
- data/ext/v8/v8_try_catch.h +5 -0
- data/ext/v8/v8_v8.cpp +34 -0
- data/ext/v8/v8_v8.h +6 -0
- data/ext/v8/v8_value.cpp +175 -0
- data/ext/v8/v8_value.h +10 -0
- data/ext/v8/v8_weakref.cpp +61 -0
- data/ext/v8/v8_weakref.h +29 -0
- data/lib/v8.rb +23 -0
- data/lib/v8/access.rb +92 -0
- data/lib/v8/array.rb +17 -0
- data/lib/v8/c/locker.rb +18 -0
- data/lib/v8/cli.rb +133 -0
- data/lib/v8/context.rb +111 -0
- data/lib/v8/error.rb +130 -0
- data/lib/v8/function.rb +44 -0
- data/lib/v8/object.rb +69 -0
- data/lib/v8/portal.rb +86 -0
- data/lib/v8/portal/caller.rb +37 -0
- data/lib/v8/portal/constructor.rb +98 -0
- data/lib/v8/portal/function.rb +63 -0
- data/lib/v8/portal/interceptors.rb +152 -0
- data/lib/v8/portal/proxies.rb +151 -0
- data/lib/v8/portal/templates.rb +73 -0
- data/lib/v8/stack.rb +66 -0
- data/lib/v8/tap.rb +9 -0
- data/lib/v8/version.rb +3 -0
- data/spec/ext/array_spec.rb +15 -0
- data/spec/ext/cxt_spec.rb +57 -0
- data/spec/ext/ext_spec_helper.rb +27 -0
- data/spec/ext/func_spec.rb +64 -0
- data/spec/ext/object_spec.rb +10 -0
- data/spec/ext/string_spec.rb +11 -0
- data/spec/ext/try_catch_spec.rb +60 -0
- data/spec/redjs_spec.rb +9 -0
- data/spec/spec_helper.rb +9 -0
- data/spec/v8/error_spec.rb +131 -0
- data/spec/v8/portal/proxies_spec.rb +106 -0
- data/specmem/handle_memspec.rb +41 -0
- data/specmem/object_memspec.rb +14 -0
- data/specmem/proxies_memspec.rb +49 -0
- data/specmem/spec_helper.rb +24 -0
- data/specthread/spec_helper.rb +2 -0
- data/specthread/threading_spec.rb +13 -0
- data/thefrontside.png +0 -0
- data/therubyracer.gemspec +27 -0
- metadata +183 -0
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
lib/**/*.rb ext/**/*.cpp
|
data/Changelog.md
ADDED
@@ -0,0 +1,231 @@
|
|
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
ADDED
data/README.md
ADDED
@@ -0,0 +1,167 @@
|
|
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
ADDED
@@ -0,0 +1,26 @@
|
|
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
|
+
|