opal-rails 0.5.1 → 0.5.2

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: 3e4e22e42bad47905efede272346b44c20522672
4
- data.tar.gz: 2c79c966946f47be5bfe0be5a1869845b87ede70
3
+ metadata.gz: 9b22d76807c1341981c89a5562ac3c878c09d391
4
+ data.tar.gz: 2b6cce5182f8b9db817e323ef200cdf612ce7e8d
5
5
  SHA512:
6
- metadata.gz: cd7bd281198581a9eadfda4d66cb5aef18c07d4bfee9bed6774371d2064866bdba486acdcc1ab2d87af8084b63acda30abdbccbf51adde9fd40f491ec2358e89
7
- data.tar.gz: 5dbe16bdbebb834fc3465958dca91ba2d3f49dc77ddc7ac07f02aa62910fbc36c1580969249a5360fdbf5f64e35bdaa9c57e4908b9bd784ed299c7f8de7d06dd
6
+ metadata.gz: 403229e9749a59d2ea8820f1d37a919fbad0fcfc432cd9154021d5140f1597457cd19fc4b50cf531375ed6c9ac9cd406c451996ef533dde6c9cc6ae9a0eda2f3
7
+ data.tar.gz: 211278574a80eb006da1bb5148e31caa9b6043db3b63f5eb62afcaef9506c522fce4f7a31a8c1990348ed3c52bc632eeeddf9f81f8b8571258c7a1ae53d28827
data/.travis.yml CHANGED
@@ -8,3 +8,6 @@ rvm:
8
8
  before_script:
9
9
  - "export DISPLAY=:99.0"
10
10
  - "sh -e /etc/init.d/xvfb start"
11
+
12
+ notifications:
13
+ irc: "irc.freenode.org#opal"
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'
@@ -25,6 +25,8 @@ module Opal
25
25
  end
26
26
 
27
27
  config.after_initialize do |app|
28
+ require 'opal/rails/haml_filter' if defined?(Haml)
29
+
28
30
  config.opal.each_pair do |key, value|
29
31
  key = "#{key}="
30
32
  Opal::Processor.send(key, value) if Opal::Processor.respond_to? key
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Rails
3
- VERSION = '0.5.1'
3
+ VERSION = '0.5.2'
4
4
  end
5
5
  end
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
- # desc "Explaining what the task does"
2
- # task :opal-rails do
3
- # # Task goes here
4
- # end
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', '~> 0.4.1'
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', '>= 0.0.8'
26
- s.add_runtime_dependency 'opal-spec', '>= 0.2.15'
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
@@ -0,0 +1,4 @@
1
+ class SourceMapExample
2
+ def works?
3
+ end
4
+ 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.1
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-07-01 00:00:00.000000000 Z
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.1
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.1
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.2.15
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.2.15
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