cells 3.10.1 → 3.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. data/.travis.yml +7 -0
  2. data/CHANGES.md +18 -0
  3. data/Gemfile +1 -1
  4. data/README.md +182 -57
  5. data/TODO.md +9 -0
  6. data/cells.gemspec +3 -1
  7. data/gemfiles/Gemfile.rails4-0 +2 -1
  8. data/gemfiles/Gemfile.rails4-1 +5 -3
  9. data/lib/cell/base.rb +33 -64
  10. data/lib/cell/base/prefixes.rb +27 -0
  11. data/lib/cell/base/self_contained.rb +13 -0
  12. data/lib/cell/base/view.rb +15 -0
  13. data/lib/cell/builder.rb +52 -53
  14. data/lib/cell/caching.rb +21 -4
  15. data/lib/cell/concept.rb +85 -0
  16. data/lib/cell/rails.rb +13 -6
  17. data/lib/cell/rails/view_model.rb +47 -6
  18. data/lib/cell/rendering.rb +13 -13
  19. data/lib/cell/test_case.rb +3 -3
  20. data/lib/cell/view_model.rb +151 -0
  21. data/lib/cells.rb +0 -60
  22. data/lib/cells/rails.rb +10 -5
  23. data/lib/cells/railtie.rb +2 -5
  24. data/lib/cells/version.rb +1 -1
  25. data/lib/generators/erb/concept_generator.rb +17 -0
  26. data/lib/generators/haml/concept_generator.rb +17 -0
  27. data/lib/generators/rails/concept_generator.rb +16 -0
  28. data/lib/generators/templates/concept/cell.rb +9 -0
  29. data/lib/generators/templates/concept/view.erb +7 -0
  30. data/lib/generators/templates/concept/view.haml +4 -0
  31. data/lib/generators/trailblazer/base.rb +21 -0
  32. data/lib/generators/trailblazer/view_generator.rb +18 -0
  33. data/test/app/cells/bassist_cell.rb +1 -1
  34. data/test/app/cells/record/views/layout.haml +2 -0
  35. data/test/app/cells/record/views/show.erb +1 -0
  36. data/test/app/cells/record/views/song.erb +1 -0
  37. data/test/app/cells/song/scale.haml +1 -0
  38. data/test/cell_module_test.rb +18 -37
  39. data/test/cells_module_test.rb +1 -1
  40. data/test/concept_generator_test.rb +26 -0
  41. data/test/concept_test.rb +78 -0
  42. data/test/dummy/Rakefile +1 -1
  43. data/test/dummy/app/assets/javascripts/application.js +2 -0
  44. data/test/dummy/app/cells/album/assets/album.js +1 -0
  45. data/test/dummy/app/concepts/song/assets/songs.js +1 -0
  46. data/test/dummy/config/application.rb +11 -6
  47. data/test/dummy/label/label.gemspec +2 -2
  48. data/test/helper_test.rb +2 -2
  49. data/test/prefixes_test.rb +75 -0
  50. data/test/rails/asset_pipeline_test.rb +20 -0
  51. data/test/rails/caching_test.rb +1 -9
  52. data/test/rails/cells_test.rb +2 -17
  53. data/test/rails/forms_test.rb +2 -1
  54. data/test/rails/integration_test.rb +199 -8
  55. data/test/rails/render_test.rb +2 -10
  56. data/test/rails/view_model_test.rb +135 -60
  57. data/test/rails_helper_api_test.rb +2 -1
  58. data/test/self_contained_test.rb +9 -2
  59. data/test/test_case_test.rb +2 -2
  60. data/test/test_helper.rb +2 -3
  61. metadata +117 -33
  62. checksums.yaml +0 -7
  63. data/test/dummy/app/controllers/musician_controller.rb +0 -36
  64. data/test/rails/router_test.rb +0 -45
@@ -34,6 +34,7 @@ class RailsHelperAPITest < MiniTest::Spec
34
34
 
35
35
  class BassistCell < Cell::Base
36
36
  include Cell::Rails::HelperAPI
37
+ include AbstractController::Helpers
37
38
 
38
39
  self._helpers = FakeHelpers
39
40
  self._routes = FakeUrlFor.new
@@ -47,7 +48,7 @@ class RailsHelperAPITest < MiniTest::Spec
47
48
 
48
49
  describe "Rails::HelperAPI" do
49
50
  it "allows accessing the request object" do
50
- skip unless Cell.rails3_1_or_more? and Rails::VERSION::MINOR == 2
51
+ skip unless Cell.rails_version.~ ("3.2") # FIXME: that is only working in Rails 3.2.
51
52
 
52
53
  form = BassistCell.new.render_state(:edit)
53
54
  form.must_match /<form accept-charset="UTF-8" action="\/fruits"/
@@ -7,9 +7,12 @@ class AlbumCell < Cell::Rails
7
7
  @title = "The Sufferer & The Witness"
8
8
  render
9
9
  end
10
+
11
+ class SongCell < self
12
+ end
10
13
  end
11
14
 
12
- unless Cell.rails3_0?
15
+ unless Cell.rails_version.~("3.0")
13
16
 
14
17
  class SelfContainedTest < MiniTest::Spec
15
18
  include Cell::TestCase::TestMethods
@@ -19,6 +22,10 @@ unless Cell.rails3_0?
19
22
  it "renders views from album/views/" do
20
23
  album.render_state(:cover).must_equal "<h3>The Sufferer &amp; The Witness</h3>\n"
21
24
  end
22
- end
23
25
 
26
+ describe "#_prefixes" do
27
+ it { cell("album")._prefixes.must_equal(["album/views"]) }
28
+ it { cell("album_cell/song")._prefixes.must_equal(["album_cell/song/views", "album/views"]) } # this is semi-cool, but the old behaviour.
29
+ end
30
+ end
24
31
  end
@@ -55,7 +55,7 @@ class TestCaseTest < Cell::TestCase
55
55
  describe "#view_assigns" do
56
56
  it "be emtpy when nothing was set" do
57
57
  render_cell(:bassist, :play)
58
- if Cell.rails3_0?
58
+ if Cell.rails_version.~("3.0")
59
59
  assert_equal([:lookup_context], view_assigns.keys)
60
60
  else
61
61
  assert_equal({}, view_assigns)
@@ -69,7 +69,7 @@ class TestCaseTest < Cell::TestCase
69
69
  end
70
70
  end
71
71
  render_cell(:bassist, :sleep)
72
- if Cell.rails3_0?
72
+ if Cell.rails_version.~("3.0")
73
73
  assert_equal("8h", view_assigns[:duration])
74
74
  else
75
75
  assert_equal({:duration => "8h"}, view_assigns)
@@ -1,6 +1,5 @@
1
1
  # encoding: utf-8
2
- require 'rubygems'
3
- require 'minitest/spec'
2
+ require 'minitest/autorun'
4
3
 
5
4
  ENV['RAILS_ENV'] = 'test'
6
5
 
@@ -40,7 +39,7 @@ require "haml/template" # Thanks, Nathan!
40
39
 
41
40
  ActiveSupport::TestCase.class_eval do # this is only needed in integration tests (AC::TestCase).
42
41
  def fix_relative_url_root
43
- return unless Cell.rails3_0?
42
+ return unless Cell.rails_version.~("3.0")
44
43
 
45
44
  @controller.config.instance_eval do
46
45
  def relative_url_root
metadata CHANGED
@@ -1,139 +1,190 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cells
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.1
4
+ version: 3.11.0
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - Nick Sutterer
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-04-16 00:00:00.000000000 Z
12
+ date: 2014-05-29 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: actionpack
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
- - - ">="
19
+ - - ! '>='
18
20
  - !ruby/object:Gem::Version
19
21
  version: '3.0'
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
- - - ">="
27
+ - - ! '>='
25
28
  - !ruby/object:Gem::Version
26
29
  version: '3.0'
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: railties
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
- - - ">="
35
+ - - ! '>='
32
36
  - !ruby/object:Gem::Version
33
37
  version: '3.0'
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
- - - ">="
43
+ - - ! '>='
39
44
  - !ruby/object:Gem::Version
40
45
  version: '3.0'
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: uber
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
- - - "~>"
51
+ - - ~>
46
52
  - !ruby/object:Gem::Version
47
- version: 0.0.4
53
+ version: 0.0.6
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
- - - "~>"
59
+ - - ~>
53
60
  - !ruby/object:Gem::Version
54
- version: 0.0.4
61
+ version: 0.0.6
55
62
  - !ruby/object:Gem::Dependency
56
63
  name: rake
57
64
  requirement: !ruby/object:Gem::Requirement
65
+ none: false
58
66
  requirements:
59
- - - ">="
67
+ - - ! '>='
60
68
  - !ruby/object:Gem::Version
61
69
  version: '0'
62
70
  type: :development
63
71
  prerelease: false
64
72
  version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
65
74
  requirements:
66
- - - ">="
75
+ - - ! '>='
67
76
  - !ruby/object:Gem::Version
68
77
  version: '0'
69
78
  - !ruby/object:Gem::Dependency
70
79
  name: haml
71
80
  requirement: !ruby/object:Gem::Requirement
81
+ none: false
72
82
  requirements:
73
- - - ">="
83
+ - - ! '>='
74
84
  - !ruby/object:Gem::Version
75
85
  version: '0'
76
86
  type: :development
77
87
  prerelease: false
78
88
  version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
79
90
  requirements:
80
- - - ">="
91
+ - - ! '>='
81
92
  - !ruby/object:Gem::Version
82
93
  version: '0'
83
94
  - !ruby/object:Gem::Dependency
84
95
  name: slim
85
96
  requirement: !ruby/object:Gem::Requirement
97
+ none: false
86
98
  requirements:
87
- - - ">="
99
+ - - ! '>='
88
100
  - !ruby/object:Gem::Version
89
101
  version: '0'
90
102
  type: :development
91
103
  prerelease: false
92
104
  version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
93
106
  requirements:
94
- - - ">="
107
+ - - ! '>='
95
108
  - !ruby/object:Gem::Version
96
109
  version: '0'
97
110
  - !ruby/object:Gem::Dependency
98
111
  name: tzinfo
99
112
  requirement: !ruby/object:Gem::Requirement
113
+ none: false
100
114
  requirements:
101
- - - ">="
115
+ - - ! '>='
102
116
  - !ruby/object:Gem::Version
103
117
  version: '0'
104
118
  type: :development
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
107
122
  requirements:
108
- - - ">="
123
+ - - ! '>='
109
124
  - !ruby/object:Gem::Version
110
125
  version: '0'
111
126
  - !ruby/object:Gem::Dependency
112
127
  name: minitest
113
128
  requirement: !ruby/object:Gem::Requirement
129
+ none: false
114
130
  requirements:
115
- - - ">="
131
+ - - ! '>='
116
132
  - !ruby/object:Gem::Version
117
133
  version: 4.7.5
118
134
  type: :development
119
135
  prerelease: false
120
136
  version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
121
138
  requirements:
122
- - - ">="
139
+ - - ! '>='
123
140
  - !ruby/object:Gem::Version
124
141
  version: 4.7.5
125
142
  - !ruby/object:Gem::Dependency
126
143
  name: activemodel
127
144
  requirement: !ruby/object:Gem::Requirement
145
+ none: false
128
146
  requirements:
129
- - - ">="
147
+ - - ! '>='
130
148
  - !ruby/object:Gem::Version
131
149
  version: '0'
132
150
  type: :development
133
151
  prerelease: false
134
152
  version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
135
154
  requirements:
136
- - - ">="
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: capybara
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ - !ruby/object:Gem::Dependency
175
+ name: sprockets
176
+ requirement: !ruby/object:Gem::Requirement
177
+ none: false
178
+ requirements:
179
+ - - ! '>='
180
+ - !ruby/object:Gem::Version
181
+ version: '0'
182
+ type: :development
183
+ prerelease: false
184
+ version_requirements: !ruby/object:Gem::Requirement
185
+ none: false
186
+ requirements:
187
+ - - ! '>='
137
188
  - !ruby/object:Gem::Version
138
189
  version: '0'
139
190
  description: Cells are view components for Rails. They are lightweight controllers,
@@ -145,12 +196,13 @@ executables: []
145
196
  extensions: []
146
197
  extra_rdoc_files: []
147
198
  files:
148
- - ".gitignore"
149
- - ".travis.yml"
199
+ - .gitignore
200
+ - .travis.yml
150
201
  - CHANGES.md
151
202
  - Gemfile
152
203
  - README.md
153
204
  - Rakefile
205
+ - TODO.md
154
206
  - cells.gemspec
155
207
  - gemfiles/Gemfile.rails3-0
156
208
  - gemfiles/Gemfile.rails3-1
@@ -159,8 +211,12 @@ files:
159
211
  - gemfiles/Gemfile.rails4-1
160
212
  - lib/cell.rb
161
213
  - lib/cell/base.rb
214
+ - lib/cell/base/prefixes.rb
215
+ - lib/cell/base/self_contained.rb
216
+ - lib/cell/base/view.rb
162
217
  - lib/cell/builder.rb
163
218
  - lib/cell/caching.rb
219
+ - lib/cell/concept.rb
164
220
  - lib/cell/deprecations.rb
165
221
  - lib/cell/dsl.rb
166
222
  - lib/cell/rack.rb
@@ -173,6 +229,7 @@ files:
173
229
  - lib/cell/rails4_1_strategy.rb
174
230
  - lib/cell/rendering.rb
175
231
  - lib/cell/test_case.rb
232
+ - lib/cell/view_model.rb
176
233
  - lib/cells.rb
177
234
  - lib/cells/cells.rake
178
235
  - lib/cells/engines.rb
@@ -184,15 +241,23 @@ files:
184
241
  - lib/generators/cells/cell_generator.rb
185
242
  - lib/generators/cells/view_generator.rb
186
243
  - lib/generators/erb/cell_generator.rb
244
+ - lib/generators/erb/concept_generator.rb
187
245
  - lib/generators/haml/cell_generator.rb
246
+ - lib/generators/haml/concept_generator.rb
188
247
  - lib/generators/rails/cell_generator.rb
248
+ - lib/generators/rails/concept_generator.rb
189
249
  - lib/generators/slim/cell_generator.rb
190
250
  - lib/generators/templates/cell.rb
191
251
  - lib/generators/templates/cell_test.rb
252
+ - lib/generators/templates/concept/cell.rb
253
+ - lib/generators/templates/concept/view.erb
254
+ - lib/generators/templates/concept/view.haml
192
255
  - lib/generators/templates/view.erb
193
256
  - lib/generators/templates/view.haml
194
257
  - lib/generators/templates/view.slim
195
258
  - lib/generators/test_unit/cell_generator.rb
259
+ - lib/generators/trailblazer/base.rb
260
+ - lib/generators/trailblazer/view_generator.rb
196
261
  - test/app/cells/album/views/cover.haml
197
262
  - test/app/cells/bad_guitarist/_dii.html.erb
198
263
  - test/app/cells/bad_guitarist_cell.rb
@@ -221,12 +286,16 @@ files:
221
286
  - test/app/cells/layouts/b.erb
222
287
  - test/app/cells/layouts/metal.html.erb
223
288
  - test/app/cells/rails_helper_api_test/bassist/edit.html.erb
289
+ - test/app/cells/record/views/layout.haml
290
+ - test/app/cells/record/views/show.erb
291
+ - test/app/cells/record/views/song.erb
224
292
  - test/app/cells/shouter/sing.html.erb
225
293
  - test/app/cells/song/dashboard.haml
226
294
  - test/app/cells/song/details.html.haml
227
295
  - test/app/cells/song/info.html.haml
228
296
  - test/app/cells/song/lyrics.html.haml
229
297
  - test/app/cells/song/plays.haml
298
+ - test/app/cells/song/scale.haml
230
299
  - test/app/cells/song/show.html.haml
231
300
  - test/app/cells/song/title.html.haml
232
301
  - test/app/cells/trumpeter/promote.html.erb
@@ -237,10 +306,14 @@ files:
237
306
  - test/cell_module_test.rb
238
307
  - test/cell_test.rb
239
308
  - test/cells_module_test.rb
309
+ - test/concept_generator_test.rb
310
+ - test/concept_test.rb
240
311
  - test/deprecations_test.rb
241
312
  - test/dummy/Rakefile
313
+ - test/dummy/app/assets/javascripts/application.js
314
+ - test/dummy/app/cells/album/assets/album.js
315
+ - test/dummy/app/concepts/song/assets/songs.js
242
316
  - test/dummy/app/controllers/application_controller.rb
243
- - test/dummy/app/controllers/musician_controller.rb
244
317
  - test/dummy/app/helpers/application_helper.rb
245
318
  - test/dummy/app/views/layouts/application.html.erb
246
319
  - test/dummy/app/views/musician/featured.html.erb
@@ -272,13 +345,14 @@ files:
272
345
  - test/dummy/public/stylesheets/.gitkeep
273
346
  - test/dummy/script/rails
274
347
  - test/helper_test.rb
348
+ - test/prefixes_test.rb
275
349
  - test/rack_test.rb
350
+ - test/rails/asset_pipeline_test.rb
276
351
  - test/rails/caching_test.rb
277
352
  - test/rails/cells_test.rb
278
353
  - test/rails/forms_test.rb
279
354
  - test/rails/integration_test.rb
280
355
  - test/rails/render_test.rb
281
- - test/rails/router_test.rb
282
356
  - test/rails/view_model_test.rb
283
357
  - test/rails/view_test.rb
284
358
  - test/rails_helper_api_test.rb
@@ -288,26 +362,27 @@ files:
288
362
  homepage: http://cells.rubyforge.org
289
363
  licenses:
290
364
  - MIT
291
- metadata: {}
292
365
  post_install_message:
293
366
  rdoc_options: []
294
367
  require_paths:
295
368
  - lib
296
369
  required_ruby_version: !ruby/object:Gem::Requirement
370
+ none: false
297
371
  requirements:
298
- - - ">="
372
+ - - ! '>='
299
373
  - !ruby/object:Gem::Version
300
374
  version: '0'
301
375
  required_rubygems_version: !ruby/object:Gem::Requirement
376
+ none: false
302
377
  requirements:
303
- - - ">="
378
+ - - ! '>='
304
379
  - !ruby/object:Gem::Version
305
380
  version: '0'
306
381
  requirements: []
307
382
  rubyforge_project:
308
- rubygems_version: 2.2.1
383
+ rubygems_version: 1.8.25
309
384
  signing_key:
310
- specification_version: 4
385
+ specification_version: 3
311
386
  summary: View Components for Rails.
312
387
  test_files:
313
388
  - test/app/cells/album/views/cover.haml
@@ -338,12 +413,16 @@ test_files:
338
413
  - test/app/cells/layouts/b.erb
339
414
  - test/app/cells/layouts/metal.html.erb
340
415
  - test/app/cells/rails_helper_api_test/bassist/edit.html.erb
416
+ - test/app/cells/record/views/layout.haml
417
+ - test/app/cells/record/views/show.erb
418
+ - test/app/cells/record/views/song.erb
341
419
  - test/app/cells/shouter/sing.html.erb
342
420
  - test/app/cells/song/dashboard.haml
343
421
  - test/app/cells/song/details.html.haml
344
422
  - test/app/cells/song/info.html.haml
345
423
  - test/app/cells/song/lyrics.html.haml
346
424
  - test/app/cells/song/plays.haml
425
+ - test/app/cells/song/scale.haml
347
426
  - test/app/cells/song/show.html.haml
348
427
  - test/app/cells/song/title.html.haml
349
428
  - test/app/cells/trumpeter/promote.html.erb
@@ -354,10 +433,14 @@ test_files:
354
433
  - test/cell_module_test.rb
355
434
  - test/cell_test.rb
356
435
  - test/cells_module_test.rb
436
+ - test/concept_generator_test.rb
437
+ - test/concept_test.rb
357
438
  - test/deprecations_test.rb
358
439
  - test/dummy/Rakefile
440
+ - test/dummy/app/assets/javascripts/application.js
441
+ - test/dummy/app/cells/album/assets/album.js
442
+ - test/dummy/app/concepts/song/assets/songs.js
359
443
  - test/dummy/app/controllers/application_controller.rb
360
- - test/dummy/app/controllers/musician_controller.rb
361
444
  - test/dummy/app/helpers/application_helper.rb
362
445
  - test/dummy/app/views/layouts/application.html.erb
363
446
  - test/dummy/app/views/musician/featured.html.erb
@@ -389,13 +472,14 @@ test_files:
389
472
  - test/dummy/public/stylesheets/.gitkeep
390
473
  - test/dummy/script/rails
391
474
  - test/helper_test.rb
475
+ - test/prefixes_test.rb
392
476
  - test/rack_test.rb
477
+ - test/rails/asset_pipeline_test.rb
393
478
  - test/rails/caching_test.rb
394
479
  - test/rails/cells_test.rb
395
480
  - test/rails/forms_test.rb
396
481
  - test/rails/integration_test.rb
397
482
  - test/rails/render_test.rb
398
- - test/rails/router_test.rb
399
483
  - test/rails/view_model_test.rb
400
484
  - test/rails/view_test.rb
401
485
  - test/rails_helper_api_test.rb