Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit e13997a

Browse files
committed
Merge pull request #230 from bradland/readme-update
Update with latest information on libv8 relationship and options
2 parents 93a2c77 + 92ab724 commit e13997a

1 file changed

Lines changed: 34 additions & 44 deletions

File tree

README.md

Lines changed: 34 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
* [irc://irc.freenode.net/therubyracer](http://groups.google.com/group/therubyracer)
66
* [Documentation](https://github.com/cowboyd/therubyracer/wiki)
77

8-
## DESCRIPTION
8+
### DESCRIPTION
99

1010
Embed the V8 JavaScript interpreter into Ruby.
1111

12-
13-
## FEATURES
12+
### FEATURES
1413

1514
* Evaluate JavaScript from within Ruby
1615
* Embed your Ruby objects into the JavaScript world
1716
* Manipulate JavaScript objects and call JavaScript functions from Ruby
1817
* API compatible with the The Ruby Rhino (for JRuby: http://github.com/cowboyd/therubyrhino)
1918

20-
## SYNOPSIS
19+
### SYNOPSIS
2120

2221
gem install therubyracer
2322

@@ -42,7 +41,8 @@ embed Ruby code into your scope and call it from JavaScript
4241
cxt["say"] = lambda {|this, word, times| word * times}
4342
cxt.eval("say('Hello', 3)") #=> HelloHelloHello
4443

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
4646

4747
class MyMath
4848
def plus(lhs, rhs)
@@ -64,9 +64,10 @@ you can do the same thing with Object#eval_js
6464

6565
math.eval_js("plus(20,22)")
6666

67-
## Different ways of loading JavaScript source
67+
### Different ways of loading JavaScript source
6868

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.
7071

7172
evaluate bytes read from any File/IO object:
7273

@@ -78,15 +79,17 @@ or load it by filename
7879

7980
cxt.load("mysource.js")
8081

82+
### Safe by default, dangerous by demand
8183

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.
8789

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.
9093

9194
class A
9295
def a
@@ -115,49 +118,36 @@ exposed by default. E.g.
115118
cxt.eval("b.object_id") #=> undefined, object_id is on Object
116119
end
117120

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.
124123

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
126125

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)
136127

137-
gem 'libv8', '~> 3.11.8'
128+
### PREREQUISITES
138129

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.
142135

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.
149138

139+
### DEVELOP
150140

151-
## DEVELOP
152141
git clone git://github.com/cowboyd/therubyracer.git
153142
cd therubyracer
154143
bundle install
155144
rake compile
156145

157-
## Sponsored by
146+
### Sponsored by
147+
158148
<a href="http://thefrontside.net">![The Frontside](http://github.com/cowboyd/therubyracer/raw/master/thefrontside.png)</a>
159149

160-
## LICENSE:
150+
### LICENSE:
161151

162152
(The MIT License)
163153

@@ -183,4 +173,4 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
183173
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
184174

185175
[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

0 commit comments

Comments
 (0)