Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 36fff48912be
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: c76065f025fb
Choose a head ref
  • 2 commits
  • 1 file changed
  • 2 contributors

Commits on Jul 5, 2015

  1. Copy the full SHA
    d4356fd View commit details
  2. Merge pull request #981 from bbatsov/readme-improvements

    Small improvements to the README
    elia committed Jul 5, 2015

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    c76065f View commit details
Showing with 20 additions and 22 deletions.
  1. +20 −22 README.md
42 changes: 20 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -4,26 +4,24 @@
[![Gem Version](http://img.shields.io/gem/v/opal.svg?style=flat)](http://badge.fury.io/rb/opal)
[![Code Climate](http://img.shields.io/codeclimate/github/opal/opal.svg?style=flat)](https://codeclimate.com/github/opal/opal)

Opal is a ruby to javascript source-to-source compiler. It also has an
implementation of the ruby corelib.
Opal is a Ruby to JavaScript source-to-source compiler. It also has an
implementation of the Ruby corelib.

Opal is [hosted on github](http://github.com/opal/opal). Chat is available on *Gitter* at [opal/opal](https://gitter.im/opal/opal) and the Freenode IRC channel at [#opal](http://webchat.freenode.net/?channels=opal).
Opal is [hosted on GitHub](http://github.com/opal/opal). Chat is available on *Gitter* at [opal/opal](https://gitter.im/opal/opal) and the Freenode IRC channel at [#opal](http://webchat.freenode.net/?channels=opal).
Ask questions on [stackoverflow (tag #opalrb)](http://stackoverflow.com/questions/ask?tags=opalrb). Get the [Opalist newsletter](http://opalist.co) for updates and community news.

[![Inline docs](http://inch-ci.org/github/opal/opal.svg?branch=master&style=flat)](http://opalrb.org/docs/api)
[![Gitter chat](http://img.shields.io/badge/gitter-opal%2Fopal-009966.svg?style=flat)](https://gitter.im/opal/opal)
[![Stack Overflow](http://img.shields.io/badge/stackoverflow-%23opalrb-orange.svg?style=flat)](http://stackoverflow.com/questions/ask?tags=opalrb)



## Usage

See the website, [http://opalrb.org](http://opalrb.org).

### Compiling ruby code
### Compiling Ruby code

`Opal.compile` is a simple interface to just compile a string of ruby into a
string of javascript code.
`Opal.compile` is a simple interface to just compile a string of Ruby into a
string of JavaScript code.

```ruby
Opal.compile("puts 'wow'") # => "(function() { ... self.$puts("wow"); ... })()"
@@ -41,7 +39,7 @@ Opal::Builder.build('opal') #=> "(function() { ... })()"

### Running compiled code

You can write the above two strings to file, and run as:
You can write the above two strings to files and run as:

```html
<!DOCTYPE html>
@@ -53,7 +51,7 @@ You can write the above two strings to file, and run as:
</html>
```

Just open a browser to this page and view the console.
Just open this page in a browser and check the JavaScript console.

## Running tests

@@ -62,7 +60,7 @@ First, install dependencies:
$ bundle install
$ npm install -g jshint

RubySpec related repos must be cloned as a gitsubmodules:
RubySpec related repos must be cloned as git submodules:

$ git submodule update --init

@@ -75,7 +73,7 @@ This will command will run all RSpec and MSpec examples in sequence.
#### Automated runs

A `Guardfile` with decent mappings between specs and lib/corelib/stdlib files is in place.
Run `bundle exec guard -i` to have it started.
Run `bundle exec guard -i` to start `guard`.


### MSpec
@@ -90,7 +88,7 @@ visit `http://localhost:9292/` in any web browser.

### Rspec

[RSpec][] tests can be run with
[RSpec][] tests can be run with:

$ rake rspec

@@ -99,20 +97,20 @@ visit `http://localhost:9292/` in any web browser.

What code is supposed to run where?

* `lib/` code runs inside your ruby env. It compiles ruby to javascript.
* `lib/` code runs inside your Ruby env. It compiles Ruby to JavaScript.
* `opal/` is the runtime/corelib for our implementation (runs in browser)
* `stdlib/` is our implementation of ruby stdlib. It is optional (for browser).
* `stdlib/` is our implementation of Ruby's stdlib. It is optional (for browser).

### lib

The `lib` directory holds the opal parser/compiler used to compile ruby
into javascript. It is also built ready for the browser into `opal-parser.js`
to allow compilation in any javascript environment.
The `lib` directory holds the opal parser/compiler used to compile Ruby
into JavaScript. It is also built ready for the browser into `opal-parser.js`
to allow compilation in any JavaScript environment.

### corelib

This directory holds the opal runtime and corelib implemented in ruby and
javascript.
This directory holds the opal runtime and corelib implemented in Ruby and
JavaScript.

### stdlib

@@ -127,7 +125,7 @@ Holds the stdlib that opal currently supports. This includes `Observable`,
* Safari 5.1+
* Opera 12.1x or (Current - 1) or Current

Any problems encountered using the browsers listed above should be reported as a bug.
Any problems encountered using the browsers listed above should be reported as bugs.

(Current - 1) or Current denotes that we support the current stable version of
the browser and the version that preceded it. For example, if the current
@@ -143,7 +141,7 @@ Cross-browser testing is sponsored by [BrowserStack](http://browserstack.com).

(The MIT License)

Copyright (C) 2013 by Adam Beynon
Copyright (C) 2013-2015 by Adam Beynon

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal