therubyracer 0.11.4 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of therubyracer might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 200bdac096aa8b0a53d2fb32196ff525d572b44d
4
- data.tar.gz: b88277459151b1943fe49916c42967821393ef81
3
+ metadata.gz: 6488a4b018aa3bcbf2dd9ebdf8bb47a7cece0b5e
4
+ data.tar.gz: 9e16c6452241525ff12b8c1231421434cb0d2d06
5
5
  SHA512:
6
- metadata.gz: 3d0934882af9928444d951a4d2f8754b872bd54c63f54801aeec82be6935ea74daf97f480f86ce6fbf7410730e8957567b5ce53287ad65ec24bfb30f56c3de64
7
- data.tar.gz: 0fe808d6a1d3960c0ba51f478998c556d7b3b8fd693d3007f39c25a05fe89372f6529fc14b5326d5258896a313cc75ac713c49660477fd905c685ad76ac76b59
6
+ metadata.gz: fca9709c4f134600b6ba8e41370b799a258e7a5e61573eff5cef661a77ef87b4595e62ea60195331fbbdb59ad3b1d12d66a8b7d5bcb574208d385a3a33a3bec3
7
+ data.tar.gz: acdb5e300dac4818351afce6383da68ef4c73d5bc7de56b700df2752dc777e6dfe30adecb5ab12f4829aaf558f210b288cfadd4c8021670feb556672fd39c0ed
@@ -1,4 +1,5 @@
1
1
  rvm:
2
+ - 2.0.0
2
3
  - 1.9.2
3
4
  - 1.9.3
4
5
  - 1.8.7
@@ -1,13 +1,5 @@
1
1
  # Changelog
2
2
 
3
- ## 0.11.3 2013/01/16
4
-
5
- * ensure that libv8 is required from rubygems where possible.
6
-
7
- ## 0.11.2 2013/01/11
8
-
9
- * move dependency on libv8 pass corrupted versions (Workaround)
10
-
11
3
  ## 0.11.1 2013/01/04
12
4
 
13
5
  * reintroduce the dependency on libv8
data/README.md CHANGED
@@ -5,19 +5,18 @@
5
5
  * [irc://irc.freenode.net/therubyracer](http://groups.google.com/group/therubyracer)
6
6
  * [Documentation](https://github.com/cowboyd/therubyracer/wiki)
7
7
 
8
- ## DESCRIPTION
8
+ ### DESCRIPTION
9
9
 
10
10
  Embed the V8 JavaScript interpreter into Ruby.
11
11
 
12
-
13
- ## FEATURES
12
+ ### FEATURES
14
13
 
15
14
  * Evaluate JavaScript from within Ruby
16
15
  * Embed your Ruby objects into the JavaScript world
17
16
  * Manipulate JavaScript objects and call JavaScript functions from Ruby
18
17
  * API compatible with the The Ruby Rhino (for JRuby: http://github.com/cowboyd/therubyrhino)
19
18
 
20
- ## SYNOPSIS
19
+ ### SYNOPSIS
21
20
 
22
21
  gem install therubyracer
23
22
 
@@ -42,7 +41,8 @@ embed Ruby code into your scope and call it from JavaScript
42
41
  cxt["say"] = lambda {|this, word, times| word * times}
43
42
  cxt.eval("say('Hello', 3)") #=> HelloHelloHello
44
43
 
45
- embed a Ruby object into your scope and access its properties/methods from JavaScript
44
+ embed a Ruby object into your scope and access its properties/methods
45
+ from JavaScript
46
46
 
47
47
  class MyMath
48
48
  def plus(lhs, rhs)
@@ -64,9 +64,10 @@ you can do the same thing with Object#eval_js
64
64
 
65
65
  math.eval_js("plus(20,22)")
66
66
 
67
- ## Different ways of loading JavaScript source
67
+ ### Different ways of loading JavaScript source
68
68
 
69
- In addition to just evaluating strings, you can also use streams, such as files.
69
+ In addition to just evaluating strings, you can also use streams, such
70
+ as files.
70
71
 
71
72
  evaluate bytes read from any File/IO object:
72
73
 
@@ -78,15 +79,17 @@ or load it by filename
78
79
 
79
80
  cxt.load("mysource.js")
80
81
 
82
+ ### Safe by default, dangerous by demand
81
83
 
82
- ## Safe by default, dangerous by demand
83
-
84
- The Ruby Racer is designed to let you evaluate JavaScript as safely as possible unless you tell it to do something more
85
- dangerous. The default context is a hermetically sealed JavaScript environment with only the standard JavaScript objects
86
- and functions. Nothing from the Ruby world is accessible at all.
84
+ The Ruby Racer is designed to let you evaluate JavaScript as safely as
85
+ possible unless you tell it to do something more dangerous. The
86
+ default context is a hermetically sealed JavaScript environment with
87
+ only the standard JavaScript objects and functions. Nothing from the
88
+ Ruby world is accessible at all.
87
89
 
88
- For Ruby objects that you explicitly embed into JavaScript, by default only the _public_ methods _below_ `Object` are
89
- exposed by default. E.g.
90
+ For Ruby objects that you explicitly embed into JavaScript, by default
91
+ only the _public_ methods _below_ `Object` are exposed by default.
92
+ E.g.
90
93
 
91
94
  class A
92
95
  def a
@@ -115,49 +118,36 @@ exposed by default. E.g.
115
118
  cxt.eval("b.object_id") #=> undefined, object_id is on Object
116
119
  end
117
120
 
118
- If needed, you can override the [Ruby Access](https://github.com/cowboyd/therubyracer/blob/master/lib/v8/access.rb)
119
- to allow whatever behavior you'd like
120
-
121
- More documentation can be found on the [GitHub wiki](https://github.com/cowboyd/therubyracer/wiki)
122
-
123
- ## PREREQUISITES
121
+ If needed, you can override the [Ruby Access][access] to allow whatever
122
+ behavior you'd like.
124
123
 
125
- For platforms for which there is a binary version of therubyracer gem available, there are no
124
+ [access]:https://github.com/cowboyd/therubyracer/blob/master/lib/v8/access.rb
126
125
 
127
- dependencies other than Ruby and rubygems.
128
-
129
- If there is not a binary version for your system, then you will need to compile it from source.
130
- To do this, you must have v8 >= 3.11.8 installed somewhere on your system. There are several
131
- ways of doing this. For both, you will need a C++ compiler.
132
-
133
- The first method involves using a version of the v8 source, which is maintained
134
- [as a RubyGem called libv8][1]. To use it, all you have to do is
135
- add the following to your Gemfile:
126
+ More documentation can be found on the [GitHub wiki](https://github.com/cowboyd/therubyracer/wiki)
136
127
 
137
- gem 'libv8', '~> 3.11.8'
128
+ ### PREREQUISITES
138
129
 
139
- This will download and build v8 from source for you as part of the gem installation
140
- process. When therubyracer is installed, it will find this gem if it is present and
141
- link against the v8 binaries contained therein.
130
+ The Ruby Racer requires the V8 Javascript engine, but it offloads the
131
+ handling of this dependency to the
132
+ [libv8](https://github.com/cowboyd/libv8) gem. Because libv8 is now a
133
+ gem dependency, you do not need a separate libv8 entry in your
134
+ project's Gemfile.
142
135
 
143
- If you cannot, or do not wish to use the libv8 RubyGem, you can either install libv8
144
- with you operating system's packaging system or you can [build it from source][2]. If
145
- you build from source, be sure to set the library=shared option. Also, if you install
146
- this shared library into a place that is not on your standard lib and include paths, then
147
- you can pass your non-standard locations to therubyracer using the
148
- `--with-v8-include` and `--with-v8-lib` configuration options.
136
+ Please see [libv8](https://github.com/cowboyd/libv8) for V8 runtime
137
+ installation options.
149
138
 
139
+ ### DEVELOP
150
140
 
151
- ## DEVELOP
152
141
  git clone git://github.com/cowboyd/therubyracer.git
153
142
  cd therubyracer
154
143
  bundle install
155
144
  rake compile
156
145
 
157
- ## Sponsored by
146
+ ### Sponsored by
147
+
158
148
  <a href="http://thefrontside.net">![The Frontside](http://github.com/cowboyd/therubyracer/raw/master/thefrontside.png)</a>
159
149
 
160
- ## LICENSE:
150
+ ### LICENSE:
161
151
 
162
152
  (The MIT License)
163
153
 
@@ -183,4 +173,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
183
173
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
184
174
 
185
175
  [1]: https://github.com/cowboyd/libv8
186
- [2]: http://code.google.com/p/v8/wiki/BuildingWithGYP
176
+ [2]: http://code.google.com/p/v8/wiki/BuildingWithGYP
@@ -32,7 +32,7 @@ namespace rr {
32
32
  }
33
33
 
34
34
  v8::Handle<v8::Value> Backref::toExternal() {
35
- v8::Local<v8::Value> wrapper = v8::External::Wrap(this);
35
+ v8::Local<v8::Value> wrapper = v8::External::New(this);
36
36
  v8::Persistent<v8::Value>::New(wrapper).MakeWeak(this, &release);
37
37
  return wrapper;
38
38
  }
@@ -42,4 +42,4 @@ namespace rr {
42
42
  Backref* backref = (Backref*)data;
43
43
  delete backref;
44
44
  }
45
- }
45
+ }
@@ -17,8 +17,8 @@ void Context::Init() {
17
17
  defineMethod("UseDefaultSecurityToken", &UseDefaultSecurityToken).
18
18
  defineMethod("GetSecurityToken", &GetSecurityToken).
19
19
  defineMethod("HasOutOfMemoryException", &HasOutOfMemoryException).
20
- defineMethod("SetData", &SetData).
21
- defineMethod("GetData", &GetData).
20
+ defineMethod("SetEmbedderData", &SetEmbedderData).
21
+ defineMethod("GetEmbedderData", &GetEmbedderData).
22
22
  defineMethod("AllowCodeGenerationFromStrings", &AllowCodeGenerationFromStrings).
23
23
  defineMethod("IsCodeGenerationFromStringsAllowed", &IsCodeGenerationFromStringsAllowed).
24
24
  defineMethod("Enter", &Enter).
@@ -77,12 +77,12 @@ VALUE Context::InContext(VALUE self) {
77
77
  return Bool(v8::Context::InContext());
78
78
  }
79
79
 
80
- VALUE Context::SetData(VALUE self, VALUE data) {
81
- Void(Context(self)->SetData(String(data)));
80
+ VALUE Context::SetEmbedderData(VALUE self, VALUE index, VALUE data) {
81
+ Void(Context(self)->SetEmbedderData(NUM2INT(index), Value(data)));
82
82
  }
83
83
 
84
- VALUE Context::GetData(VALUE self) {
85
- return Value(Context(self)->GetData());
84
+ VALUE Context::GetEmbedderData(VALUE self, VALUE index) {
85
+ Void(Context(self)->GetEmbedderData(NUM2INT(index)));
86
86
  }
87
87
 
88
88
  VALUE Context::AllowCodeGenerationFromStrings(VALUE self, VALUE allow) {
@@ -16,13 +16,13 @@ if enable_config('debug')
16
16
  $CFLAGS += " -O0 -ggdb3"
17
17
  end
18
18
 
19
- LIBV8_COMPATIBILITY = '~> 3.11.8'
19
+ LIBV8_COMPATIBILITY = '~> 3.16.14'
20
20
 
21
21
  begin
22
22
  require 'rubygems'
23
23
  gem 'libv8', LIBV8_COMPATIBILITY
24
24
  rescue Gem::LoadError
25
- warn "Warning! Selecting libv8 #{LIBV8_COMPATIBILITY} failed. Has it been added to the gemspec?"
25
+ warn "Warning! Unable to load libv8 #{LIBV8_COMPATIBILITY}."
26
26
  rescue LoadError
27
27
  warn "Warning! Could not load rubygems. Please make sure you have libv8 #{LIBV8_COMPATIBILITY} installed."
28
28
  ensure
@@ -6,6 +6,7 @@ namespace rr {
6
6
  defineSingletonMethod("new", &initialize).
7
7
  defineMethod("total_heap_size", &total_heap_size).
8
8
  defineMethod("total_heap_size_executable", &total_heap_size_executable).
9
+ defineMethod("total_physical_size", &total_physical_size).
9
10
  defineMethod("used_heap_size", &used_heap_size).
10
11
  defineMethod("heap_size_limit", &heap_size_limit).
11
12
  store(&Class);
@@ -19,6 +20,9 @@ namespace rr {
19
20
  VALUE HeapStatistics::total_heap_size_executable(VALUE self) {
20
21
  return SIZET2NUM(HeapStatistics(self)->total_heap_size_executable());
21
22
  }
23
+ VALUE HeapStatistics::total_physical_size(VALUE self) {
24
+ return SIZET2NUM(HeapStatistics(self)->total_physical_size());
25
+ }
22
26
  VALUE HeapStatistics::used_heap_size(VALUE self) {
23
27
  return SIZET2NUM(HeapStatistics(self)->used_heap_size());
24
28
  }
@@ -28,4 +32,4 @@ namespace rr {
28
32
  template <> void Pointer<v8::HeapStatistics>::unwrap(VALUE value) {
29
33
  Data_Get_Struct(value, class v8::HeapStatistics, pointer);
30
34
  }
31
- }
35
+ }
@@ -22,7 +22,7 @@ namespace rr {
22
22
  }
23
23
 
24
24
  VALUE Locker::IsLocked(VALUE self) {
25
- return Bool(v8::Locker::IsLocked());
25
+ return Bool(v8::Locker::IsLocked(v8::Isolate::GetCurrent()));
26
26
  }
27
27
 
28
28
  VALUE Locker::IsActive(VALUE self) {
@@ -74,4 +74,4 @@ namespace rr {
74
74
  VALUE Locker::doUnlockCall(VALUE code) {
75
75
  return rb_funcall(code, rb_intern("call"), 0);
76
76
  }
77
- }
77
+ }
@@ -144,7 +144,8 @@ Object::operator VALUE() {
144
144
  backref = new Backref(value);
145
145
  handle->SetHiddenValue(key, backref->toExternal());
146
146
  } else {
147
- backref = (Backref*)v8::External::Unwrap(external);
147
+ v8::Local<v8::External> wrapper = v8::External::Cast(*external);
148
+ backref = (Backref*)wrapper->Value();
148
149
  value = backref->get();
149
150
  if (!RTEST(value)) {
150
151
  value = downcast();
@@ -331,4 +332,4 @@ VALUE Object::CallAsConstructor(VALUE self, VALUE argv) {
331
332
  return Value(Object(self)->CallAsConstructor(RARRAY_LENINT(argv), Value::array<Value>(argv)));
332
333
  }
333
334
 
334
- }
335
+ }
@@ -319,8 +319,8 @@ public:
319
319
  static VALUE GetSecurityToken(VALUE self);
320
320
  static VALUE HasOutOfMemoryException(VALUE self);
321
321
  static VALUE InContext(VALUE self);
322
- static VALUE SetData(VALUE self, VALUE data);
323
- static VALUE GetData(VALUE self);
322
+ static VALUE SetEmbedderData(VALUE self, VALUE index, VALUE data);
323
+ static VALUE GetEmbedderData(VALUE self, VALUE index);
324
324
  static VALUE AllowCodeGenerationFromStrings(VALUE self, VALUE allow);
325
325
  static VALUE IsCodeGenerationFromStringsAllowed(VALUE self);
326
326
 
@@ -819,6 +819,7 @@ public:
819
819
  static VALUE initialize(VALUE self);
820
820
  static VALUE total_heap_size(VALUE self);
821
821
  static VALUE total_heap_size_executable(VALUE self);
822
+ static VALUE total_physical_size(VALUE self);
822
823
  static VALUE used_heap_size(VALUE self);
823
824
  static VALUE heap_size_limit(VALUE self);
824
825
 
@@ -1,3 +1,3 @@
1
1
  module V8
2
- VERSION = "0.11.4"
2
+ VERSION = "0.12.0"
3
3
  end
@@ -15,6 +15,6 @@ describe V8::C do
15
15
  end
16
16
 
17
17
  it "can access the V8 version" do
18
- V8::C::V8::GetVersion().should match /^3\.11/
18
+ V8::C::V8::GetVersion().should match /^3\.16/
19
19
  end
20
- end
20
+ end
@@ -17,5 +17,5 @@ Gem::Specification.new do |gem|
17
17
  gem.version = V8::VERSION
18
18
 
19
19
  gem.add_dependency 'ref'
20
- gem.add_dependency 'libv8', '~> 3.11.8.12'
20
+ gem.add_dependency 'libv8', '~> 3.16.14.0'
21
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: therubyracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.4
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Lowell
@@ -29,7 +29,7 @@ cert_chain:
29
29
  UgImJlChAzCoDP9zi9tdm6jAr7ttF25R9PPYr11ILb7dYe3qUzlNlM6zJx/nb31b
30
30
  IhdyRVup4qLcqYSTPsm6u7VA
31
31
  -----END CERTIFICATE-----
32
- date: 2013-02-26 00:00:00.000000000 Z
32
+ date: 2013-08-20 00:00:00.000000000 Z
33
33
  dependencies:
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: ref
@@ -51,14 +51,14 @@ dependencies:
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: 3.11.8.12
54
+ version: 3.16.14.0
55
55
  type: :runtime
56
56
  prerelease: false
57
57
  version_requirements: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: 3.11.8.12
61
+ version: 3.16.14.0
62
62
  description: Call JavaScript code and manipulate JavaScript objects from Ruby. Call
63
63
  Ruby code and manipulate Ruby objects from JavaScript.
64
64
  email: