therubyracer 0.5.1-x86-darwin-10 → 0.5.2-x86-darwin-10
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.
- data/History.txt +7 -0
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/bin/therubyracer +64 -0
- data/ext/v8/converters.cpp +0 -3
- data/ext/v8/v8.cpp +1 -0
- data/ext/v8/v8_obj.cpp +7 -1
- data/ext/v8/v8_obj.h +1 -0
- data/lib/v8.rb +1 -1
- data/lib/v8/context.rb +1 -1
- data/lib/v8/object.rb +6 -0
- data/therubyracer.gemspec +5 -2
- metadata +6 -5
data/History.txt
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=== 0.5.2 2010-02-26
|
2
|
+
* 1 major enhancement
|
3
|
+
* added javascript shell (bin/therubyracer)
|
4
|
+
* 2 minor enhancements
|
5
|
+
* added to_s method for embedded ruby objects
|
6
|
+
* added line number and file name to error message.
|
7
|
+
|
1
8
|
=== 0.5.1 2010-02-17
|
2
9
|
* 1 minor enhancement
|
3
10
|
* fix bug in 1.8.6 by creating Object#tap if it does not exist
|
data/README.rdoc
CHANGED
@@ -136,7 +136,7 @@ exposed by default. E.g.
|
|
136
136
|
|
137
137
|
(The MIT License)
|
138
138
|
|
139
|
-
Copyright (c) 2009 Charles Lowell
|
139
|
+
Copyright (c) 2009,2010 Charles Lowell
|
140
140
|
|
141
141
|
Permission is hereby granted, free of charge, to any person obtaining
|
142
142
|
a copy of this software and associated documentation files (the
|
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@ begin
|
|
9
9
|
require 'jeweler'
|
10
10
|
Jeweler::Tasks.new do |gemspec|
|
11
11
|
gemspec.name = gemspec.rubyforge_project = "therubyracer"
|
12
|
-
gemspec.version = "0.5.
|
12
|
+
gemspec.version = "0.5.2"
|
13
13
|
gemspec.summary = "Embed the V8 Javascript interpreter into Ruby"
|
14
14
|
gemspec.description = "Call javascript code and manipulate javascript objects from ruby. Call ruby code and manipulate ruby objects from javascript."
|
15
15
|
gemspec.email = "cowboyd@thefrontside.net"
|
data/bin/therubyracer
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
lib = File.expand_path(File.dirname(__FILE__) + '/../lib')
|
3
|
+
$:.unshift(lib) if File.exists?(lib) unless $:.member?(lib)
|
4
|
+
|
5
|
+
require 'readline'
|
6
|
+
begin
|
7
|
+
require 'v8'
|
8
|
+
rescue LoadError
|
9
|
+
require 'rubygems'
|
10
|
+
require 'v8'
|
11
|
+
end
|
12
|
+
|
13
|
+
trap("SIGINT") do
|
14
|
+
puts "^C"
|
15
|
+
end
|
16
|
+
|
17
|
+
class V8::Shell
|
18
|
+
def exit(status = 0)
|
19
|
+
Kernel.exit(status)
|
20
|
+
end
|
21
|
+
|
22
|
+
def help(*args)
|
23
|
+
<<-HELP
|
24
|
+
exit(status = 0)
|
25
|
+
exit the shell
|
26
|
+
also: quit()
|
27
|
+
|
28
|
+
ruby(source)
|
29
|
+
evaluate some ruby source
|
30
|
+
HELP
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
"[object TheRubyRacer]"
|
36
|
+
end
|
37
|
+
|
38
|
+
def print(string)
|
39
|
+
puts string
|
40
|
+
end
|
41
|
+
|
42
|
+
def ruby(src)
|
43
|
+
eval(src)
|
44
|
+
end
|
45
|
+
|
46
|
+
alias_method :quit, :exit
|
47
|
+
end
|
48
|
+
|
49
|
+
puts "help() for help"
|
50
|
+
puts "The Ruby Racer #{V8::VERSION}"
|
51
|
+
puts "Vroom Vroom!"
|
52
|
+
|
53
|
+
V8::Context.open(:with => V8::Shell.new) do |cxt|
|
54
|
+
loop do
|
55
|
+
line = Readline.readline('therubyracer> ', true)
|
56
|
+
begin
|
57
|
+
result = cxt.eval(line)
|
58
|
+
puts(result) unless result.nil?
|
59
|
+
|
60
|
+
rescue StandardError => e
|
61
|
+
puts e
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
data/ext/v8/converters.cpp
CHANGED
@@ -33,10 +33,8 @@ VALUE V82RB(Handle<Value>& value) {
|
|
33
33
|
if (value->IsObject()) {
|
34
34
|
Local<Object> object(Object::Cast(*value));
|
35
35
|
Local<Value> peer = object->GetHiddenValue(String::New("TheRubyRacer::RubyObject"));
|
36
|
-
// Local<Value> peer = object->GetInternalField(0);
|
37
36
|
if (peer.IsEmpty()) {
|
38
37
|
VALUE context_ref = V8_Ref_Create(V8_C_Context, Context::GetCurrent());
|
39
|
-
// object->SetPointerInInternalField(1, (void *)context_ref);
|
40
38
|
object->SetHiddenValue(String::New("TheRubyRacer::Context"), External::Wrap((void *)context_ref));
|
41
39
|
return V8_Ref_Create(V8_C_Object, value, context_ref);
|
42
40
|
} else {
|
@@ -60,7 +58,6 @@ Local<Value> RB2V8(VALUE value) {
|
|
60
58
|
}
|
61
59
|
Local<Object> o = Racer_Create_V8_ObjectTemplate(value)->NewInstance();
|
62
60
|
o->SetHiddenValue(String::New("TheRubyRacer::RubyObject"), External::Wrap((void *) value));
|
63
|
-
// o->SetPointerInInternalField(0, (void*)value);
|
64
61
|
return o;
|
65
62
|
}
|
66
63
|
|
data/ext/v8/v8.cpp
CHANGED
@@ -71,6 +71,7 @@ extern "C" {
|
|
71
71
|
rb_define_method(V8_C_Object, "Get", (VALUE(*)(...))v8_Object_Get, 1);
|
72
72
|
rb_define_method(V8_C_Object, "Set", (VALUE(*)(...))v8_Object_Set, 2);
|
73
73
|
rb_define_method(V8_C_Object, "GetPropertyNames", (VALUE(*)(...)) v8_Object_GetPropertyNames, 0);
|
74
|
+
rb_define_method(V8_C_Object, "ToString", (VALUE(*)(...)) v8_Object_ToString, 0);
|
74
75
|
rb_define_method(V8_C_Object, "context", (VALUE(*)(...)) v8_Object_context, 0);
|
75
76
|
|
76
77
|
V8_C_Message = rb_define_class_under(rb_mNative, "Message", rb_cObject);
|
data/ext/v8/v8_obj.cpp
CHANGED
@@ -47,6 +47,12 @@ VALUE v8_Object_context(VALUE self) {
|
|
47
47
|
HandleScope handles;
|
48
48
|
Local<Object> object = unwrap(self);
|
49
49
|
Local<Value> cxt = object->GetHiddenValue(String::New("TheRubyRacer::Context"));
|
50
|
-
// Local<Value> cxt = object->GetInternalField(1);
|
51
50
|
return cxt.IsEmpty() ? Qnil : (VALUE)External::Unwrap(cxt);
|
52
51
|
}
|
52
|
+
|
53
|
+
VALUE v8_Object_ToString(VALUE self) {
|
54
|
+
HandleScope handles;
|
55
|
+
Local<Object> object = unwrap(self);
|
56
|
+
Local<Value> string = object->ToString();
|
57
|
+
return V82RB(string);
|
58
|
+
}
|
data/ext/v8/v8_obj.h
CHANGED
data/lib/v8.rb
CHANGED
data/lib/v8/context.rb
CHANGED
@@ -79,7 +79,7 @@ module V8
|
|
79
79
|
end
|
80
80
|
class JavascriptError < StandardError
|
81
81
|
def initialize(v8_message)
|
82
|
-
super("#{v8_message.Get()}: #{v8_message.
|
82
|
+
super("#{v8_message.Get()}: #{v8_message.GetScriptResourceName()}:#{v8_message.GetLineNumber()}")
|
83
83
|
@native = v8_message
|
84
84
|
end
|
85
85
|
|
data/lib/v8/object.rb
CHANGED
data/therubyracer.gemspec
CHANGED
@@ -5,13 +5,15 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{therubyracer}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Charles Lowell", "Bill Robertson"]
|
12
|
-
s.date = %q{2010-02-
|
12
|
+
s.date = %q{2010-02-26}
|
13
|
+
s.default_executable = %q{therubyracer}
|
13
14
|
s.description = %q{Call javascript code and manipulate javascript objects from ruby. Call ruby code and manipulate ruby objects from javascript.}
|
14
15
|
s.email = %q{cowboyd@thefrontside.net}
|
16
|
+
s.executables = ["therubyracer"]
|
15
17
|
s.extensions = ["ext/v8/extconf.rb"]
|
16
18
|
s.extra_rdoc_files = [
|
17
19
|
"README.rdoc"
|
@@ -23,6 +25,7 @@ Gem::Specification.new do |s|
|
|
23
25
|
"History.txt",
|
24
26
|
"README.rdoc",
|
25
27
|
"Rakefile",
|
28
|
+
"bin/therubyracer",
|
26
29
|
"docs/data_conversion.txt",
|
27
30
|
"ext/v8/callbacks.cpp",
|
28
31
|
"ext/v8/callbacks.h",
|
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.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: x86-darwin-10
|
6
6
|
authors:
|
7
7
|
- Charles Lowell
|
@@ -10,14 +10,14 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-02-
|
14
|
-
default_executable:
|
13
|
+
date: 2010-02-26 00:00:00 -06:00
|
14
|
+
default_executable: therubyracer
|
15
15
|
dependencies: []
|
16
16
|
|
17
17
|
description: Call javascript code and manipulate javascript objects from ruby. Call ruby code and manipulate ruby objects from javascript.
|
18
18
|
email: cowboyd@thefrontside.net
|
19
|
-
executables:
|
20
|
-
|
19
|
+
executables:
|
20
|
+
- therubyracer
|
21
21
|
extensions: []
|
22
22
|
|
23
23
|
extra_rdoc_files:
|
@@ -312,6 +312,7 @@ files:
|
|
312
312
|
- ext/v8/upstream/2.0.6/tools/profile_view.js
|
313
313
|
- ext/v8/upstream/2.0.6/src/usage-analyzer.h
|
314
314
|
- ext/v8/upstream/2.0.6/src/compiler.cc
|
315
|
+
- bin/therubyracer
|
315
316
|
- ext/v8/upstream/2.0.6/src/math.js
|
316
317
|
- ext/v8/upstream/2.0.6/src/codegen.h
|
317
318
|
- ext/v8/upstream/scons/engine/SCons/cpp.py
|