opal-rails 0.3.8 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +25 -1
- data/lib/opal/default_options.rb +18 -0
- data/lib/opal/rails/engine.rb +6 -0
- data/lib/opal/rails/version.rb +1 -1
- data/opal-rails.gemspec +2 -2
- data/spec/opal/default_options_spec.rb +13 -0
- data/spec/support/reset_assets_cache.rb +5 -0
- data/spec/support/reset_default_options.rb +3 -0
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32adae8b04d04337405ba3018e5b863435d5d67d
|
4
|
+
data.tar.gz: 882a63b23907f3ee8a7076838a40af8803aaa055
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a4748f5d127153eecd3eba0ade49273c1b253929e3cf57b74b8789d68461192c866b1ef85c97e2dffdda5250b0d97e50719388369c0d365783bdf235767d3d
|
7
|
+
data.tar.gz: a7aadcf9bbe904443c0a4ec9621d96209d40c2ac52ffd35a9588dccc8a90db1e50a09d17bbc66c78a5dde4bc9061b1cc8ca0d14af69f4b66c36f4aeba53bff89
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# edge
|
2
|
+
|
3
|
+
* Add `Rails.application.config.opal` which accepts:
|
4
|
+
- method_missing: `<Boolean>` (default: `true`)
|
5
|
+
- optimized_operators: `<Boolean>` (default: `true`)
|
6
|
+
- arity_check: `<Boolean>` (default: `false`)
|
7
|
+
- const_missing: `<Boolean>` (default: `true`)
|
8
|
+
|
9
|
+
* Add the Changelog
|
10
|
+
|
11
|
+
# 0.3.8 2013-05-07
|
12
|
+
|
13
|
+
* Add `opal/rails` alongside to `opal-rails` for older bundlers autorequire
|
14
|
+
|
15
|
+
|
16
|
+
# 0.3.7 2013-05-04
|
17
|
+
|
18
|
+
* Rails 4.0.0 support
|
19
|
+
* Add `opal_ujs`, now it's possible to use Opal for new Rails apps: `rails new <app-name> -j opal`
|
20
|
+
* Updated README examples
|
21
|
+
|
data/README.md
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/elia/opal-rails.png)](http://travis-ci.org/elia/opal-rails)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/elia/opal-rails.png)](https://codeclimate.com/github/elia/opal-rails)
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/opal-rails.png)](http://badge.fury.io/rb/opal-rails)
|
5
6
|
|
6
|
-
_Rails (3.2+, 4.0) bindings for [Opal Ruby](http://opalrb.org) engine._
|
7
|
+
_Rails (3.2+, 4.0) bindings for [Opal Ruby](http://opalrb.org) engine. ([Changelog](https://github.com/opal/opal-rails/blob/master/CHANGELOG.md))_
|
7
8
|
|
8
9
|
|
9
10
|
|
@@ -22,6 +23,29 @@ rails new <app-name> --javascript=opal
|
|
22
23
|
```
|
23
24
|
|
24
25
|
|
26
|
+
### Configuration
|
27
|
+
|
28
|
+
Add your configuration in `config/application.rb` with the following contents:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
module MyApp
|
32
|
+
class Application < Rails::Application
|
33
|
+
# These are the available options with their default value:
|
34
|
+
config.opal.method_missing = true
|
35
|
+
config.opal.optimized_operators = true
|
36
|
+
config.opal.arity_check = false
|
37
|
+
config.opal.const_missing = true
|
38
|
+
end
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
|
43
|
+
### Gotchas
|
44
|
+
|
45
|
+
After changing the version of the `opal` gem (e.g. via `bundle update opal`) or any configuration flag **you should trash the `#{Rails.root}/tmp/cache/assets` folder**, otherwise you could see a cached source compiled before the change.
|
46
|
+
|
47
|
+
|
48
|
+
|
25
49
|
## Usage
|
26
50
|
|
27
51
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'opal'
|
2
|
+
|
3
|
+
class << Opal
|
4
|
+
attr_writer :default_options
|
5
|
+
def default_options
|
6
|
+
@default_options ||= {}
|
7
|
+
end
|
8
|
+
|
9
|
+
def parse_with_default_options source, options = {}
|
10
|
+
parse_without_default_options(source, default_options.merge(options))
|
11
|
+
end
|
12
|
+
|
13
|
+
alias parse_without_default_options parse
|
14
|
+
alias parse parse_with_default_options
|
15
|
+
end
|
16
|
+
|
17
|
+
|
18
|
+
|
data/lib/opal/rails/engine.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
require 'rails'
|
2
|
+
require 'opal/default_options'
|
2
3
|
|
3
4
|
module Opal
|
4
5
|
module Rails
|
5
6
|
class Engine < ::Rails::Engine
|
6
7
|
config.app_generators.javascript_engine :opal
|
7
8
|
|
9
|
+
config.opal = ActiveSupport::OrderedOptions.new
|
10
|
+
|
11
|
+
|
8
12
|
# Cache eager_load_paths now, otherwise the assets dir is added
|
9
13
|
# and its .rb files are eagerly loaded.
|
10
14
|
config.eager_load_paths
|
@@ -17,6 +21,8 @@ module Opal
|
|
17
21
|
Opal.paths.each do |path|
|
18
22
|
app.assets.append_path path
|
19
23
|
end
|
24
|
+
|
25
|
+
Opal.default_options = config.opal
|
20
26
|
end
|
21
27
|
|
22
28
|
end
|
data/lib/opal/rails/version.rb
CHANGED
data/opal-rails.gemspec
CHANGED
@@ -26,8 +26,8 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency 'opal-spec', '>= 0.2.15'
|
27
27
|
s.add_runtime_dependency 'jquery-rails'
|
28
28
|
|
29
|
-
s.add_development_dependency 'rspec', '~> 2.
|
30
|
-
s.add_development_dependency 'rspec-rails', '~> 2.
|
29
|
+
s.add_development_dependency 'rspec', '~> 2.13'
|
30
|
+
s.add_development_dependency 'rspec-rails', '~> 2.13'
|
31
31
|
|
32
32
|
s.add_development_dependency 'capybara', '< 2'
|
33
33
|
s.add_development_dependency 'launchy'
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'opal/default_options'
|
3
|
+
|
4
|
+
describe Opal::Parser do
|
5
|
+
let(:default_options) { {:method_missing => false} }
|
6
|
+
let(:source) { 'puts "ciao"' }
|
7
|
+
before { Opal.default_options = default_options }
|
8
|
+
|
9
|
+
it 'fetches default options defined in the Opal module' do
|
10
|
+
described_class.any_instance.should_receive(:parse).with(source, default_options)
|
11
|
+
Opal.parse(source)
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -92,28 +92,28 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '2.
|
95
|
+
version: '2.13'
|
96
96
|
type: :development
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ~>
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '2.
|
102
|
+
version: '2.13'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: rspec-rails
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: '2.
|
109
|
+
version: '2.13'
|
110
110
|
type: :development
|
111
111
|
prerelease: false
|
112
112
|
version_requirements: !ruby/object:Gem::Requirement
|
113
113
|
requirements:
|
114
114
|
- - ~>
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: '2.
|
116
|
+
version: '2.13'
|
117
117
|
- !ruby/object:Gem::Dependency
|
118
118
|
name: capybara
|
119
119
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +166,7 @@ files:
|
|
166
166
|
- .gitignore
|
167
167
|
- .rspec
|
168
168
|
- .travis.yml
|
169
|
+
- CHANGELOG.md
|
169
170
|
- Gemfile
|
170
171
|
- README.md
|
171
172
|
- Rakefile
|
@@ -176,6 +177,7 @@ files:
|
|
176
177
|
- lib/assets/javascripts/opal-spec-runner.js.rb
|
177
178
|
- lib/assets/javascripts/opal_ujs.js.rb
|
178
179
|
- lib/opal-rails.rb
|
180
|
+
- lib/opal/default_options.rb
|
179
181
|
- lib/opal/rails.rb
|
180
182
|
- lib/opal/rails/engine.rb
|
181
183
|
- lib/opal/rails/haml_filter.rb
|
@@ -186,9 +188,12 @@ files:
|
|
186
188
|
- script/rails
|
187
189
|
- spec/integration/assigns_spec.rb
|
188
190
|
- spec/integration/in_browser_specs_spec.rb
|
191
|
+
- spec/opal/default_options_spec.rb
|
189
192
|
- spec/opal/processor_spec.rb
|
190
193
|
- spec/spec_helper.rb
|
191
194
|
- spec/support/capybara.rb
|
195
|
+
- spec/support/reset_assets_cache.rb
|
196
|
+
- spec/support/reset_default_options.rb
|
192
197
|
- test_app/.gitignore
|
193
198
|
- test_app/Rakefile
|
194
199
|
- test_app/app/assets/images/rails.png
|
@@ -250,6 +255,9 @@ summary: Rails bindings for opal JS engine
|
|
250
255
|
test_files:
|
251
256
|
- spec/integration/assigns_spec.rb
|
252
257
|
- spec/integration/in_browser_specs_spec.rb
|
258
|
+
- spec/opal/default_options_spec.rb
|
253
259
|
- spec/opal/processor_spec.rb
|
254
260
|
- spec/spec_helper.rb
|
255
261
|
- spec/support/capybara.rb
|
262
|
+
- spec/support/reset_assets_cache.rb
|
263
|
+
- spec/support/reset_default_options.rb
|