opal-rails 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,13 +1,32 @@
1
1
  class OpalSpecController < ActionController::Base
2
+ helper_method :spec_files
3
+
2
4
  def run
3
5
  end
4
-
5
-
6
+
7
+
6
8
  private
7
-
9
+
8
10
  def spec_files
9
- @spec_files ||= (params[:files] || 'spec').split(':')
11
+ @spec_files ||= some_spec_files || all_spec_files
12
+ end
13
+
14
+ def specs_param
15
+ params[:pattern]
16
+ end
17
+
18
+ def some_spec_files
19
+ return if specs_param.blank?
20
+ specs_param.split(':').map { |path| spec_files_for_glob(path) }.flatten
21
+ end
22
+
23
+ def all_spec_files
24
+ spec_files_for_glob '**'
25
+ end
26
+
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|
29
+ path.split('assets/javascripts/spec/').last
30
+ end.uniq
10
31
  end
11
-
12
- helper_method :spec_files
13
32
  end
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <title>Opal Spec Runner</title>
6
6
  <%= javascript_include_tag 'opal-spec-runner' %>
7
- <%= javascript_include_tag *spec_files %>
7
+ <%= javascript_include_tag *spec_files.map { |f| "spec/#{f}"} %>
8
8
  <style>
9
9
  body { font-family: sans-serif; }
10
10
  </style>
@@ -1,2 +1,9 @@
1
- <%= render 'index', :spec_files => spec_files if params[:files].blank? %>
2
- <%= render 'runner', :spec_files => spec_files %>
1
+ <h2>Running:</h2>
2
+
3
+ <ul>
4
+ <% spec_files.each do |spec_file| %>
5
+ <li>
6
+ <%= link_to spec_file, "/opal_spec?pattern=#{URI.escape(spec_file)}" %>
7
+ </li>
8
+ <% end %>
9
+ </ul>
@@ -1,5 +1,5 @@
1
1
  module Opal
2
2
  module Rails
3
- VERSION = '0.3.4'
3
+ VERSION = '0.3.5'
4
4
  end
5
5
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe 'In-browser specs runner' do
4
4
  it 'runs all specs', :js do
5
5
  visit '/opal_spec'
6
- page.should have_content('Running: spec')
6
+ page.should have_content('Running: example_spec.js.rb')
7
7
  page.should have_content('1 examples, 0 failures')
8
8
  end
9
9
  end
@@ -12,11 +12,11 @@ describe Opal::Processor do
12
12
 
13
13
  it "compiles and evaluates the template on #render" do
14
14
  template = Opal::Processor.new { |t| "puts 'Hello, World!'\n" }
15
- template.render.should include('self.$puts("Hello, World!")')
15
+ template.render.should include('"Hello, World!"')
16
16
  end
17
17
 
18
18
  it "can be rendered more than once" do
19
19
  template = Opal::Processor.new { |t| "puts 'Hello, World!'\n" }
20
- 3.times { template.render.should include('self.$puts("Hello, World!")') }
20
+ 3.times { template.render.should include('"Hello, World!"') }
21
21
  end
22
22
  end
metadata CHANGED
@@ -1,182 +1,183 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: opal-rails
3
- version: !ruby/object:Gem::Version
4
- hash: 27
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.5
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 4
10
- version: 0.3.4
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Elia Schito
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2013-02-09 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: opal
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
23
17
  none: false
24
- requirements:
18
+ requirements:
25
19
  - - ~>
26
- - !ruby/object:Gem::Version
27
- hash: 91
28
- segments:
29
- - 0
30
- - 3
31
- - 36
20
+ - !ruby/object:Gem::Version
32
21
  version: 0.3.36
33
22
  type: :runtime
34
- requirement: *id001
35
23
  prerelease: false
36
- - !ruby/object:Gem::Dependency
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.3.36
30
+ - !ruby/object:Gem::Dependency
37
31
  name: rails
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
39
33
  none: false
40
- requirements:
34
+ requirements:
41
35
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 15
44
- segments:
45
- - 3
46
- - 2
47
- - 0
36
+ - !ruby/object:Gem::Version
48
37
  version: 3.2.0
49
38
  type: :runtime
50
- requirement: *id002
51
39
  prerelease: false
52
- - !ruby/object:Gem::Dependency
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 3.2.0
46
+ - !ruby/object:Gem::Dependency
53
47
  name: opal-jquery
54
- version_requirements: &id003 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
55
49
  none: false
56
- requirements:
57
- - - ">="
58
- - !ruby/object:Gem::Version
59
- hash: 21
60
- segments:
61
- - 0
62
- - 0
63
- - 5
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
64
53
  version: 0.0.5
65
54
  type: :runtime
66
- requirement: *id003
67
55
  prerelease: false
68
- - !ruby/object:Gem::Dependency
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.5
62
+ - !ruby/object:Gem::Dependency
69
63
  name: opal-spec
70
- version_requirements: &id004 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
71
65
  none: false
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- hash: 7
76
- segments:
77
- - 0
78
- - 2
79
- - 8
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
80
69
  version: 0.2.8
81
70
  type: :runtime
82
- requirement: *id004
83
71
  prerelease: false
84
- - !ruby/object:Gem::Dependency
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - '>='
76
+ - !ruby/object:Gem::Version
77
+ version: 0.2.8
78
+ - !ruby/object:Gem::Dependency
85
79
  name: jquery-rails
86
- version_requirements: &id005 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
87
81
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
82
+ requirements:
83
+ - - '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
95
86
  type: :runtime
96
- requirement: *id005
97
87
  prerelease: false
98
- - !ruby/object:Gem::Dependency
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
99
95
  name: rspec
100
- version_requirements: &id006 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
101
97
  none: false
102
- requirements:
98
+ requirements:
103
99
  - - ~>
104
- - !ruby/object:Gem::Version
105
- hash: 11
106
- segments:
107
- - 2
108
- - 4
109
- version: "2.4"
100
+ - !ruby/object:Gem::Version
101
+ version: '2.4'
110
102
  type: :development
111
- requirement: *id006
112
103
  prerelease: false
113
- - !ruby/object:Gem::Dependency
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: '2.4'
110
+ - !ruby/object:Gem::Dependency
114
111
  name: rspec-rails
115
- version_requirements: &id007 !ruby/object:Gem::Requirement
112
+ requirement: !ruby/object:Gem::Requirement
116
113
  none: false
117
- requirements:
114
+ requirements:
118
115
  - - ~>
119
- - !ruby/object:Gem::Version
120
- hash: 11
121
- segments:
122
- - 2
123
- - 4
124
- version: "2.4"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.4'
125
118
  type: :development
126
- requirement: *id007
127
119
  prerelease: false
128
- - !ruby/object:Gem::Dependency
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: '2.4'
126
+ - !ruby/object:Gem::Dependency
129
127
  name: capybara
130
- version_requirements: &id008 !ruby/object:Gem::Requirement
128
+ requirement: !ruby/object:Gem::Requirement
131
129
  none: false
132
- requirements:
130
+ requirements:
133
131
  - - <
134
- - !ruby/object:Gem::Version
135
- hash: 7
136
- segments:
137
- - 2
138
- version: "2"
132
+ - !ruby/object:Gem::Version
133
+ version: '2'
139
134
  type: :development
140
- requirement: *id008
141
135
  prerelease: false
142
- - !ruby/object:Gem::Dependency
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - <
140
+ - !ruby/object:Gem::Version
141
+ version: '2'
142
+ - !ruby/object:Gem::Dependency
143
143
  name: launchy
144
- version_requirements: &id009 !ruby/object:Gem::Requirement
144
+ requirement: !ruby/object:Gem::Requirement
145
145
  none: false
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- hash: 3
150
- segments:
151
- - 0
152
- version: "0"
146
+ requirements:
147
+ - - '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
153
150
  type: :development
154
- requirement: *id009
155
151
  prerelease: false
156
- - !ruby/object:Gem::Dependency
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
157
159
  name: execjs
158
- version_requirements: &id010 !ruby/object:Gem::Requirement
160
+ requirement: !ruby/object:Gem::Requirement
159
161
  none: false
160
- requirements:
161
- - - ">="
162
- - !ruby/object:Gem::Version
163
- hash: 3
164
- segments:
165
- - 0
166
- version: "0"
162
+ requirements:
163
+ - - '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
167
166
  type: :development
168
- requirement: *id010
169
167
  prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
170
174
  description: Rails bindings for opal JS engine
171
- email:
175
+ email:
172
176
  - elia@schito.me
173
177
  executables: []
174
-
175
178
  extensions: []
176
-
177
179
  extra_rdoc_files: []
178
-
179
- files:
180
+ files:
180
181
  - .gitignore
181
182
  - .rspec
182
183
  - .travis.yml
@@ -185,8 +186,6 @@ files:
185
186
  - Rakefile
186
187
  - app/controllers/opal_spec_controller.rb
187
188
  - app/views/layouts/opal_spec.html.erb
188
- - app/views/opal_spec/_index.html.erb
189
- - app/views/opal_spec/_runner.html.erb
190
189
  - app/views/opal_spec/run.html.erb
191
190
  - config/routes.rb
192
191
  - lib/assets/javascripts/opal-spec-runner.js.rb
@@ -238,39 +237,37 @@ files:
238
237
  - test_app/public/robots.txt
239
238
  - test_app/script/rails
240
239
  homepage: http://elia.github.com/opal-rails
241
- licenses:
240
+ licenses:
242
241
  - MIT-LICENSE
243
242
  post_install_message:
244
243
  rdoc_options: []
245
-
246
- require_paths:
244
+ require_paths:
247
245
  - lib
248
- required_ruby_version: !ruby/object:Gem::Requirement
246
+ required_ruby_version: !ruby/object:Gem::Requirement
249
247
  none: false
250
- requirements:
251
- - - ">="
252
- - !ruby/object:Gem::Version
253
- hash: 3
254
- segments:
248
+ requirements:
249
+ - - '>='
250
+ - !ruby/object:Gem::Version
251
+ version: '0'
252
+ segments:
255
253
  - 0
256
- version: "0"
257
- required_rubygems_version: !ruby/object:Gem::Requirement
254
+ hash: 1662342860294513732
255
+ required_rubygems_version: !ruby/object:Gem::Requirement
258
256
  none: false
259
- requirements:
260
- - - ">="
261
- - !ruby/object:Gem::Version
262
- hash: 3
263
- segments:
257
+ requirements:
258
+ - - '>='
259
+ - !ruby/object:Gem::Version
260
+ version: '0'
261
+ segments:
264
262
  - 0
265
- version: "0"
263
+ hash: 1662342860294513732
266
264
  requirements: []
267
-
268
265
  rubyforge_project: opal-rails
269
- rubygems_version: 1.8.24
266
+ rubygems_version: 1.8.25
270
267
  signing_key:
271
268
  specification_version: 3
272
269
  summary: Rails bindings for opal JS engine
273
- test_files:
270
+ test_files:
274
271
  - spec/integration/assigns_spec.rb
275
272
  - spec/integration/in_browser_specs_spec.rb
276
273
  - spec/opal/processor_spec.rb
@@ -1,11 +0,0 @@
1
- <h2>All specs:</h2>
2
-
3
- <ul>
4
- <% Dir[Rails.root.join('app/assets/javascripts/spec/**_spec.js.{rb,opal}')].each do |spec_file| %>
5
- <li>
6
- <% path = Pathname.new(spec_file).relative_path_from( Rails.root.join('app/assets/javascripts/') ) %>
7
- <%= link_to path, "/opal_spec?files=#{URI.escape(path.to_s)}" %>
8
- </li>
9
- <% end %>
10
- </ul>
11
-
@@ -1 +0,0 @@
1
- <b>Running: <%= spec_files.to_sentence %></b>