opal-rails 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8fed15fdb17a5c9efd8ebd4797a10db2da7dfe2a
4
- data.tar.gz: 4e0a78c92215cd5ba1519afdbd717b4ad4ae05ea
3
+ metadata.gz: e0661ea0ba30536cdab789f56ae7d2d408c48708
4
+ data.tar.gz: 3bd276dfe1b426bed1810b66d1d7993f85243a1d
5
5
  SHA512:
6
- metadata.gz: 9eb90df0d27ac7759526c989fed3f4a84ff7e1f6d0ddd10a83dc3342c025b7f3657b08829a5b280ab95bd539cf09359343f518062158361a0cb387bd2175b51a
7
- data.tar.gz: 35442c84f4a451546c8c3cfbad235f10713567965bd1a11a6553caee2f3b8c52c5a89e4e51614da9e996699762afa2671fcef06143fd50a185e491f5b29e697f
6
+ metadata.gz: 9cc46ffcde2aadc54905318e3ce4a4971074bed6f1f09d93485e8c41a9904fee236baaea18dcc536601a1b8d1849bb67cec2297a2a5f890c3bfca3130d6f17a7
7
+ data.tar.gz: 4faa926734875dc91bc1ead1cfc53d992ff1c7e5c83784cd9d0bbcd1157a71f1cd61f3107f682df315d7c8927f8e0ca0320b0e67a839c82fc1fe5864186be247
data/.travis.yml CHANGED
@@ -1,9 +1,11 @@
1
1
  language: ruby
2
+ cache: bundler
2
3
 
3
4
  rvm:
4
5
  - 1.8.7
5
6
  - 1.9.3
6
7
  - 2.0.0
8
+ - 2.1.1
7
9
 
8
10
  before_script:
9
11
  - "export DISPLAY=:99.0"
@@ -11,3 +13,4 @@ before_script:
11
13
 
12
14
  notifications:
13
15
  irc: "irc.freenode.org#opal"
16
+
data/Gemfile CHANGED
@@ -1,13 +1,19 @@
1
1
  source 'https://rubygems.org'
2
2
  gemspec
3
3
 
4
- gem 'capybara-webkit' unless ENV['CI']
4
+ gem 'capybara-webkit'
5
+ gem 'capybara', '< 2'
6
+
5
7
  # gem 'opal', :github => 'opal/opal'
6
- # gem 'opal-jquery', :github => 'opal/opal-jquery'
7
- # gem 'opal-rspec', :github => 'opal/opal-rspec'
8
+ gem 'opal-jquery', :github => 'opal/opal-jquery'
9
+
10
+ # gem 'opal', :path => '~/Code/opal'
11
+ # gem 'opal-jquery', :path => '~/Code/opal-jquery'
12
+ # gem 'opal-rspec', :path => '~/Code/opal-rspec'
13
+ # gem 'opal-browser', :path => '~/Code/opal-browser'
8
14
 
9
- platform :ruby_18 do
15
+ if RUBY_VERSION.to_f < 1.9
10
16
  gem 'nokogiri', '< 1.6'
11
- gem 'rails', '< 4.0'
12
- gem 'rubyzip', '< 1'
17
+ gem 'rails', '< 4.0'
18
+ gem 'rubyzip', '< 1'
13
19
  end
data/README.md CHANGED
@@ -95,7 +95,7 @@ end
95
95
  Each assign is filtered through JSON so it's reduced to basic types:
96
96
 
97
97
  ```ruby
98
- # app/views/posts/cerate.js.opal
98
+ # app/views/posts/create.js.opal
99
99
 
100
100
  post = Element.find('.post')
101
101
  post.find('.title').html = @post[:title]
@@ -104,7 +104,7 @@ post.find('.comments').html = comments_html
104
104
  ```
105
105
 
106
106
 
107
- ### As an Haml filter (optional)
107
+ ### As a Haml filter (optional)
108
108
 
109
109
  Of course you need to require `haml-rails` separately since its presence is not assumed
110
110
 
@@ -21,11 +21,11 @@ class OpalSpecController < ActionController::Base
21
21
  end
22
22
 
23
23
  def all_spec_files
24
- spec_files_for_glob '**'
24
+ spec_files_for_glob '**/*_spec{.js,}'
25
25
  end
26
26
 
27
27
  def spec_files_for_glob glob = '**'
28
- Dir[Rails.root.join("{app,lib}/assets/javascripts/spec/#{glob}{,_spec{.js,}.{rb,opal}}")].map do |path|
28
+ Dir[Rails.root.join("{app,lib}/assets/javascripts/spec/#{glob}.{rb,opal}")].map do |path|
29
29
  path.split('assets/javascripts/spec/').flatten.last.gsub(/(\.rb|\.opal)/, '')
30
30
  end.uniq
31
31
  end
@@ -0,0 +1,7 @@
1
+ module OpalHelper
2
+ def opal_tag(&block)
3
+ opal_code = capture(&block)
4
+ js_code = Opal.compile(opal_code)
5
+ javascript_tag js_code
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Rails
3
- VERSION = '0.6.2'
3
+ VERSION = '0.6.3'
4
4
  end
5
5
  end
data/opal-rails.gemspec CHANGED
@@ -19,19 +19,17 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ['lib']
21
21
 
22
- s.add_runtime_dependency 'opal', '~> 0.5.0'
23
- s.add_runtime_dependency 'opal-sprockets', '~> 0.3.0'
22
+ s.add_dependency 'rails', '>= 3.2.13', '< 5.0'
23
+ s.add_dependency 'opal', '~> 0.6.0'
24
+ s.add_dependency 'opal-jquery', '>= 0.1.0'
25
+ s.add_dependency 'opal-rspec', '~> 0.3.0.beta1'
26
+ s.add_dependency 'jquery-rails'
27
+ s.add_dependency 'opal-activesupport', '>= 0.0.5'
24
28
 
25
- s.add_runtime_dependency 'rails', '>= 3.2.13', '< 5.0'
26
- s.add_runtime_dependency 'opal-jquery', '>= 0.1.0'
27
- s.add_runtime_dependency 'opal-rspec'
28
- s.add_runtime_dependency 'opal-activesupport', '>= 0.0.5'
29
- s.add_runtime_dependency 'jquery-rails'
29
+ s.add_development_dependency 'execjs'
30
+ s.add_development_dependency 'launchy'
31
+ s.add_development_dependency 'capybara'
30
32
 
31
33
  s.add_development_dependency 'rspec', '~> 2.13'
32
34
  s.add_development_dependency 'rspec-rails', '~> 2.13'
33
-
34
- s.add_development_dependency 'capybara', '< 2'
35
- s.add_development_dependency 'launchy'
36
- s.add_development_dependency 'execjs'
37
35
  end
@@ -27,6 +27,11 @@ describe 'controller assignments' do
27
27
 
28
28
  def opal_eval source
29
29
  opal_source = get_source_of '/assets/opal.js'
30
+
31
+ # Any lib should be already required in the page,
32
+ # require won't work in this kind of templates.
33
+ opal_source << get_source_of('/assets/native.js')
34
+
30
35
  context = ExecJS.compile opal_source
31
36
  context.eval source
32
37
  rescue
@@ -1,9 +1,19 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'In-browser specs runner' do
4
- it 'runs all specs', :js do
3
+ feature 'In-browser specs runner', :type => :request do
4
+ scenario 'runs all specs', :js do
5
5
  visit '/opal_spec'
6
- page.should have_content('Running: example_spec')
6
+
7
+ page.should have_content('subdirectory/other_spec.js')
8
+ page.should have_content('example_spec.js ')
9
+ page.should have_content('2 examples, 0 failures')
10
+ end
11
+
12
+ scenario "runs single spec file", :js do
13
+ visit '/opal_spec'
14
+ click_link 'subdirectory/other_spec.js'
15
+
16
+ page.should have_content('Running: subdirectory/other_spec.js')
7
17
  page.should have_content('1 examples, 0 failures')
8
18
  end
9
19
  end
@@ -29,7 +29,7 @@ describe Opal::SourceMap do
29
29
 
30
30
  def extract_map_url response
31
31
  response.headers['X-SourceMap'] or
32
- response.body.scan(%r{^//@ sourceMappingURL=([^\n]+)}).flatten.first.strip
32
+ response.body.scan(%r{^//[@#] sourceMappingURL=([^\n]+)}).flatten.first.to_s.strip
33
33
  end
34
34
 
35
35
  end
@@ -1,6 +1,4 @@
1
1
  require 'capybara/rspec'
2
2
 
3
- if RUBY_VERSION.to_f > 1.8 and not(ENV['CI'])
4
- require 'capybara-webkit'
5
- Capybara.javascript_driver = :webkit
6
- end
3
+ require 'capybara-webkit'
4
+ Capybara.javascript_driver = :webkit
@@ -0,0 +1,5 @@
1
+ describe "spec inside subdirectory" do
2
+ it "runs fine" do
3
+ 1.should == 1
4
+ end
5
+ end
@@ -5,3 +5,4 @@
5
5
  # Make sure the secret is at least 30 characters and all random,
6
6
  # no regular words or you'll be exposed to dictionary attacks.
7
7
  TestApp::Application.config.secret_token = '1e152bba0be759b82e7a970ad728b5a4946b793c042fed97b1900a9c6c752e789e5021af04066147fbcd5846718eb4a29740f33125fad2107b65a59a0af17b08'
8
+ TestApp::Application.config.secret_key_base = TestApp::Application.config.secret_token if TestApp::Application.config.respond_to? :secret_key_base=
metadata CHANGED
@@ -1,189 +1,175 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opal-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
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-12-13 00:00:00.000000000 Z
11
+ date: 2014-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: opal
14
+ name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.13
20
+ - - "<"
18
21
  - !ruby/object:Gem::Version
19
- version: 0.5.0
22
+ version: '5.0'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
- - - ~>
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.13
30
+ - - "<"
25
31
  - !ruby/object:Gem::Version
26
- version: 0.5.0
32
+ version: '5.0'
27
33
  - !ruby/object:Gem::Dependency
28
- name: opal-sprockets
34
+ name: opal
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
- - - ~>
37
+ - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: 0.3.0
39
+ version: 0.6.0
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
- - - ~>
44
+ - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: 0.3.0
46
+ version: 0.6.0
41
47
  - !ruby/object:Gem::Dependency
42
- name: rails
48
+ name: opal-jquery
43
49
  requirement: !ruby/object:Gem::Requirement
44
50
  requirements:
45
- - - '>='
46
- - !ruby/object:Gem::Version
47
- version: 3.2.13
48
- - - <
51
+ - - ">="
49
52
  - !ruby/object:Gem::Version
50
- version: '5.0'
53
+ version: 0.1.0
51
54
  type: :runtime
52
55
  prerelease: false
53
56
  version_requirements: !ruby/object:Gem::Requirement
54
57
  requirements:
55
- - - '>='
58
+ - - ">="
56
59
  - !ruby/object:Gem::Version
57
- version: 3.2.13
58
- - - <
59
- - !ruby/object:Gem::Version
60
- version: '5.0'
60
+ version: 0.1.0
61
61
  - !ruby/object:Gem::Dependency
62
- name: opal-jquery
62
+ name: opal-rspec
63
63
  requirement: !ruby/object:Gem::Requirement
64
64
  requirements:
65
- - - '>='
65
+ - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: 0.1.0
67
+ version: 0.3.0.beta1
68
68
  type: :runtime
69
69
  prerelease: false
70
70
  version_requirements: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - '>='
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: 0.1.0
74
+ version: 0.3.0.beta1
75
75
  - !ruby/object:Gem::Dependency
76
- name: opal-rspec
76
+ name: jquery-rails
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - '>='
79
+ - - ">="
80
80
  - !ruby/object:Gem::Version
81
81
  version: '0'
82
82
  type: :runtime
83
83
  prerelease: false
84
84
  version_requirements: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - '>='
86
+ - - ">="
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0'
89
89
  - !ruby/object:Gem::Dependency
90
90
  name: opal-activesupport
91
91
  requirement: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - '>='
93
+ - - ">="
94
94
  - !ruby/object:Gem::Version
95
95
  version: 0.0.5
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
- - - '>='
100
+ - - ">="
101
101
  - !ruby/object:Gem::Version
102
102
  version: 0.0.5
103
103
  - !ruby/object:Gem::Dependency
104
- name: jquery-rails
104
+ name: execjs
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - '>='
107
+ - - ">="
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
- type: :runtime
111
- prerelease: false
112
- version_requirements: !ruby/object:Gem::Requirement
113
- requirements:
114
- - - '>='
115
- - !ruby/object:Gem::Version
116
- version: '0'
117
- - !ruby/object:Gem::Dependency
118
- name: rspec
119
- requirement: !ruby/object:Gem::Requirement
120
- requirements:
121
- - - ~>
122
- - !ruby/object:Gem::Version
123
- version: '2.13'
124
110
  type: :development
125
111
  prerelease: false
126
112
  version_requirements: !ruby/object:Gem::Requirement
127
113
  requirements:
128
- - - ~>
114
+ - - ">="
129
115
  - !ruby/object:Gem::Version
130
- version: '2.13'
116
+ version: '0'
131
117
  - !ruby/object:Gem::Dependency
132
- name: rspec-rails
118
+ name: launchy
133
119
  requirement: !ruby/object:Gem::Requirement
134
120
  requirements:
135
- - - ~>
121
+ - - ">="
136
122
  - !ruby/object:Gem::Version
137
- version: '2.13'
123
+ version: '0'
138
124
  type: :development
139
125
  prerelease: false
140
126
  version_requirements: !ruby/object:Gem::Requirement
141
127
  requirements:
142
- - - ~>
128
+ - - ">="
143
129
  - !ruby/object:Gem::Version
144
- version: '2.13'
130
+ version: '0'
145
131
  - !ruby/object:Gem::Dependency
146
132
  name: capybara
147
133
  requirement: !ruby/object:Gem::Requirement
148
134
  requirements:
149
- - - <
135
+ - - ">="
150
136
  - !ruby/object:Gem::Version
151
- version: '2'
137
+ version: '0'
152
138
  type: :development
153
139
  prerelease: false
154
140
  version_requirements: !ruby/object:Gem::Requirement
155
141
  requirements:
156
- - - <
142
+ - - ">="
157
143
  - !ruby/object:Gem::Version
158
- version: '2'
144
+ version: '0'
159
145
  - !ruby/object:Gem::Dependency
160
- name: launchy
146
+ name: rspec
161
147
  requirement: !ruby/object:Gem::Requirement
162
148
  requirements:
163
- - - '>='
149
+ - - "~>"
164
150
  - !ruby/object:Gem::Version
165
- version: '0'
151
+ version: '2.13'
166
152
  type: :development
167
153
  prerelease: false
168
154
  version_requirements: !ruby/object:Gem::Requirement
169
155
  requirements:
170
- - - '>='
156
+ - - "~>"
171
157
  - !ruby/object:Gem::Version
172
- version: '0'
158
+ version: '2.13'
173
159
  - !ruby/object:Gem::Dependency
174
- name: execjs
160
+ name: rspec-rails
175
161
  requirement: !ruby/object:Gem::Requirement
176
162
  requirements:
177
- - - '>='
163
+ - - "~>"
178
164
  - !ruby/object:Gem::Version
179
- version: '0'
165
+ version: '2.13'
180
166
  type: :development
181
167
  prerelease: false
182
168
  version_requirements: !ruby/object:Gem::Requirement
183
169
  requirements:
184
- - - '>='
170
+ - - "~>"
185
171
  - !ruby/object:Gem::Version
186
- version: '0'
172
+ version: '2.13'
187
173
  description: Rails bindings for opal JS engine
188
174
  email:
189
175
  - elia@schito.me
@@ -191,14 +177,15 @@ executables: []
191
177
  extensions: []
192
178
  extra_rdoc_files: []
193
179
  files:
194
- - .gitignore
195
- - .rspec
196
- - .travis.yml
180
+ - ".gitignore"
181
+ - ".rspec"
182
+ - ".travis.yml"
197
183
  - CHANGELOG.md
198
184
  - Gemfile
199
185
  - README.md
200
186
  - Rakefile
201
187
  - app/controllers/opal_spec_controller.rb
188
+ - app/helpers/opal_helper.rb
202
189
  - app/views/layouts/opal_spec.html.erb
203
190
  - app/views/opal_spec/run.html.erb
204
191
  - lib/assets/javascripts/opal-rspec-runner.js.rb
@@ -227,6 +214,7 @@ files:
227
214
  - test_app/app/assets/javascripts/source_map_example.js.rb
228
215
  - test_app/app/assets/javascripts/spec.js
229
216
  - test_app/app/assets/javascripts/spec/example_spec.js.rb
217
+ - test_app/app/assets/javascripts/spec/subdirectory/other_spec.js.rb
230
218
  - test_app/app/assets/stylesheets/application.css
231
219
  - test_app/app/controllers/application_controller.rb
232
220
  - test_app/app/views/application/index.html.erb
@@ -266,17 +254,17 @@ require_paths:
266
254
  - lib
267
255
  required_ruby_version: !ruby/object:Gem::Requirement
268
256
  requirements:
269
- - - '>='
257
+ - - ">="
270
258
  - !ruby/object:Gem::Version
271
259
  version: '0'
272
260
  required_rubygems_version: !ruby/object:Gem::Requirement
273
261
  requirements:
274
- - - '>='
262
+ - - ">="
275
263
  - !ruby/object:Gem::Version
276
264
  version: '0'
277
265
  requirements: []
278
266
  rubyforge_project: opal-rails
279
- rubygems_version: 2.1.11
267
+ rubygems_version: 2.2.2
280
268
  signing_key:
281
269
  specification_version: 4
282
270
  summary: Rails bindings for opal JS engine