opal-rails 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/build.yml +38 -0
- data/.gitignore +1 -0
- data/Appraisals +10 -14
- data/CHANGELOG.md +62 -0
- data/Gemfile +7 -4
- data/README.md +45 -9
- data/app/helpers/opal_helper.rb +6 -5
- data/bin/rackup +29 -0
- data/bin/rails +8 -0
- data/bin/rails-engine +13 -0
- data/bin/rails-sandbox +18 -0
- data/bin/rake +29 -0
- data/bin/rspec +29 -0
- data/bin/sandbox +39 -0
- data/bin/sandbox-setup +14 -0
- data/bin/setup +8 -0
- data/gemfiles/rails_6_0_opal_1_0.gemfile +9 -0
- data/gemfiles/rails_6_0_opal_1_1.gemfile +9 -0
- data/gemfiles/rails_6_1_opal_1_0.gemfile +9 -0
- data/gemfiles/rails_6_1_opal_1_1.gemfile +9 -0
- data/lib/assets/javascripts/opal_ujs.js.rb +1 -4
- data/lib/generators/opal/assets/assets_generator.rb +7 -0
- data/lib/{rails/generators → generators}/opal/assets/templates/javascript.js.rb +0 -0
- data/lib/generators/opal/install/USAGE +8 -0
- data/lib/generators/opal/install/install_generator.rb +12 -0
- data/lib/generators/opal/install/templates/application.js.rb +12 -0
- data/lib/opal/rails.rb +0 -4
- data/lib/opal/rails/engine.rb +9 -2
- data/lib/opal/rails/template_handler.rb +16 -7
- data/lib/opal/rails/version.rb +1 -1
- data/opal-rails.gemspec +45 -40
- data/spec/helpers/opal_helper_spec.rb +23 -9
- data/spec/integration/assigns_spec.rb +58 -2
- data/spec/integration/source_map_spec.rb +9 -5
- data/spec/support/capybara.rb +2 -0
- data/test_apps/{application_controller.rb → app/application_controller.rb} +1 -1
- data/test_apps/app/assets/config/manifest.js +1 -0
- data/test_apps/{assets → app/assets}/javascripts/application.js.rb +1 -0
- data/test_apps/{assets → app/assets}/javascripts/bar.rb +0 -0
- data/test_apps/{assets → app/assets}/javascripts/foo.js.rb +0 -0
- data/test_apps/{assets → app/assets}/javascripts/source_map_example.js.rb +0 -0
- data/test_apps/{assets → app/assets}/javascripts/with_assignments.js.rb +0 -0
- data/test_apps/{rails5.rb → rails6.rb} +1 -3
- metadata +49 -84
- data/.travis.yml +0 -42
- data/gemfiles/rails_5_1_opal_1_0.gemfile +0 -12
- data/gemfiles/rails_5_1_opal_master.gemfile +0 -11
- data/gemfiles/rails_5_2_opal_1_0.gemfile +0 -12
- data/gemfiles/rails_5_2_opal_master.gemfile +0 -11
- data/lib/rails/generators/opal/assets/assets_generator.rb +0 -12
- data/spec/integration/template_spec.rb +0 -9
- data/test_apps/rails4.rb +0 -47
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
require 'opal/source_map'
|
4
4
|
|
5
5
|
describe Opal::SourceMap do
|
6
|
-
let(:js_asset_path) { '/assets/source_map_example.
|
6
|
+
let(:js_asset_path) { '/assets/source_map_example.debug.js' }
|
7
7
|
|
8
8
|
before do
|
9
9
|
expect(Rails.application.config.opal.source_map_enabled).to be_truthy
|
@@ -21,13 +21,16 @@ describe Opal::SourceMap do
|
|
21
21
|
Base64.decode64(response.body.lines.last.split(inline_map_prefix, 2)[1])
|
22
22
|
else
|
23
23
|
source_map_regexp = %r{^//[@#] sourceMappingURL=([^\n]+)}
|
24
|
+
|
24
25
|
header_map_path = response.headers['X-SourceMap'].presence
|
25
26
|
comment_map_path = response.body.scan(source_map_regexp).flatten.first.to_s.strip.presence
|
26
27
|
|
27
|
-
map_path = header_map_path || comment_map_path
|
28
|
+
map_path = (header_map_path || comment_map_path)&.strip
|
29
|
+
|
30
|
+
get URI.join("http://example.com/", js_asset_path, map_path).path
|
28
31
|
|
29
|
-
get map_path
|
30
32
|
expect(response).to be_successful, "url: #{map_path}\nstatus: #{response.status}"
|
33
|
+
|
31
34
|
response.body
|
32
35
|
end
|
33
36
|
end
|
@@ -36,7 +39,8 @@ describe Opal::SourceMap do
|
|
36
39
|
|
37
40
|
it 'has the source map be there' do
|
38
41
|
expect(map).to be_present
|
39
|
-
expect(map[:
|
40
|
-
expect(map[:
|
42
|
+
expect(map[:sections].size).to eq(1)
|
43
|
+
expect(map[:sections][0][:map][:sources]).to be_present
|
44
|
+
expect(map[:sections][0][:map][:mappings]).to be_present
|
41
45
|
end
|
42
46
|
end
|
data/spec/support/capybara.rb
CHANGED
@@ -8,6 +8,8 @@ Capybara.register_server :puma do |app, port, host|
|
|
8
8
|
Rack::Handler::Puma.run(app, Host: host, Port: port, Threads: "0:4", Silent: true)
|
9
9
|
end
|
10
10
|
|
11
|
+
Capybara.default_max_wait_time = 5
|
12
|
+
|
11
13
|
module OpalHelper
|
12
14
|
def compile_opal(code)
|
13
15
|
Opal.compile(code, requireable: false)
|
@@ -14,7 +14,7 @@ HTML
|
|
14
14
|
|
15
15
|
WITH_ASSIGNMENTS = File.read "#{__dir__}/assets/javascripts/with_assignments.js.rb"
|
16
16
|
|
17
|
-
require_relative '
|
17
|
+
require_relative '../../app/helpers/opal_helper'
|
18
18
|
|
19
19
|
class ApplicationController < ActionController::Base
|
20
20
|
include Rails.application.routes.url_helpers
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../javascripts .js
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -1,6 +1,5 @@
|
|
1
1
|
# FROM: http://www.rubytutorial.io/how-to-test-your-gem-against-multiple-rails/
|
2
2
|
|
3
|
-
# test/apps/rails5.rb
|
4
3
|
require 'rails'
|
5
4
|
require 'rails/all'
|
6
5
|
require 'action_view/testing/resolvers'
|
@@ -37,7 +36,6 @@ module RailsApp
|
|
37
36
|
get '/favicon.ico' => -> { [404,{},[]] }
|
38
37
|
end
|
39
38
|
|
40
|
-
config.assets.paths << File.join(__dir__, 'assets/javascripts')
|
41
39
|
config.assets.debug = true
|
42
40
|
config.assets.digest = true
|
43
41
|
|
@@ -46,5 +44,5 @@ module RailsApp
|
|
46
44
|
end
|
47
45
|
end
|
48
46
|
|
49
|
-
require_relative './application_controller'
|
47
|
+
require_relative './app/application_controller'
|
50
48
|
RailsApp::Application.initialize!
|
metadata
CHANGED
@@ -1,125 +1,77 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elia Schito
|
8
|
-
autorequire:
|
9
|
-
bindir:
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '5.1'
|
20
|
-
- - "<"
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version: '6.0'
|
23
|
-
type: :runtime
|
24
|
-
prerelease: false
|
25
|
-
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '5.1'
|
30
|
-
- - "<"
|
31
18
|
- !ruby/object:Gem::Version
|
32
19
|
version: '6.0'
|
33
|
-
- !ruby/object:Gem::Dependency
|
34
|
-
name: sprockets-rails
|
35
|
-
requirement: !ruby/object:Gem::Requirement
|
36
|
-
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 2.3.3
|
40
20
|
- - "<"
|
41
21
|
- !ruby/object:Gem::Version
|
42
|
-
version: '
|
22
|
+
version: '7'
|
43
23
|
type: :runtime
|
44
24
|
prerelease: false
|
45
25
|
version_requirements: !ruby/object:Gem::Requirement
|
46
26
|
requirements:
|
47
27
|
- - ">="
|
48
28
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
29
|
+
version: '6.0'
|
50
30
|
- - "<"
|
51
31
|
- !ruby/object:Gem::Version
|
52
|
-
version: '
|
32
|
+
version: '7'
|
53
33
|
- !ruby/object:Gem::Dependency
|
54
|
-
name:
|
34
|
+
name: sprockets-rails
|
55
35
|
requirement: !ruby/object:Gem::Requirement
|
56
36
|
requirements:
|
57
37
|
- - ">="
|
58
38
|
- !ruby/object:Gem::Version
|
59
|
-
version: '0'
|
39
|
+
version: '3.0'
|
60
40
|
type: :runtime
|
61
41
|
prerelease: false
|
62
42
|
version_requirements: !ruby/object:Gem::Requirement
|
63
43
|
requirements:
|
64
44
|
- - ">="
|
65
45
|
- !ruby/object:Gem::Version
|
66
|
-
version: '0'
|
46
|
+
version: '3.0'
|
67
47
|
- !ruby/object:Gem::Dependency
|
68
48
|
name: opal
|
69
49
|
requirement: !ruby/object:Gem::Requirement
|
70
50
|
requirements:
|
71
51
|
- - "~>"
|
72
52
|
- !ruby/object:Gem::Version
|
73
|
-
version: 1.0
|
74
|
-
type: :runtime
|
75
|
-
prerelease: false
|
76
|
-
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - "~>"
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: 1.0.0
|
81
|
-
- !ruby/object:Gem::Dependency
|
82
|
-
name: opal-jquery
|
83
|
-
requirement: !ruby/object:Gem::Requirement
|
84
|
-
requirements:
|
85
|
-
- - "~>"
|
86
|
-
- !ruby/object:Gem::Version
|
87
|
-
version: 0.4.4
|
53
|
+
version: '1.0'
|
88
54
|
type: :runtime
|
89
55
|
prerelease: false
|
90
56
|
version_requirements: !ruby/object:Gem::Requirement
|
91
57
|
requirements:
|
92
58
|
- - "~>"
|
93
59
|
- !ruby/object:Gem::Version
|
94
|
-
version: 0
|
60
|
+
version: '1.0'
|
95
61
|
- !ruby/object:Gem::Dependency
|
96
62
|
name: opal-sprockets
|
97
63
|
requirement: !ruby/object:Gem::Requirement
|
98
64
|
requirements:
|
99
65
|
- - "~>"
|
100
66
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0
|
67
|
+
version: '1.0'
|
102
68
|
type: :runtime
|
103
69
|
prerelease: false
|
104
70
|
version_requirements: !ruby/object:Gem::Requirement
|
105
71
|
requirements:
|
106
72
|
- - "~>"
|
107
73
|
- !ruby/object:Gem::Version
|
108
|
-
version: 0
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
name: opal-activesupport
|
111
|
-
requirement: !ruby/object:Gem::Requirement
|
112
|
-
requirements:
|
113
|
-
- - ">="
|
114
|
-
- !ruby/object:Gem::Version
|
115
|
-
version: 0.0.5
|
116
|
-
type: :runtime
|
117
|
-
prerelease: false
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - ">="
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: 0.0.5
|
74
|
+
version: '1.0'
|
123
75
|
- !ruby/object:Gem::Dependency
|
124
76
|
name: execjs
|
125
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -239,22 +191,36 @@ executables: []
|
|
239
191
|
extensions: []
|
240
192
|
extra_rdoc_files: []
|
241
193
|
files:
|
194
|
+
- ".github/workflows/build.yml"
|
242
195
|
- ".gitignore"
|
243
196
|
- ".powder"
|
244
197
|
- ".rspec"
|
245
|
-
- ".travis.yml"
|
246
198
|
- Appraisals
|
247
199
|
- CHANGELOG.md
|
248
200
|
- Gemfile
|
249
201
|
- README.md
|
250
202
|
- Rakefile
|
251
203
|
- app/helpers/opal_helper.rb
|
204
|
+
- bin/rackup
|
205
|
+
- bin/rails
|
206
|
+
- bin/rails-engine
|
207
|
+
- bin/rails-sandbox
|
208
|
+
- bin/rake
|
209
|
+
- bin/rspec
|
210
|
+
- bin/sandbox
|
211
|
+
- bin/sandbox-setup
|
212
|
+
- bin/setup
|
252
213
|
- config.ru
|
253
|
-
- gemfiles/
|
254
|
-
- gemfiles/
|
255
|
-
- gemfiles/
|
256
|
-
- gemfiles/
|
214
|
+
- gemfiles/rails_6_0_opal_1_0.gemfile
|
215
|
+
- gemfiles/rails_6_0_opal_1_1.gemfile
|
216
|
+
- gemfiles/rails_6_1_opal_1_0.gemfile
|
217
|
+
- gemfiles/rails_6_1_opal_1_1.gemfile
|
257
218
|
- lib/assets/javascripts/opal_ujs.js.rb
|
219
|
+
- lib/generators/opal/assets/assets_generator.rb
|
220
|
+
- lib/generators/opal/assets/templates/javascript.js.rb
|
221
|
+
- lib/generators/opal/install/USAGE
|
222
|
+
- lib/generators/opal/install/install_generator.rb
|
223
|
+
- lib/generators/opal/install/templates/application.js.rb
|
258
224
|
- lib/opal-rails.rb
|
259
225
|
- lib/opal/rails.rb
|
260
226
|
- lib/opal/rails/engine.rb
|
@@ -262,32 +228,32 @@ files:
|
|
262
228
|
- lib/opal/rails/slim_filter.rb
|
263
229
|
- lib/opal/rails/template_handler.rb
|
264
230
|
- lib/opal/rails/version.rb
|
265
|
-
- lib/rails/generators/opal/assets/assets_generator.rb
|
266
|
-
- lib/rails/generators/opal/assets/templates/javascript.js.rb
|
267
231
|
- opal-rails.gemspec
|
268
232
|
- spec/helpers/opal_helper_spec.rb
|
269
233
|
- spec/integration/assigns_spec.rb
|
270
234
|
- spec/integration/js_spec.rb
|
271
235
|
- spec/integration/source_map_spec.rb
|
272
|
-
- spec/integration/template_spec.rb
|
273
236
|
- spec/spec_helper.rb
|
274
237
|
- spec/support/capybara.rb
|
275
238
|
- spec/support/reset_assets_cache.rb
|
276
239
|
- spec/support/reset_config.rb
|
277
240
|
- spec/support/test_app.rb
|
278
|
-
- test_apps/application_controller.rb
|
279
|
-
- test_apps/assets/
|
280
|
-
- test_apps/assets/javascripts/
|
281
|
-
- test_apps/assets/javascripts/
|
282
|
-
- test_apps/assets/javascripts/
|
283
|
-
- test_apps/assets/javascripts/
|
284
|
-
- test_apps/
|
285
|
-
- test_apps/
|
241
|
+
- test_apps/app/application_controller.rb
|
242
|
+
- test_apps/app/assets/config/manifest.js
|
243
|
+
- test_apps/app/assets/javascripts/application.js.rb
|
244
|
+
- test_apps/app/assets/javascripts/bar.rb
|
245
|
+
- test_apps/app/assets/javascripts/foo.js.rb
|
246
|
+
- test_apps/app/assets/javascripts/source_map_example.js.rb
|
247
|
+
- test_apps/app/assets/javascripts/with_assignments.js.rb
|
248
|
+
- test_apps/rails6.rb
|
286
249
|
homepage: https://github.com/opal/opal-rails#readme
|
287
250
|
licenses:
|
288
251
|
- MIT-LICENSE
|
289
|
-
metadata:
|
290
|
-
|
252
|
+
metadata:
|
253
|
+
homepage_uri: https://github.com/opal/opal-rails#readme
|
254
|
+
source_code_uri: https://github.com/opal/opal-rails#readme
|
255
|
+
changelog_uri: https://github.com/opal/opal-rails/blob/master/CHANGELOG.md
|
256
|
+
post_install_message:
|
291
257
|
rdoc_options: []
|
292
258
|
require_paths:
|
293
259
|
- lib
|
@@ -295,15 +261,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
295
261
|
requirements:
|
296
262
|
- - ">="
|
297
263
|
- !ruby/object:Gem::Version
|
298
|
-
version: '
|
264
|
+
version: '2.5'
|
299
265
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
300
266
|
requirements:
|
301
267
|
- - ">="
|
302
268
|
- !ruby/object:Gem::Version
|
303
269
|
version: '0'
|
304
270
|
requirements: []
|
305
|
-
rubygems_version: 3.
|
306
|
-
signing_key:
|
271
|
+
rubygems_version: 3.2.3
|
272
|
+
signing_key:
|
307
273
|
specification_version: 4
|
308
274
|
summary: Rails bindings for opal JS engine
|
309
275
|
test_files:
|
@@ -311,7 +277,6 @@ test_files:
|
|
311
277
|
- spec/integration/assigns_spec.rb
|
312
278
|
- spec/integration/js_spec.rb
|
313
279
|
- spec/integration/source_map_spec.rb
|
314
|
-
- spec/integration/template_spec.rb
|
315
280
|
- spec/spec_helper.rb
|
316
281
|
- spec/support/capybara.rb
|
317
282
|
- spec/support/reset_assets_cache.rb
|
data/.travis.yml
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
|
3
|
-
sudo: required
|
4
|
-
addons:
|
5
|
-
chrome: stable
|
6
|
-
|
7
|
-
before_install:
|
8
|
-
- google-chrome-stable --headless --disable-gpu --remote-debugging-port=9222 about:blank &
|
9
|
-
|
10
|
-
cache:
|
11
|
-
bundler: true
|
12
|
-
|
13
|
-
matrix:
|
14
|
-
fast_finish: true
|
15
|
-
|
16
|
-
include:
|
17
|
-
- gemfile: gemfiles/rails_5_1_opal_master.gemfile
|
18
|
-
rvm: 2.5.5
|
19
|
-
- gemfile: gemfiles/rails_5_2_opal_master.gemfile
|
20
|
-
rvm: 2.6.3
|
21
|
-
|
22
|
-
- gemfile: gemfiles/rails_5_1_opal_1_0.gemfile
|
23
|
-
rvm: 2.5.5
|
24
|
-
- gemfile: gemfiles/rails_5_2_opal_1_0.gemfile
|
25
|
-
rvm: 2.6.3
|
26
|
-
|
27
|
-
allow_failures:
|
28
|
-
- gemfile: gemfiles/rails_5_1_opal_master.gemfile
|
29
|
-
rvm: 2.5.5
|
30
|
-
- gemfile: gemfiles/rails_5_2_opal_master.gemfile
|
31
|
-
rvm: 2.6.3
|
32
|
-
|
33
|
-
before_script: bundle install
|
34
|
-
script: "bundle exec rake"
|
35
|
-
|
36
|
-
addons:
|
37
|
-
apt:
|
38
|
-
sources:
|
39
|
-
- google-chrome
|
40
|
-
packages:
|
41
|
-
- google-chrome-stable
|
42
|
-
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "c_lexer"
|
6
|
-
gem "rails", "~> 5.1.0"
|
7
|
-
gem "opal", "~> 1.0.0"
|
8
|
-
gem "opal-rspec", git: "https://github.com/opal/opal-rspec.git", branch: :master
|
9
|
-
gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: :master
|
10
|
-
gem "opal-sprockets"
|
11
|
-
|
12
|
-
gemspec path: "../"
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "c_lexer"
|
6
|
-
gem "rails", "~> 5.1.0"
|
7
|
-
gem "opal", git: "https://github.com/opal/opal.git", branch: :master
|
8
|
-
gem "opal-rspec", git: "https://github.com/opal/opal-rspec.git", branch: :master
|
9
|
-
gem "opal-sprockets", git: "https://github.com/opal/opal-sprockets.git", branch: :master
|
10
|
-
|
11
|
-
gemspec path: "../"
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "c_lexer"
|
6
|
-
gem "rails", "~> 5.2.0"
|
7
|
-
gem "opal", "~> 1.0.0"
|
8
|
-
gem "opal-rspec", git: "https://github.com/opal/opal-rspec.git", branch: :master
|
9
|
-
gem "opal-jquery", git: "https://github.com/opal/opal-jquery.git", branch: :master
|
10
|
-
gem "opal-sprockets"
|
11
|
-
|
12
|
-
gemspec path: "../"
|
@@ -1,11 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "c_lexer"
|
6
|
-
gem "rails", "~> 5.2.0"
|
7
|
-
gem "opal", git: "https://github.com/opal/opal.git", branch: :master
|
8
|
-
gem "opal-rspec", git: "https://github.com/opal/opal-rspec.git", branch: :master
|
9
|
-
gem "opal-sprockets", git: "https://github.com/opal/opal-sprockets.git", branch: :master
|
10
|
-
|
11
|
-
gemspec path: "../"
|