mustang 0.2.1 → 0.2.2
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.
- data/README.md +53 -0
- data/TODO.md +5 -1
- data/ext/v8/extconf.rb +23 -16
- data/ext/v8/v8.cpp +2 -0
- data/ext/v8/v8_boolean.cpp +29 -0
- data/ext/v8/v8_boolean.h +18 -0
- data/ext/v8/v8_cast.cpp +3 -2
- data/ext/v8/v8_value.cpp +6 -2
- data/lib/mustang.rb +1 -0
- data/lib/mustang/v8/array.rb +4 -0
- data/lib/mustang/v8/boolean.rb +45 -0
- data/lib/mustang/v8/date.rb +4 -0
- data/lib/mustang/v8/function.rb +4 -0
- data/lib/mustang/v8/integer.rb +4 -0
- data/lib/mustang/v8/number.rb +4 -0
- data/lib/mustang/v8/regexp.rb +4 -0
- data/lib/mustang/v8/string.rb +4 -0
- data/mustang.gemspec +1 -1
- data/spec/mustang/v8/array_spec.rb +4 -0
- data/spec/mustang/v8/boolean_spec.rb +91 -0
- data/spec/mustang/v8/cast_spec.rb +2 -2
- data/spec/mustang/v8/date_spec.rb +6 -0
- data/spec/mustang/v8/function_spec.rb +4 -0
- data/spec/mustang/v8/integer_spec.rb +4 -0
- data/spec/mustang/v8/number_spec.rb +4 -0
- data/spec/mustang/v8/regexp_spec.rb +4 -0
- data/spec/mustang/v8/string_spec.rb +4 -0
- data/spec/mustang/v8/value_spec.rb +2 -2
- metadata +38 -4
data/README.md
CHANGED
@@ -4,6 +4,55 @@ Mustang development is proudly sponsored by [Cubox, Agile Rails Devshop](http://
|
|
4
4
|
|
5
5
|
Mustang is ruby proxy library for awesome Google V8 JavaScript engine.
|
6
6
|
|
7
|
+
## Motivation
|
8
|
+
|
9
|
+
JavaScript integration testing suite which contains more than 4000 steps and running time
|
10
|
+
more that 2 hours... I think that's enough. There is lot of different ways to handle headless
|
11
|
+
testing, but they all have lot of issues as well. They are super slow (Selenium, Watir), or
|
12
|
+
they are not working with ruby 1.9 (Johsnon), or they requires tricky external stuff (Culerity/Celerity,
|
13
|
+
Zombie). Our goal is to create fast javascript engine working fine on all popular ruby implementations
|
14
|
+
(1.8.x, 1.9.x, ree, rubinius), and make it core element of headless, virtual browser for testing
|
15
|
+
purposes (of course integrated with capybara and cucubmer).
|
16
|
+
|
17
|
+
## TheRubyRacer and PyV8 influence...
|
18
|
+
|
19
|
+
Yeap, [TheRubyRacer](http://github.com/cowboyd/therubyracer) from [Charles Lowell](http://github.com/cowboyd)
|
20
|
+
and [PyV8](http://code.google.com/p/pyv8/) made big influence on our Mustang code, so let say now big thanks
|
21
|
+
to the authors...
|
22
|
+
|
23
|
+
You can of course ask why we wrote library which seems to be very similar to TheRubyRacer... yeah it seems, but there
|
24
|
+
are a lot of differences. Here is short comparison of TheRubyRacer and Mustang:
|
25
|
+
|
26
|
+
Similarities:
|
27
|
+
|
28
|
+
* Both are using similar integration with ruby's garbage collector. Actually, Mustang's code which handles
|
29
|
+
that references is just improved version of TheRubyRacer's code (check the <tt>ext/v8/v8_ref.cpp</tt>).
|
30
|
+
* Both are reflecting JS objects to ruby and vice-versa.
|
31
|
+
|
32
|
+
Diffs:
|
33
|
+
|
34
|
+
* Mustang reflects all JavaScript objects and values properly. Properly, means
|
35
|
+
all values from within V8 are reflected to <tt>Mustang::V8::*</tt> objects,
|
36
|
+
regarding V8 inheritance tree which you can find [here](http://izs.me/v8-docs/classv8_1_1Data.html).
|
37
|
+
* Once reflected ruby object (and vice-versa) is always the same object in ruby
|
38
|
+
world.
|
39
|
+
* All reflected V8 objects acts exacltly the same as ruby natives. For example
|
40
|
+
you can deal with Mustang::V8::Array exactly the same as with native Ruby arrays
|
41
|
+
(eg. they are comparable with ruby objects, etc).
|
42
|
+
* Functions are reflected more accurately. Ruby objects' methods are represented
|
43
|
+
properly.
|
44
|
+
* Classes are converted to V8 function templates, so you can deal with them as with
|
45
|
+
prototypes.
|
46
|
+
* Different approach to deal with contexts, compiling JS scripts and exceptions handling.
|
47
|
+
* Support for regexp reflections.
|
48
|
+
* Way more friendly ruby api.
|
49
|
+
* A very thorough test suite (over 250 tests passing on all ruby versions)
|
50
|
+
* Clean codebase, less magic, fully documented.
|
51
|
+
* Lower memory usage.
|
52
|
+
|
53
|
+
And the most important, like i said before, Mustang is used as core element of our
|
54
|
+
bigger idea, so it have to exactly fit to our needs.
|
55
|
+
|
7
56
|
## Installation
|
8
57
|
|
9
58
|
Before you install mustang gem make sure you have `scons` installed.
|
@@ -38,6 +87,10 @@ For now it's only proof of concept. It implements very simple evaluation of java
|
|
38
87
|
cxt.eval("puts(a)") # displays "1" on the screen
|
39
88
|
cxt[:a] # => 1
|
40
89
|
|
90
|
+
### Advanced
|
91
|
+
|
92
|
+
TODO: coming soon...
|
93
|
+
|
41
94
|
## Note on Patches/Pull Requests
|
42
95
|
|
43
96
|
* Fork the project.
|
data/TODO.md
CHANGED
@@ -2,9 +2,13 @@
|
|
2
2
|
|
3
3
|
* better exceptions handling
|
4
4
|
* V8::Integer should inherit V8::Number
|
5
|
-
* specs for Mustang
|
5
|
+
* specs for Mustang context
|
6
6
|
* specs for support modules
|
7
7
|
* v8 debug stuff
|
8
8
|
* support for ObjectTemplates
|
9
9
|
* reflecting ruby classes to FunctionTemplates
|
10
10
|
* getting entered context
|
11
|
+
|
12
|
+
* V8::Data, V8::Value, V8::Primitive should be modules included in
|
13
|
+
other v8's datatypes. All that types should inherit native ruby
|
14
|
+
classes as well.
|
data/ext/v8/extconf.rb
CHANGED
@@ -28,30 +28,37 @@ def compile_vendor_v8!(dir)
|
|
28
28
|
arch = cpu_x64? ? 'x64' : 'ia32'
|
29
29
|
flags = '-fPIC -fno-builtin-memcpy -shared'
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
begin
|
32
|
+
make_sure_scons_installed!
|
33
|
+
defaults, ENV['CCFLAGS'] = ENV['CCFLAGS'], flags
|
34
|
+
puts "-"*30
|
35
|
+
compile_cmd = "cd #{dir} && scons mode=release snapshot=off library=static arch=#{arch}"
|
36
|
+
puts compile_cmd
|
37
|
+
system compile_cmd
|
38
|
+
puts "-"*30
|
39
|
+
ensure
|
40
|
+
ENV['CCFLAGS'] = defaults
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
|
-
|
45
|
-
|
44
|
+
unless have_library('v8')
|
45
|
+
V8_DIR = File.expand_path("../../../vendor/v8", __FILE__)
|
46
|
+
inc, lib = dir_config('v8', File.join(V8_DIR, 'include'), V8_DIR)
|
46
47
|
|
47
|
-
if V8_DIR == lib
|
48
|
-
|
49
|
-
|
48
|
+
if V8_DIR == lib
|
49
|
+
compile_vendor_v8!(V8_DIR)
|
50
|
+
$LOCAL_LIBS << Dir[File.join(V8_DIR, "**/**/libv8.a")].first
|
51
|
+
end
|
52
|
+
|
53
|
+
find_library('v8', nil, lib)
|
50
54
|
end
|
51
55
|
|
52
|
-
find_library('v8', nil, lib)
|
53
56
|
have_library('pthread')
|
57
|
+
have_header('string.h')
|
58
|
+
have_header('ruby.h')
|
54
59
|
have_header('v8.h')
|
60
|
+
have_header('v8-debug.h')
|
61
|
+
have_header('v8-profiler.h')
|
55
62
|
|
56
63
|
CONFIG['LDSHARED'] = '$(CXX) -shared' unless darwin?
|
57
64
|
|
data/ext/v8/v8.cpp
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "v8_function.h"
|
13
13
|
#include "v8_regexp.h"
|
14
14
|
#include "v8_external.h"
|
15
|
+
#include "v8_boolean.h"
|
15
16
|
#include "v8_errors.h"
|
16
17
|
|
17
18
|
extern "C" void Init_v8() {
|
@@ -33,5 +34,6 @@ extern "C" void Init_v8() {
|
|
33
34
|
Init_V8_Function();
|
34
35
|
Init_V8_Regexp();
|
35
36
|
Init_V8_External();
|
37
|
+
Init_V8_Boolean();
|
36
38
|
Init_V8_Errors();
|
37
39
|
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#include "v8_ref.h"
|
2
|
+
#include "v8_cast.h"
|
3
|
+
#include "v8_boolean.h"
|
4
|
+
#include "v8_errors.h"
|
5
|
+
#include "v8_value.h"
|
6
|
+
#include "v8_macros.h"
|
7
|
+
|
8
|
+
using namespace v8;
|
9
|
+
|
10
|
+
VALUE rb_cV8Boolean;
|
11
|
+
VALUE rb_cV8FalseClass;
|
12
|
+
VALUE rb_cV8TrueClass;
|
13
|
+
|
14
|
+
/* Booleans initializer */
|
15
|
+
void Init_V8_Boolean()
|
16
|
+
{
|
17
|
+
rb_cV8Boolean = rb_define_class_under(rb_mV8, "Boolean", rb_cV8Primitive);
|
18
|
+
VALUE args;
|
19
|
+
|
20
|
+
/* false */
|
21
|
+
args = Qfalse;
|
22
|
+
rb_cV8FalseClass = rb_define_class_under(rb_mV8, "FalseClass", rb_cV8Boolean);
|
23
|
+
rb_define_const(rb_mV8, "False", rb_funcall2(rb_cV8FalseClass, rb_intern("new"), 1, &args));
|
24
|
+
|
25
|
+
/* true */
|
26
|
+
args = Qtrue;
|
27
|
+
rb_cV8TrueClass = rb_define_class_under(rb_mV8, "TrueClass", rb_cV8Boolean);
|
28
|
+
rb_define_const(rb_mV8, "True", rb_funcall2(rb_cV8TrueClass, rb_intern("new"), 1, &args));
|
29
|
+
}
|
data/ext/v8/v8_boolean.h
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#ifndef __V8_BOOLEAN_H
|
2
|
+
#define __V8_BOOLEAN_H
|
3
|
+
|
4
|
+
#include "v8_main.h"
|
5
|
+
|
6
|
+
using namespace v8;
|
7
|
+
|
8
|
+
/* V8::Boolean class */
|
9
|
+
RUBY_EXTERN VALUE rb_cV8Boolean;
|
10
|
+
/* V8::FalseClass class */
|
11
|
+
RUBY_EXTERN VALUE rb_cV8FalseClass;
|
12
|
+
/* V8::TrueClass class */
|
13
|
+
RUBY_EXTERN VALUE rb_cV8TrueClass;
|
14
|
+
|
15
|
+
/* API */
|
16
|
+
void Init_V8_Boolean();
|
17
|
+
|
18
|
+
#endif /* __V8_BOOLEAN_H */
|
data/ext/v8/v8_cast.cpp
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "v8_regexp.h"
|
13
13
|
#include "v8_context.h"
|
14
14
|
#include "v8_external.h"
|
15
|
+
#include "v8_boolean.h"
|
15
16
|
#include "v8_errors.h"
|
16
17
|
#include "v8_macros.h"
|
17
18
|
|
@@ -80,7 +81,7 @@ VALUE to_ruby(Handle<Value> value)
|
|
80
81
|
} else if (value->IsNull()) {
|
81
82
|
return rb_const_get(rb_mV8, rb_intern("Null"));
|
82
83
|
} else if (value->IsBoolean()) {
|
83
|
-
return value->BooleanValue() ?
|
84
|
+
return rb_const_get(rb_mV8, value->BooleanValue() ? rb_intern("True") : rb_intern("False"));
|
84
85
|
} else if (value->IsDate()) {
|
85
86
|
return to_ruby_without_peer<Date>(value, rb_cV8Date);
|
86
87
|
} else if (value->IsUint32() || value->IsInt32()) {
|
@@ -101,7 +102,7 @@ VALUE to_ruby(Handle<Value> value)
|
|
101
102
|
return to_ruby_with_peer<Object>(value, rb_cV8Object);
|
102
103
|
}
|
103
104
|
|
104
|
-
return
|
105
|
+
return rb_const_get(rb_mV8, rb_intern("Empty"));
|
105
106
|
}
|
106
107
|
|
107
108
|
OVERLOAD_TO_RUBY_WITH(Boolean);
|
data/ext/v8/v8_value.cpp
CHANGED
@@ -21,8 +21,12 @@ UNWRAPPER(Value);
|
|
21
21
|
*/
|
22
22
|
static VALUE rb_v8_value_new(VALUE self, VALUE data)
|
23
23
|
{
|
24
|
-
HandleScope scope;
|
25
|
-
|
24
|
+
HandleScope scope;
|
25
|
+
|
26
|
+
if (data != Qtrue && data != Qfalse && data != Qnil) {
|
27
|
+
PREVENT_CREATION_WITHOUT_CONTEXT();
|
28
|
+
}
|
29
|
+
|
26
30
|
return v8_ref_new(self, to_v8(data));
|
27
31
|
}
|
28
32
|
|
data/lib/mustang.rb
CHANGED
data/lib/mustang/v8/array.rb
CHANGED
@@ -0,0 +1,45 @@
|
|
1
|
+
module Mustang
|
2
|
+
module V8
|
3
|
+
class Boolean
|
4
|
+
def true?
|
5
|
+
self.is_a?(TrueClass)
|
6
|
+
end
|
7
|
+
|
8
|
+
def false?
|
9
|
+
self.is_a?(FalseClass)
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
to_bool.to_s
|
14
|
+
end
|
15
|
+
|
16
|
+
def &(other)
|
17
|
+
to_bool & other
|
18
|
+
end
|
19
|
+
|
20
|
+
def |(other)
|
21
|
+
to_bool | other
|
22
|
+
end
|
23
|
+
|
24
|
+
def ^(other)
|
25
|
+
to_bool ^ other
|
26
|
+
end
|
27
|
+
|
28
|
+
def ==(other)
|
29
|
+
to_bool == other
|
30
|
+
end
|
31
|
+
|
32
|
+
def <=>(other)
|
33
|
+
to_bool <=> other
|
34
|
+
end
|
35
|
+
|
36
|
+
def kind_of?(klass)
|
37
|
+
klass == (false? ? false.class : true.class) or super(klass)
|
38
|
+
end
|
39
|
+
|
40
|
+
def to_bool
|
41
|
+
false? ? false : true
|
42
|
+
end
|
43
|
+
end # Boolean
|
44
|
+
end # V8
|
45
|
+
end # Mustang
|
data/lib/mustang/v8/date.rb
CHANGED
data/lib/mustang/v8/function.rb
CHANGED
data/lib/mustang/v8/integer.rb
CHANGED
data/lib/mustang/v8/number.rb
CHANGED
data/lib/mustang/v8/regexp.rb
CHANGED
data/lib/mustang/v8/string.rb
CHANGED
data/mustang.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "mustang"
|
5
5
|
s.summary = "Awesome V8 JavaScript engine embedded into the Ruby's shiny body"
|
6
|
-
s.version = "0.2.
|
6
|
+
s.version = "0.2.2"
|
7
7
|
s.authors = ["Chris Kowalik", "Cubox"]
|
8
8
|
s.description = "Ruby proxy library for Google V8 Javascript engine."
|
9
9
|
s.homepage = "http://github.com/nu7hatch/mustang"
|
@@ -7,6 +7,10 @@ describe Mustang::V8::Array do
|
|
7
7
|
it "inherits Mustang::V8::Object" do
|
8
8
|
subject.new(1,2,3).should be_kind_of(Mustang::V8::Object)
|
9
9
|
end
|
10
|
+
|
11
|
+
it "is kind of Array" do
|
12
|
+
subject.new(1,2,3).should be_kind_of Array
|
13
|
+
end
|
10
14
|
|
11
15
|
describe ".new" do
|
12
16
|
context "when no context entered" do
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
|
3
|
+
describe Mustang::V8::Boolean do
|
4
|
+
subject { Mustang::V8::Boolean }
|
5
|
+
setup_context
|
6
|
+
|
7
|
+
it "inherits Mustang::V8::Data" do
|
8
|
+
subject.new(10).should be_kind_of(Mustang::V8::Primitive)
|
9
|
+
end
|
10
|
+
|
11
|
+
it "is kind of FalseClass or TrueClass" do
|
12
|
+
Mustang::V8::False.should be_kind_of FalseClass
|
13
|
+
Mustang::V8::True.should be_kind_of TrueClass
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
shared_examples_for "Boolean" do
|
18
|
+
describe "#to_bool" do
|
19
|
+
it "returns ruby bool value" do
|
20
|
+
subject.to_bool.should == compare
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "#true?" do
|
25
|
+
it "returns proper value" do
|
26
|
+
subject.true?.should == (compare == true)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
describe "#false?" do
|
31
|
+
it "returns proper value" do
|
32
|
+
subject.false?.should == (compare == false)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
describe "#&" do
|
37
|
+
it "acts as ruby bool's method" do
|
38
|
+
(subject & true).should == (compare & true)
|
39
|
+
(subject & false).should == (compare & false)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "#|" do
|
44
|
+
it "acts as ruby bool's method" do
|
45
|
+
(subject | true).should == (compare | true)
|
46
|
+
(subject | false).should == (compare | false)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
describe "#^" do
|
51
|
+
it "acts as ruby bool's method" do
|
52
|
+
(subject ^ true).should == (compare ^ true)
|
53
|
+
(subject ^ false).should == (compare ^ false)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
describe "#==" do
|
58
|
+
it "acts as ruby bool's method" do
|
59
|
+
subject.should == compare
|
60
|
+
subject.should_not == !compare
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "#to_s" do
|
65
|
+
it "acts as ruby bool's method" do
|
66
|
+
subject.to_s.should == compare.to_s
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe Mustang::V8::False do
|
72
|
+
let(:compare) { false }
|
73
|
+
it_should_behave_like "Boolean"
|
74
|
+
|
75
|
+
it "acts as normal bool in conditional statements" do
|
76
|
+
pending
|
77
|
+
(subject ? 'foo' : 'bar').should == 'bar'
|
78
|
+
(!subject ? 'foo' : 'bar').should == 'foo'
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe Mustang::V8::True do
|
83
|
+
let(:compare) { true }
|
84
|
+
it_should_behave_like "Boolean"
|
85
|
+
|
86
|
+
it "acts as normal bool in conditional statements" do
|
87
|
+
pending
|
88
|
+
(!subject ? 'foo' : 'bar').should == 'bar'
|
89
|
+
(subject ? 'foo' : 'bar').should == 'foo'
|
90
|
+
end
|
91
|
+
end
|
@@ -31,8 +31,8 @@ describe "Typecasting" do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "converts boolean values properly" do
|
34
|
-
cxt.eval("true", "<eval>").should
|
35
|
-
cxt.eval("false", "<eval>").should
|
34
|
+
cxt.eval("true", "<eval>").should == true
|
35
|
+
cxt.eval("false", "<eval>").should == false
|
36
36
|
end
|
37
37
|
|
38
38
|
it "converts strings properly" do
|
@@ -12,6 +12,12 @@ describe Mustang::V8::Date do
|
|
12
12
|
subject.new(@now).should be_kind_of(Mustang::V8::Value)
|
13
13
|
end
|
14
14
|
|
15
|
+
it "is kind of Date, DateTime, Time" do
|
16
|
+
subject.new(@now).should be_kind_of Date
|
17
|
+
subject.new(@now).should be_kind_of DateTime
|
18
|
+
subject.new(@now).should be_kind_of Time
|
19
|
+
end
|
20
|
+
|
15
21
|
describe ".new" do
|
16
22
|
context "when no context entered" do
|
17
23
|
it "should raise error" do
|
@@ -8,6 +8,10 @@ describe Mustang::V8::Function do
|
|
8
8
|
subject.new(lambda { "foo" }).should be_kind_of(Mustang::V8::Object)
|
9
9
|
end
|
10
10
|
|
11
|
+
it "is kind of Proc" do
|
12
|
+
subject.new(proc {}).should be_kind_of Proc
|
13
|
+
end
|
14
|
+
|
11
15
|
describe ".new" do
|
12
16
|
context "when no context entered" do
|
13
17
|
it "should raise error" do
|
@@ -9,6 +9,10 @@ describe Mustang::V8::Integer do
|
|
9
9
|
subject.new(10).should be_kind_of(Mustang::V8::Number)
|
10
10
|
end
|
11
11
|
|
12
|
+
it "is kind of Fixnum" do
|
13
|
+
subject.new(1).should be_kind_of Fixnum
|
14
|
+
end
|
15
|
+
|
12
16
|
describe ".new" do
|
13
17
|
context "when no context entered" do
|
14
18
|
it "should raise error" do
|
@@ -8,6 +8,10 @@ describe Mustang::V8::Number do
|
|
8
8
|
subject.new(10.5).should be_kind_of(Mustang::V8::Primitive)
|
9
9
|
end
|
10
10
|
|
11
|
+
it "is kind of Float" do
|
12
|
+
subject.new(10.5).should be_kind_of Float
|
13
|
+
end
|
14
|
+
|
11
15
|
describe ".new" do
|
12
16
|
it "creates new v8 number based on passed value" do
|
13
17
|
subject.new(10.5).should == 10.5
|
@@ -8,6 +8,10 @@ describe Mustang::V8::Regexp do
|
|
8
8
|
subject.new(/foo(bar)?/).should be_kind_of(Mustang::V8::Value)
|
9
9
|
end
|
10
10
|
|
11
|
+
it "is kind of Regexp" do
|
12
|
+
subject.new(/foo/).should be_kind_of Regexp
|
13
|
+
end
|
14
|
+
|
11
15
|
describe ".new" do
|
12
16
|
context "when no context entered" do
|
13
17
|
it "should raise error" do
|
@@ -9,6 +9,10 @@ describe Mustang::V8::String do
|
|
9
9
|
subject.new("foo").should be_kind_of(Mustang::V8::Primitive)
|
10
10
|
end
|
11
11
|
|
12
|
+
it "is kind of String" do
|
13
|
+
subject.new("foo").should be_kind_of String
|
14
|
+
end
|
15
|
+
|
12
16
|
describe ".new" do
|
13
17
|
context "when no context entered" do
|
14
18
|
it "should raise error" do
|
@@ -169,8 +169,8 @@ describe Mustang::V8::Value do
|
|
169
169
|
|
170
170
|
describe "#to_boolean" do
|
171
171
|
it "return V8 boolean representation of value" do
|
172
|
-
Mustang::V8::Object.new(:foo => 1).to_boolean.should
|
173
|
-
Mustang::V8::Integer.new(0).to_boolean.should
|
172
|
+
Mustang::V8::Object.new(:foo => 1).to_boolean.should == true
|
173
|
+
Mustang::V8::Integer.new(0).to_boolean.should == false
|
174
174
|
end
|
175
175
|
end
|
176
176
|
|
metadata
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mustang
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 2
|
10
|
+
version: 0.2.2
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
13
|
- Chris Kowalik
|
@@ -11,7 +16,8 @@ autorequire:
|
|
11
16
|
bindir: bin
|
12
17
|
cert_chain: []
|
13
18
|
|
14
|
-
date: 2011-04-
|
19
|
+
date: 2011-04-11 00:00:00 -03:00
|
20
|
+
default_executable:
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
23
|
name: ore-tasks
|
@@ -21,6 +27,10 @@ dependencies:
|
|
21
27
|
requirements:
|
22
28
|
- - ~>
|
23
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
- 4
|
24
34
|
version: "0.4"
|
25
35
|
type: :development
|
26
36
|
version_requirements: *id001
|
@@ -32,6 +42,10 @@ dependencies:
|
|
32
42
|
requirements:
|
33
43
|
- - ~>
|
34
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 2
|
48
|
+
- 0
|
35
49
|
version: "2.0"
|
36
50
|
type: :development
|
37
51
|
version_requirements: *id002
|
@@ -43,6 +57,10 @@ dependencies:
|
|
43
57
|
requirements:
|
44
58
|
- - ~>
|
45
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 25
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
- 9
|
46
64
|
version: "0.9"
|
47
65
|
type: :development
|
48
66
|
version_requirements: *id003
|
@@ -54,6 +72,10 @@ dependencies:
|
|
54
72
|
requirements:
|
55
73
|
- - ~>
|
56
74
|
- !ruby/object:Gem::Version
|
75
|
+
hash: 5
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
- 7
|
57
79
|
version: "0.7"
|
58
80
|
type: :development
|
59
81
|
version_requirements: *id004
|
@@ -78,6 +100,8 @@ files:
|
|
78
100
|
- ext/v8/v8_array.h
|
79
101
|
- ext/v8/v8_base.cpp
|
80
102
|
- ext/v8/v8_base.h
|
103
|
+
- ext/v8/v8_boolean.cpp
|
104
|
+
- ext/v8/v8_boolean.h
|
81
105
|
- ext/v8/v8_cast.cpp
|
82
106
|
- ext/v8/v8_cast.h
|
83
107
|
- ext/v8/v8_context.cpp
|
@@ -115,6 +139,7 @@ files:
|
|
115
139
|
- lib/mustang/errors.rb
|
116
140
|
- lib/mustang/support/delegated.rb
|
117
141
|
- lib/mustang/v8/array.rb
|
142
|
+
- lib/mustang/v8/boolean.rb
|
118
143
|
- lib/mustang/v8/context.rb
|
119
144
|
- lib/mustang/v8/date.rb
|
120
145
|
- lib/mustang/v8/error.rb
|
@@ -132,6 +157,7 @@ files:
|
|
132
157
|
- spec/mustang/core_ext/object_spec.rb
|
133
158
|
- spec/mustang/core_ext/symbol_spec.rb
|
134
159
|
- spec/mustang/v8/array_spec.rb
|
160
|
+
- spec/mustang/v8/boolean_spec.rb
|
135
161
|
- spec/mustang/v8/cast_spec.rb
|
136
162
|
- spec/mustang/v8/context_spec.rb
|
137
163
|
- spec/mustang/v8/data_spec.rb
|
@@ -1577,6 +1603,7 @@ files:
|
|
1577
1603
|
- vendor/v8/tools/visual_studio/v8_x64.vcproj
|
1578
1604
|
- vendor/v8/tools/visual_studio/x64.vsprops
|
1579
1605
|
- vendor/v8/tools/windows-tick-processor.bat
|
1606
|
+
has_rdoc: true
|
1580
1607
|
homepage: http://github.com/nu7hatch/mustang
|
1581
1608
|
licenses:
|
1582
1609
|
- MIT
|
@@ -1591,17 +1618,23 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
1591
1618
|
requirements:
|
1592
1619
|
- - ">="
|
1593
1620
|
- !ruby/object:Gem::Version
|
1621
|
+
hash: 3
|
1622
|
+
segments:
|
1623
|
+
- 0
|
1594
1624
|
version: "0"
|
1595
1625
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
1596
1626
|
none: false
|
1597
1627
|
requirements:
|
1598
1628
|
- - ">="
|
1599
1629
|
- !ruby/object:Gem::Version
|
1630
|
+
hash: 3
|
1631
|
+
segments:
|
1632
|
+
- 0
|
1600
1633
|
version: "0"
|
1601
1634
|
requirements: []
|
1602
1635
|
|
1603
1636
|
rubyforge_project:
|
1604
|
-
rubygems_version: 1.7
|
1637
|
+
rubygems_version: 1.3.7
|
1605
1638
|
signing_key:
|
1606
1639
|
specification_version: 3
|
1607
1640
|
summary: Awesome V8 JavaScript engine embedded into the Ruby's shiny body
|
@@ -1612,6 +1645,7 @@ test_files:
|
|
1612
1645
|
- spec/mustang/core_ext/object_spec.rb
|
1613
1646
|
- spec/mustang/core_ext/symbol_spec.rb
|
1614
1647
|
- spec/mustang/v8/array_spec.rb
|
1648
|
+
- spec/mustang/v8/boolean_spec.rb
|
1615
1649
|
- spec/mustang/v8/cast_spec.rb
|
1616
1650
|
- spec/mustang/v8/context_spec.rb
|
1617
1651
|
- spec/mustang/v8/data_spec.rb
|