opal-rails 0.5.2 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -2
- data/app/views/layouts/opal_spec.html.erb +1 -1
- data/lib/assets/javascripts/{opal-spec-runner.js.rb → opal-rspec-runner.js.rb} +2 -2
- data/lib/opal/rails/engine.rb +6 -4
- data/lib/opal/rails/haml_filter.rb +4 -4
- data/lib/opal/rails/template_handler.rb +1 -1
- data/lib/opal/rails/version.rb +1 -1
- data/lib/opal/rails.rb +1 -1
- data/lib/tasks/opal-rails_tasks.rake +2 -2
- data/opal-rails.gemspec +5 -5
- data/spec/integration/source_map_spec.rb +13 -8
- data/test_app/config/application.rb +3 -0
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac0ced6ff2b710322ffff46ae1da74a727f29305
|
4
|
+
data.tar.gz: b1ac2f475561f7188b78f8e4db208df8062dc43b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 354fe4c691ed9c6d49b83b439e91fd00b749cf5d6ae234757bfc19cf953a080fe8775405160e8a73755840829256a6cda4419cc7cadad1f6cba489fd9b1b0de6
|
7
|
+
data.tar.gz: 73ca176afd17d8e9f6b9a80dd1c13d3e68a24437774c90f3f431da887feaaef6bea313d8417bb9cf35d0466cb06e7f0e5a69d7c68a27ad0ee8e13e30e5129e35
|
data/Gemfile
CHANGED
@@ -4,9 +4,10 @@ gemspec
|
|
4
4
|
gem 'capybara-webkit' unless ENV['CI']
|
5
5
|
# gem 'opal', :github => 'opal/opal'
|
6
6
|
# gem 'opal-jquery', :github => 'opal/opal-jquery'
|
7
|
-
# gem 'opal-
|
7
|
+
# gem 'opal-rspec', :github => 'opal/opal-rspec'
|
8
8
|
|
9
|
-
|
9
|
+
platform :ruby_18 do
|
10
10
|
gem 'nokogiri', '< 1.6'
|
11
11
|
gem 'rails', '< 4.0'
|
12
|
+
gem 'rubyzip', '< 1'
|
12
13
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
5
|
<title>Opal Spec Runner</title>
|
6
|
-
<%= javascript_include_tag 'opal-
|
6
|
+
<%= javascript_include_tag 'opal-rspec-runner' %>
|
7
7
|
<%= javascript_include_tag *spec_files.map { |f| "spec/#{f}"} %>
|
8
8
|
<style>
|
9
9
|
body { font-family: sans-serif; }
|
data/lib/opal/rails/engine.rb
CHANGED
@@ -27,16 +27,18 @@ module Opal
|
|
27
27
|
config.after_initialize do |app|
|
28
28
|
require 'opal/rails/haml_filter' if defined?(Haml)
|
29
29
|
|
30
|
+
config = app.config
|
30
31
|
config.opal.each_pair do |key, value|
|
31
32
|
key = "#{key}="
|
32
33
|
Opal::Processor.send(key, value) if Opal::Processor.respond_to? key
|
33
34
|
end
|
34
35
|
|
35
|
-
config = app.config
|
36
|
-
maps_app = Opal::SourceMapServer.new(app.assets)
|
37
|
-
|
38
36
|
app.routes.prepend do
|
39
|
-
|
37
|
+
if config.opal.source_map_enabled
|
38
|
+
maps_app = Opal::SourceMapServer.new(app.assets)
|
39
|
+
mount maps_app => maps_app.prefix
|
40
|
+
end
|
41
|
+
|
40
42
|
get '/opal_spec' => 'opal_spec#run'
|
41
43
|
end
|
42
44
|
end
|
@@ -2,17 +2,17 @@ module Haml::Filters::Opal
|
|
2
2
|
include Haml::Filters::Base
|
3
3
|
|
4
4
|
def render_with_options ruby, options
|
5
|
-
text = ::Opal.
|
6
|
-
|
5
|
+
text = ::Opal.compile(ruby)
|
6
|
+
|
7
7
|
if options[:format] == :html5
|
8
8
|
type = ''
|
9
9
|
else
|
10
10
|
type = " type=#{options[:attr_wrapper]}text/javascript#{options[:attr_wrapper]}"
|
11
11
|
end
|
12
|
-
|
12
|
+
|
13
13
|
text.rstrip!
|
14
14
|
text.gsub!("\n", "\n ")
|
15
|
-
|
15
|
+
|
16
16
|
<<HTML
|
17
17
|
<script#{type}>
|
18
18
|
//<![CDATA[
|
@@ -10,7 +10,7 @@ module Opal
|
|
10
10
|
def call(template)
|
11
11
|
escaped = template.source.gsub(':', '\:')
|
12
12
|
string = '%q:' + escaped + ':'
|
13
|
-
"Opal.
|
13
|
+
"Opal.compile('Object.new.instance_eval {' << #{assigns} << #{local_assigns} << #{string} << '}')"
|
14
14
|
end
|
15
15
|
|
16
16
|
private
|
data/lib/opal/rails/version.rb
CHANGED
data/lib/opal/rails.rb
CHANGED
@@ -4,7 +4,7 @@ Opal::Spec::RakeTask.new('opal:spec' => :environment) do |server|
|
|
4
4
|
require 'tempfile'
|
5
5
|
|
6
6
|
asset_paths = Opal.paths + Rails.configuration.assets.paths.to_a
|
7
|
-
tempfile = Tempfile.new(['opal-
|
7
|
+
tempfile = Tempfile.new(['opal-rspec', '.js.rb'])
|
8
8
|
|
9
9
|
server.sprockets.clear_paths
|
10
10
|
asset_paths << File.dirname(tempfile.path)
|
@@ -13,7 +13,7 @@ Opal::Spec::RakeTask.new('opal:spec' => :environment) do |server|
|
|
13
13
|
asset_paths.each { |path| server.append_path path }
|
14
14
|
|
15
15
|
required_assets = ['opal']
|
16
|
-
required_assets << 'opal-
|
16
|
+
required_assets << 'opal-rspec-runner'
|
17
17
|
|
18
18
|
asset_paths.each do |path|
|
19
19
|
Dir["#{path}/spec/**_spec.js.{opal,rb}"].each do |spec|
|
data/opal-rails.gemspec
CHANGED
@@ -19,13 +19,13 @@ 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.
|
23
|
-
s.add_runtime_dependency 'opal-sprockets', '~> 0.
|
22
|
+
s.add_runtime_dependency 'opal', '~> 0.5.0'
|
23
|
+
s.add_runtime_dependency 'opal-sprockets', '~> 0.3.0'
|
24
24
|
|
25
25
|
s.add_runtime_dependency 'rails', '>= 3.2.13', '< 5.0'
|
26
|
-
s.add_runtime_dependency 'opal-jquery', '>= 0.0
|
27
|
-
s.add_runtime_dependency 'opal-
|
28
|
-
s.add_runtime_dependency 'opal-activesupport'
|
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
29
|
s.add_runtime_dependency 'jquery-rails'
|
30
30
|
|
31
31
|
s.add_development_dependency 'rspec', '~> 2.13'
|
@@ -2,17 +2,23 @@ require 'spec_helper'
|
|
2
2
|
require 'opal/source_map'
|
3
3
|
|
4
4
|
describe Opal::SourceMap do
|
5
|
-
before
|
5
|
+
before do
|
6
|
+
expect(Rails.application.config.opal.source_map_enabled).to be_true
|
7
|
+
get '/assets/source_map_example.js'
|
8
|
+
end
|
9
|
+
|
10
|
+
let(:map_url) { extract_map_url(response) }
|
6
11
|
|
7
12
|
let(:map_body) do
|
8
|
-
get
|
13
|
+
get map_url
|
14
|
+
raise "#{response.status}\n\n#{response.body}" unless response.success?
|
9
15
|
response.body
|
10
16
|
end
|
11
17
|
|
12
18
|
let(:map) { JSON.parse(map_body) }
|
13
19
|
|
14
|
-
it 'has the source map header' do
|
15
|
-
expect(response
|
20
|
+
it 'has the source map header or magic comment' do
|
21
|
+
expect(extract_map_url(response)).to be_present
|
16
22
|
end
|
17
23
|
|
18
24
|
it "the map is a valid json" do
|
@@ -21,10 +27,9 @@ describe Opal::SourceMap do
|
|
21
27
|
end
|
22
28
|
end
|
23
29
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
expect(pathname.exist?).to be_true
|
30
|
+
def extract_map_url response
|
31
|
+
response.headers['X-SourceMap'] or
|
32
|
+
response.body.scan(%r{^//@ sourceMappingURL=([^\n]+)}).flatten.first.strip
|
28
33
|
end
|
29
34
|
|
30
35
|
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.6.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-11-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.5.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: opal-sprockets
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.3.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.3.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -64,42 +64,42 @@ dependencies:
|
|
64
64
|
requirements:
|
65
65
|
- - '>='
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.0
|
67
|
+
version: 0.1.0
|
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.0
|
74
|
+
version: 0.1.0
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
|
-
name: opal-
|
76
|
+
name: opal-rspec
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- -
|
79
|
+
- - '>='
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0
|
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
|
-
version: 0
|
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
|
-
version:
|
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
|
-
version:
|
102
|
+
version: 0.0.5
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: jquery-rails
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -201,7 +201,7 @@ files:
|
|
201
201
|
- app/controllers/opal_spec_controller.rb
|
202
202
|
- app/views/layouts/opal_spec.html.erb
|
203
203
|
- app/views/opal_spec/run.html.erb
|
204
|
-
- lib/assets/javascripts/opal-
|
204
|
+
- lib/assets/javascripts/opal-rspec-runner.js.rb
|
205
205
|
- lib/assets/javascripts/opal_ujs.js.rb
|
206
206
|
- lib/opal-rails.rb
|
207
207
|
- lib/opal/rails.rb
|
@@ -275,7 +275,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
275
275
|
version: '0'
|
276
276
|
requirements: []
|
277
277
|
rubyforge_project: opal-rails
|
278
|
-
rubygems_version: 2.
|
278
|
+
rubygems_version: 2.1.2
|
279
279
|
signing_key:
|
280
280
|
specification_version: 4
|
281
281
|
summary: Rails bindings for opal JS engine
|