opal-rails 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/Gemfile +3 -2
- data/lib/opal/rails/engine.rb +2 -0
- data/lib/opal/rails/version.rb +1 -1
- data/lib/opal/rails.rb +1 -1
- data/lib/tasks/opal-rails_tasks.rake +27 -4
- data/opal-rails.gemspec +5 -3
- data/spec/integration/source_map_spec.rb +30 -0
- data/test_app/app/assets/javascripts/source_map_example.js.rb +4 -0
- metadata +37 -8
- data/spec/opal/source_map_spec.rb +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b22d76807c1341981c89a5562ac3c878c09d391
|
4
|
+
data.tar.gz: 2b6cce5182f8b9db817e323ef200cdf612ce7e8d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 403229e9749a59d2ea8820f1d37a919fbad0fcfc432cd9154021d5140f1597457cd19fc4b50cf531375ed6c9ac9cd406c451996ef533dde6c9cc6ae9a0eda2f3
|
7
|
+
data.tar.gz: 211278574a80eb006da1bb5148e31caa9b6043db3b63f5eb62afcaef9506c522fce4f7a31a8c1990348ed3c52bc632eeeddf9f81f8b8571258c7a1ae53d28827
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
@@ -2,8 +2,9 @@ source 'https://rubygems.org'
|
|
2
2
|
gemspec
|
3
3
|
|
4
4
|
gem 'capybara-webkit' unless ENV['CI']
|
5
|
-
gem 'opal', :github => 'opal/opal'
|
6
|
-
gem 'opal-jquery', :github => 'opal/opal-jquery'
|
5
|
+
# gem 'opal', :github => 'opal/opal'
|
6
|
+
# gem 'opal-jquery', :github => 'opal/opal-jquery'
|
7
|
+
# gem 'opal-spec', :github => 'opal/opal-spec'
|
7
8
|
|
8
9
|
if RUBY_VERSION.to_f == 1.8
|
9
10
|
gem 'nokogiri', '< 1.6'
|
data/lib/opal/rails/engine.rb
CHANGED
data/lib/opal/rails/version.rb
CHANGED
data/lib/opal/rails.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
require 'opal'
|
2
2
|
require 'opal-jquery'
|
3
|
+
require 'opal-activesupport'
|
3
4
|
require 'opal-spec'
|
4
5
|
|
5
6
|
require 'opal/rails/engine'
|
6
7
|
require 'opal/rails/template_handler'
|
7
8
|
require 'opal/rails/version'
|
8
|
-
require 'opal/rails/haml_filter' if defined?(Haml)
|
9
9
|
|
10
10
|
require 'jquery-rails'
|
@@ -1,4 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
require 'opal/spec/rake_task'
|
2
|
+
|
3
|
+
Opal::Spec::RakeTask.new('opal:spec' => :environment) do |server|
|
4
|
+
require 'tempfile'
|
5
|
+
|
6
|
+
asset_paths = Opal.paths + Rails.configuration.assets.paths.to_a
|
7
|
+
tempfile = Tempfile.new(['opal-spec', '.js.rb'])
|
8
|
+
|
9
|
+
server.sprockets.clear_paths
|
10
|
+
asset_paths << File.dirname(tempfile.path)
|
11
|
+
server.main = File.basename(tempfile.path, '.js.rb')
|
12
|
+
|
13
|
+
asset_paths.each { |path| server.append_path path }
|
14
|
+
|
15
|
+
required_assets = ['opal']
|
16
|
+
required_assets << 'opal-spec-runner'
|
17
|
+
|
18
|
+
asset_paths.each do |path|
|
19
|
+
Dir["#{path}/spec/**_spec.js.{opal,rb}"].each do |spec|
|
20
|
+
spec = spec[path.size+1..-1] # +1 is for the trailing slash
|
21
|
+
required_assets << spec
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
required_assets.each { |a| tempfile.puts "require #{a.inspect}" }
|
26
|
+
tempfile.close
|
27
|
+
end
|
data/opal-rails.gemspec
CHANGED
@@ -19,11 +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',
|
22
|
+
s.add_runtime_dependency 'opal', '~> 0.4.4'
|
23
|
+
s.add_runtime_dependency 'opal-sprockets', '~> 0.2.0'
|
23
24
|
|
24
25
|
s.add_runtime_dependency 'rails', '>= 3.2.13', '< 5.0'
|
25
|
-
s.add_runtime_dependency 'opal-jquery',
|
26
|
-
s.add_runtime_dependency 'opal-spec',
|
26
|
+
s.add_runtime_dependency 'opal-jquery', '>= 0.0.8'
|
27
|
+
s.add_runtime_dependency 'opal-spec', '~> 0.3.1'
|
28
|
+
s.add_runtime_dependency 'opal-activesupport'
|
27
29
|
s.add_runtime_dependency 'jquery-rails'
|
28
30
|
|
29
31
|
s.add_development_dependency 'rspec', '~> 2.13'
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'opal/source_map'
|
3
|
+
|
4
|
+
describe Opal::SourceMap do
|
5
|
+
before { get '/assets/source_map_example.js' }
|
6
|
+
|
7
|
+
let(:map_body) do
|
8
|
+
get response.headers['X-SourceMap']
|
9
|
+
response.body
|
10
|
+
end
|
11
|
+
|
12
|
+
let(:map) { JSON.parse(map_body) }
|
13
|
+
|
14
|
+
it 'has the source map header' do
|
15
|
+
expect(response.headers['X-SourceMap']).to be_present
|
16
|
+
end
|
17
|
+
|
18
|
+
it "the map is a valid json" do
|
19
|
+
%w[sources mappings].each do |key|
|
20
|
+
expect(map_body[key]).to be_present
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "points to a file on the disk" do
|
25
|
+
path = map['sources'].first
|
26
|
+
pathname = Pathname(path.gsub(%r{^file\://}, ''))
|
27
|
+
expect(pathname.exist?).to be_true
|
28
|
+
end
|
29
|
+
|
30
|
+
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.5.
|
4
|
+
version: 0.5.2
|
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-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.4.
|
19
|
+
version: 0.4.4
|
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.4.
|
26
|
+
version: 0.4.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: opal-sprockets
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 0.2.0
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rails
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,18 +74,32 @@ dependencies:
|
|
60
74
|
version: 0.0.8
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: opal-spec
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - ~>
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: 0.3.1
|
82
|
+
type: :runtime
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - ~>
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 0.3.1
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: opal-activesupport
|
63
91
|
requirement: !ruby/object:Gem::Requirement
|
64
92
|
requirements:
|
65
93
|
- - '>='
|
66
94
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0
|
95
|
+
version: '0'
|
68
96
|
type: :runtime
|
69
97
|
prerelease: false
|
70
98
|
version_requirements: !ruby/object:Gem::Requirement
|
71
99
|
requirements:
|
72
100
|
- - '>='
|
73
101
|
- !ruby/object:Gem::Version
|
74
|
-
version: 0
|
102
|
+
version: '0'
|
75
103
|
- !ruby/object:Gem::Dependency
|
76
104
|
name: jquery-rails
|
77
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,8 +214,8 @@ files:
|
|
186
214
|
- script/rails
|
187
215
|
- spec/integration/assigns_spec.rb
|
188
216
|
- spec/integration/in_browser_specs_spec.rb
|
217
|
+
- spec/integration/source_map_spec.rb
|
189
218
|
- spec/opal/processor_spec.rb
|
190
|
-
- spec/opal/source_map_spec.rb
|
191
219
|
- spec/spec_helper.rb
|
192
220
|
- spec/support/capybara.rb
|
193
221
|
- spec/support/reset_assets_cache.rb
|
@@ -195,6 +223,7 @@ files:
|
|
195
223
|
- test_app/Rakefile
|
196
224
|
- test_app/app/assets/images/rails.png
|
197
225
|
- test_app/app/assets/javascripts/application.js
|
226
|
+
- test_app/app/assets/javascripts/source_map_example.js.rb
|
198
227
|
- test_app/app/assets/javascripts/spec.js
|
199
228
|
- test_app/app/assets/javascripts/spec/example_spec.js.rb
|
200
229
|
- test_app/app/assets/stylesheets/application.css
|
@@ -253,8 +282,8 @@ summary: Rails bindings for opal JS engine
|
|
253
282
|
test_files:
|
254
283
|
- spec/integration/assigns_spec.rb
|
255
284
|
- spec/integration/in_browser_specs_spec.rb
|
285
|
+
- spec/integration/source_map_spec.rb
|
256
286
|
- spec/opal/processor_spec.rb
|
257
|
-
- spec/opal/source_map_spec.rb
|
258
287
|
- spec/spec_helper.rb
|
259
288
|
- spec/support/capybara.rb
|
260
289
|
- spec/support/reset_assets_cache.rb
|
@@ -1,18 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'opal/source_map'
|
3
|
-
|
4
|
-
describe Opal::SourceMap do
|
5
|
-
let(:assets) { Opal::Environment.new }
|
6
|
-
let(:asset) { assets['opal'] }
|
7
|
-
let(:source) { asset.to_s }
|
8
|
-
let(:map) { described_class.new(source, asset.pathname.to_s) }
|
9
|
-
|
10
|
-
it 'source has the magic comments' do
|
11
|
-
described_class::FILE_REGEXP.should match(source)
|
12
|
-
described_class::LINE_REGEXP.should match(source)
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'does not blow while generating the map' do
|
16
|
-
expect { map.as_json }.not_to raise_exception
|
17
|
-
end
|
18
|
-
end
|