cells 4.1.7 → 4.1.8
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 +5 -5
- data/CHANGES.md +5 -0
- data/README.md +18 -19
- data/cells.gemspec +30 -22
- data/lib/cell/version.rb +1 -1
- data/lib/cell/view_model.rb +1 -2
- metadata +58 -78
- data/.gitignore +0 -9
- data/.travis.yml +0 -16
- data/Gemfile +0 -10
- data/Rakefile +0 -28
- data/TODO.md +0 -12
- data/benchmarks/class_builder.rb +0 -37
- data/benchmarks/collection.rb +0 -47
- data/test/builder_test.rb +0 -63
- data/test/cache_test.rb +0 -32
- data/test/cell_benchmark.rb +0 -32
- data/test/cell_test.rb +0 -20
- data/test/concept_test.rb +0 -87
- data/test/context_test.rb +0 -44
- data/test/fixtures/bassist/play.erb +0 -1
- data/test/fixtures/cell_test/song/show_with_block.erb +0 -1
- data/test/fixtures/comment/layout/show.erb +0 -1
- data/test/fixtures/comment/show/show.erb +0 -1
- data/test/fixtures/concepts/record/views/layout.erb +0 -1
- data/test/fixtures/concepts/record/views/show.erb +0 -1
- data/test/fixtures/concepts/record/views/song.erb +0 -1
- data/test/fixtures/inherit_views_test/popper/tap.erb +0 -1
- data/test/fixtures/inherit_views_test/tapper/play.erb +0 -1
- data/test/fixtures/inherit_views_test/tapper/tap.erb +0 -1
- data/test/fixtures/partial_test/with_partial/show.erb +0 -1
- data/test/fixtures/partials/_show.html.erb +0 -1
- data/test/fixtures/partials/_show.xml.erb +0 -1
- data/test/fixtures/song/ivar.erb +0 -1
- data/test/fixtures/song/show.erb +0 -1
- data/test/fixtures/song/with_block.erb +0 -1
- data/test/fixtures/song/with_erb.erb +0 -4
- data/test/fixtures/song/with_html.erb +0 -1
- data/test/fixtures/song/with_locals.erb +0 -2
- data/test/fixtures/song_with_layout/happy.erb +0 -1
- data/test/fixtures/song_with_layout/merry.erb +0 -1
- data/test/fixtures/song_with_layout/show.erb +0 -1
- data/test/fixtures/song_with_layout/show_with_layout.erb +0 -1
- data/test/fixtures/templates_caching_test/song/show.erb +0 -1
- data/test/fixtures/url_helper_test/song/edit.erb +0 -8
- data/test/fixtures/url_helper_test/song/with_block.erb +0 -2
- data/test/fixtures/url_helper_test/song/with_capture.erb +0 -4
- data/test/fixtures/url_helper_test/song/with_content_tag.erb +0 -6
- data/test/fixtures/url_helper_test/song/with_form_for_block.erb +0 -3
- data/test/fixtures/url_helper_test/song/with_link_to.erb +0 -3
- data/test/layout_test.rb +0 -88
- data/test/partial_test.rb +0 -35
- data/test/prefixes_test.rb +0 -133
- data/test/property_test.rb +0 -48
- data/test/public_test.rb +0 -99
- data/test/render_test.rb +0 -115
- data/test/templates_test.rb +0 -44
- data/test/test_helper.rb +0 -13
- data/test/testing_test.rb +0 -59
- data/test/twin_test.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cd2c945fb25b692f91d57d17385174d2fa0fb14e26a7f9fbe8a7c16877d6d29c
|
4
|
+
data.tar.gz: 6bd815c121a5c50e5b9b72fdefe0f6e0ac74df6bf0b8e05596b183b5074b4c49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f694f8ceb22935a971c493f77214e481b1be0e74071eaf6b80a33aceda31cf71a53074c435be54852c2f6a110c1cb3c47b66e4051670140893e2265a40c58579
|
7
|
+
data.tar.gz: f1f332a42741e3e674b04b663bc6866963eb2f5048be5c84b0d27076bea0f0e5180ae6d6c6635e3a08625057c1964db81f26ce18056a240f4b8518d48b3dfe41
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
@@ -2,23 +2,24 @@
|
|
2
2
|
|
3
3
|
*View Components for Ruby and Rails.*
|
4
4
|
|
5
|
-
[](
|
7
|
-
|
8
|
-
Status](https://
|
5
|
+
[](https://trailblazer.zulipchat.com/login/)
|
6
|
+
[](https://trailblazer.to/2.1/#callout-section)
|
7
|
+

|
9
10
|
[](http://badge.fury.io/rb/cells)
|
10
11
|
|
11
12
|
## Overview
|
12
13
|
|
13
14
|
Cells allow you to encapsulate parts of your UI into components into _view models_. View models, or cells, are simple ruby classes that can render templates.
|
14
15
|
|
15
|
-
Nevertheless, a cell gives you more than just a template renderer. They allow proper OOP, polymorphic builders, [nesting](#nested-cells), view inheritance, using Rails helpers, [asset packaging](
|
16
|
+
Nevertheless, a cell gives you more than just a template renderer. They allow proper OOP, polymorphic builders, [nesting](#nested-cells), view inheritance, using Rails helpers, [asset packaging](https://trailblazer.to/2.1/docs/cells.html#cells-rails-asset-pipeline) to bundle JS, CSS or images, simple distribution via gems or Rails engines, encapsulated testing, [caching](#caching), and [integrate with Trailblazer](https://github.com/trailblazer/trailblazer-cells).
|
16
17
|
|
17
18
|
## Full Documentation
|
18
19
|
|
19
|
-
Cells is part of the Trailblazer framework. [Full documentation](
|
20
|
+
Cells is part of the Trailblazer framework. [Full documentation](https://trailblazer.to/2.1/docs/cells/) is available on the project site.
|
20
21
|
|
21
|
-
Cells is completely decoupled from Rails. However, Rails-specific functionality is to be found [here](
|
22
|
+
Cells is completely decoupled from Rails. However, Rails-specific functionality is to be found [here](https://trailblazer.to/2.1/docs/cells/#cells-4-rails).
|
22
23
|
|
23
24
|
## Rendering Cells
|
24
25
|
|
@@ -151,7 +152,7 @@ Capybara.string(html).must_have_css "h3"
|
|
151
152
|
|
152
153
|
It is completely up to you how you test, whether it's RSpec, MiniTest or whatever. All the cell does is return HTML.
|
153
154
|
|
154
|
-
[In Rails, there's support](
|
155
|
+
[In Rails, there's support](https://trailblazer.to/2.1/docs/cells/#cells-4-overview-testing) for TestUnit, MiniTest and RSpec available, along with Capybara integration.
|
155
156
|
|
156
157
|
## Properties
|
157
158
|
|
@@ -182,7 +183,7 @@ song.title #=> "<script>Dangerous</script>"
|
|
182
183
|
Comment::Cell.(song).title #=> <script>Dangerous</script>
|
183
184
|
```
|
184
185
|
|
185
|
-
Properties and escaping are [documented here](
|
186
|
+
Properties and escaping are [documented here](https://trailblazer.to/2.1/docs/cells/#cells-4-api-html-escaping).
|
186
187
|
|
187
188
|
## Installation
|
188
189
|
|
@@ -270,7 +271,7 @@ end
|
|
270
271
|
|
271
272
|
## Asset Packaging
|
272
273
|
|
273
|
-
Cells can easily ship with their own JavaScript, CSS and more and be part of Rails' asset pipeline. Bundling assets into a cell allows you to implement super encapsulated widgets that are stand-alone. Asset pipeline is [documented here](
|
274
|
+
Cells can easily ship with their own JavaScript, CSS and more and be part of Rails' asset pipeline. Bundling assets into a cell allows you to implement super encapsulated widgets that are stand-alone. Asset pipeline is [documented here](https://trailblazer.to/2.1/docs/cells/#cells-4-rails-asset-pipeline).
|
274
275
|
|
275
276
|
## Render API
|
276
277
|
|
@@ -344,7 +345,7 @@ This works both in cell views and on the instance, in states.
|
|
344
345
|
|
345
346
|
## View Inheritance
|
346
347
|
|
347
|
-
You can not only inherit code across cell classes, but also views. This is extremely helpful if you want to override parts of your UI, only. It's [documented here](
|
348
|
+
You can not only inherit code across cell classes, but also views. This is extremely helpful if you want to override parts of your UI, only. It's [documented here](https://trailblazer.to/2.1/docs/cells/#cells-4-api-view-inheritance).
|
348
349
|
|
349
350
|
## Collections
|
350
351
|
|
@@ -357,7 +358,7 @@ cell(:comment, collection: comments).()
|
|
357
358
|
|
358
359
|
This will invoke `cell(:comment, comment).()` three times and concatenate the rendered output automatically.
|
359
360
|
|
360
|
-
Learn more [about collections here](
|
361
|
+
Learn more [about collections here](https://trailblazer.to/2.1/docs/cells/#cells-4-api-collection).
|
361
362
|
|
362
363
|
|
363
364
|
## Builder
|
@@ -382,7 +383,7 @@ The `#cell` helper takes care of instantiating the right cell class for you.
|
|
382
383
|
cell(:comment, Post.find(1)) #=> creates a PostCell.
|
383
384
|
```
|
384
385
|
|
385
|
-
Learn more [about builders here](
|
386
|
+
Learn more [about builders here](https://trailblazer.to/2.1/docs/cells/#cells-4-api-builder).
|
386
387
|
|
387
388
|
## Caching
|
388
389
|
|
@@ -401,16 +402,14 @@ The `::cache` method will forward options to the caching engine.
|
|
401
402
|
cache :show, expires_in: 10.minutes
|
402
403
|
```
|
403
404
|
|
404
|
-
You can also compute your own cache key, use dynamic keys, cache tags, and conditionals using `:if`. Caching is documented [here](
|
405
|
+
You can also compute your own cache key, use dynamic keys, cache tags, and conditionals using `:if`. Caching is documented [here](https://trailblazer.to/2.1/docs/cells/#cells-4-api-caching) and in chapter 8 of the [Trailblazer book](http://leanpub.com/trailblazer).
|
405
406
|
|
406
407
|
|
407
408
|
## The Book
|
408
409
|
|
409
410
|
Cells is part of the [Trailblazer project](https://github.com/apotonick/trailblazer). Please [buy my book](https://leanpub.com/trailblazer) to support the development and to learn all the cool stuff about Cells. The book discusses many use cases of Cells.
|
410
411
|
|
411
|
-
|
412
|
-

|
413
|
-
</a>
|
412
|
+
[](https://leanpub.com/trailblazer)
|
414
413
|
|
415
414
|
* Basic view models, replacing helpers, and how to structure your view into cell components (chapter 2 and 4).
|
416
415
|
* Advanced Cells API (chapter 4 and 6).
|
@@ -422,11 +421,11 @@ The book picks up where the README leaves off. Go grab a copy and support us - i
|
|
422
421
|
|
423
422
|
## This is not Cells 3.x!
|
424
423
|
|
425
|
-
Temporary note: This is the README and API for Cells 4. Many things have improved. If you want to upgrade, [follow this guide](https://github.com/apotonick/cells/wiki/From-Cells-3-to-Cells-4---Upgrading-Guide). When in trouble, join the [
|
424
|
+
Temporary note: This is the README and API for Cells 4. Many things have improved. If you want to upgrade, [follow this guide](https://github.com/apotonick/cells/wiki/From-Cells-3-to-Cells-4---Upgrading-Guide). When in trouble, join the [Zulip channel](https://trailblazer.zulipchat.com/login/).
|
426
425
|
|
427
426
|
## LICENSE
|
428
427
|
|
429
|
-
Copyright (c) 2007-
|
428
|
+
Copyright (c) 2007-2024, Nick Sutterer
|
430
429
|
|
431
430
|
Copyright (c) 2007-2008, Solide ICT by Peter Bex and Bob Leers
|
432
431
|
|
data/cells.gemspec
CHANGED
@@ -1,30 +1,38 @@
|
|
1
|
-
|
2
|
-
$:.unshift lib unless $:.include?(lib)
|
3
|
-
|
4
|
-
require "cell/version"
|
1
|
+
require_relative 'lib/cell/version'
|
5
2
|
|
6
3
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
4
|
+
spec.name = 'cells'
|
8
5
|
spec.version = Cell::VERSION
|
9
|
-
spec.
|
10
|
-
spec.
|
11
|
-
spec.
|
12
|
-
spec.
|
13
|
-
spec.
|
14
|
-
spec.
|
15
|
-
|
6
|
+
spec.authors = ['Nick Sutterer']
|
7
|
+
spec.email = ['apotonick@gmail.com']
|
8
|
+
spec.homepage = 'https://github.com/trailblazer/cells'
|
9
|
+
spec.summary = 'View Models for Ruby and Rails.'
|
10
|
+
spec.description = 'View Models for Ruby and Rails, replacing helpers and partials while giving you a clean view architecture with proper encapsulation.'
|
11
|
+
spec.license = 'MIT'
|
12
|
+
|
13
|
+
spec.metadata['bug_tracker_uri'] = "#{spec.homepage}/issues"
|
14
|
+
spec.metadata['changelog_uri'] = "#{spec.homepage}/blob/HEAD/CHANGES.md"
|
15
|
+
spec.metadata['documentation_uri'] = 'https://trailblazer.to/2.1/docs/cells'
|
16
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
17
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
18
|
+
spec.metadata['wiki_uri'] = "#{spec.homepage}/wiki"
|
16
19
|
|
17
|
-
spec.files
|
18
|
-
|
19
|
-
|
20
|
-
|
20
|
+
spec.files = Dir.chdir(__dir__) do
|
21
|
+
`git ls-files -z`.split("\x0").reject do |file|
|
22
|
+
file.start_with?(*%w[.git Gemfile Rakefile TODO test])
|
23
|
+
end
|
24
|
+
end
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
spec.required_ruby_version = '>= 2.5'
|
21
27
|
|
22
|
-
spec.add_dependency
|
28
|
+
spec.add_dependency 'declarative-builder', '~> 0.2.0'
|
29
|
+
spec.add_dependency 'tilt', '>= 1.4', '< 3'
|
23
30
|
spec.add_dependency "declarative-option", "< 0.2.0"
|
24
|
-
spec.add_dependency
|
25
|
-
spec.add_dependency "tilt", ">= 1.4", "< 3"
|
31
|
+
spec.add_dependency 'uber', '< 0.2.0'
|
26
32
|
|
27
|
-
spec.add_development_dependency
|
28
|
-
spec.add_development_dependency
|
29
|
-
spec.add_development_dependency
|
33
|
+
spec.add_development_dependency 'capybara'
|
34
|
+
spec.add_development_dependency 'cells-erb', '>= 0.1.0'
|
35
|
+
spec.add_development_dependency 'minitest'
|
36
|
+
spec.add_development_dependency 'rake'
|
37
|
+
spec.add_development_dependency 'debug'
|
30
38
|
end
|
data/lib/cell/version.rb
CHANGED
data/lib/cell/view_model.rb
CHANGED
@@ -198,8 +198,7 @@ module Cell
|
|
198
198
|
|
199
199
|
# Computes the view name from the call stack in which `render` was invoked.
|
200
200
|
def state_for_implicit_render(options)
|
201
|
-
|
202
|
-
_caller[0].match(/`(\w+)/)[1]
|
201
|
+
caller(3, 1)[0].match(/`(\w+)|#(\w+)'/).captures.compact.first
|
203
202
|
end
|
204
203
|
|
205
204
|
include Layout
|
metadata
CHANGED
@@ -1,29 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cells
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sutterer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: declarative-builder
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.2.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
26
|
version: 0.2.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: tilt
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.4'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '3'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.4'
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '3'
|
27
47
|
- !ruby/object:Gem::Dependency
|
28
48
|
name: declarative-option
|
29
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +59,7 @@ dependencies:
|
|
39
59
|
- !ruby/object:Gem::Version
|
40
60
|
version: 0.2.0
|
41
61
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
62
|
+
name: uber
|
43
63
|
requirement: !ruby/object:Gem::Requirement
|
44
64
|
requirements:
|
45
65
|
- - "<"
|
@@ -53,27 +73,35 @@ dependencies:
|
|
53
73
|
- !ruby/object:Gem::Version
|
54
74
|
version: 0.2.0
|
55
75
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
76
|
+
name: capybara
|
57
77
|
requirement: !ruby/object:Gem::Requirement
|
58
78
|
requirements:
|
59
79
|
- - ">="
|
60
80
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
62
|
-
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
version: '3'
|
65
|
-
type: :runtime
|
81
|
+
version: '0'
|
82
|
+
type: :development
|
66
83
|
prerelease: false
|
67
84
|
version_requirements: !ruby/object:Gem::Requirement
|
68
85
|
requirements:
|
69
86
|
- - ">="
|
70
87
|
- !ruby/object:Gem::Version
|
71
|
-
version: '
|
72
|
-
|
88
|
+
version: '0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: cells-erb
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
73
94
|
- !ruby/object:Gem::Version
|
74
|
-
version:
|
95
|
+
version: 0.1.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 0.1.0
|
75
103
|
- !ruby/object:Gem::Dependency
|
76
|
-
name:
|
104
|
+
name: minitest
|
77
105
|
requirement: !ruby/object:Gem::Requirement
|
78
106
|
requirements:
|
79
107
|
- - ">="
|
@@ -87,7 +115,7 @@ dependencies:
|
|
87
115
|
- !ruby/object:Gem::Version
|
88
116
|
version: '0'
|
89
117
|
- !ruby/object:Gem::Dependency
|
90
|
-
name:
|
118
|
+
name: rake
|
91
119
|
requirement: !ruby/object:Gem::Requirement
|
92
120
|
requirements:
|
93
121
|
- - ">="
|
@@ -101,19 +129,19 @@ dependencies:
|
|
101
129
|
- !ruby/object:Gem::Version
|
102
130
|
version: '0'
|
103
131
|
- !ruby/object:Gem::Dependency
|
104
|
-
name:
|
132
|
+
name: debug
|
105
133
|
requirement: !ruby/object:Gem::Requirement
|
106
134
|
requirements:
|
107
135
|
- - ">="
|
108
136
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0
|
137
|
+
version: '0'
|
110
138
|
type: :development
|
111
139
|
prerelease: false
|
112
140
|
version_requirements: !ruby/object:Gem::Requirement
|
113
141
|
requirements:
|
114
142
|
- - ">="
|
115
143
|
- !ruby/object:Gem::Version
|
116
|
-
version: 0
|
144
|
+
version: '0'
|
117
145
|
description: View Models for Ruby and Rails, replacing helpers and partials while
|
118
146
|
giving you a clean view architecture with proper encapsulation.
|
119
147
|
email:
|
@@ -122,15 +150,8 @@ executables: []
|
|
122
150
|
extensions: []
|
123
151
|
extra_rdoc_files: []
|
124
152
|
files:
|
125
|
-
- ".gitignore"
|
126
|
-
- ".travis.yml"
|
127
153
|
- CHANGES.md
|
128
|
-
- Gemfile
|
129
154
|
- README.md
|
130
|
-
- Rakefile
|
131
|
-
- TODO.md
|
132
|
-
- benchmarks/class_builder.rb
|
133
|
-
- benchmarks/collection.rb
|
134
155
|
- cells.gemspec
|
135
156
|
- lib/cell.rb
|
136
157
|
- lib/cell/abstract.rb
|
@@ -152,56 +173,16 @@ files:
|
|
152
173
|
- lib/cell/view_model.rb
|
153
174
|
- lib/cells.rb
|
154
175
|
- lib/tasks/cells.rake
|
155
|
-
|
156
|
-
- test/cache_test.rb
|
157
|
-
- test/cell_benchmark.rb
|
158
|
-
- test/cell_test.rb
|
159
|
-
- test/concept_test.rb
|
160
|
-
- test/context_test.rb
|
161
|
-
- test/fixtures/bassist/play.erb
|
162
|
-
- test/fixtures/cell_test/song/show_with_block.erb
|
163
|
-
- test/fixtures/comment/layout/show.erb
|
164
|
-
- test/fixtures/comment/show/show.erb
|
165
|
-
- test/fixtures/concepts/record/views/layout.erb
|
166
|
-
- test/fixtures/concepts/record/views/show.erb
|
167
|
-
- test/fixtures/concepts/record/views/song.erb
|
168
|
-
- test/fixtures/inherit_views_test/popper/tap.erb
|
169
|
-
- test/fixtures/inherit_views_test/tapper/play.erb
|
170
|
-
- test/fixtures/inherit_views_test/tapper/tap.erb
|
171
|
-
- test/fixtures/partial_test/with_partial/show.erb
|
172
|
-
- test/fixtures/partials/_show.html.erb
|
173
|
-
- test/fixtures/partials/_show.xml.erb
|
174
|
-
- test/fixtures/song/ivar.erb
|
175
|
-
- test/fixtures/song/show.erb
|
176
|
-
- test/fixtures/song/with_block.erb
|
177
|
-
- test/fixtures/song/with_erb.erb
|
178
|
-
- test/fixtures/song/with_html.erb
|
179
|
-
- test/fixtures/song/with_locals.erb
|
180
|
-
- test/fixtures/song_with_layout/happy.erb
|
181
|
-
- test/fixtures/song_with_layout/merry.erb
|
182
|
-
- test/fixtures/song_with_layout/show.erb
|
183
|
-
- test/fixtures/song_with_layout/show_with_layout.erb
|
184
|
-
- test/fixtures/templates_caching_test/song/show.erb
|
185
|
-
- test/fixtures/url_helper_test/song/edit.erb
|
186
|
-
- test/fixtures/url_helper_test/song/with_block.erb
|
187
|
-
- test/fixtures/url_helper_test/song/with_capture.erb
|
188
|
-
- test/fixtures/url_helper_test/song/with_content_tag.erb
|
189
|
-
- test/fixtures/url_helper_test/song/with_form_for_block.erb
|
190
|
-
- test/fixtures/url_helper_test/song/with_link_to.erb
|
191
|
-
- test/layout_test.rb
|
192
|
-
- test/partial_test.rb
|
193
|
-
- test/prefixes_test.rb
|
194
|
-
- test/property_test.rb
|
195
|
-
- test/public_test.rb
|
196
|
-
- test/render_test.rb
|
197
|
-
- test/templates_test.rb
|
198
|
-
- test/test_helper.rb
|
199
|
-
- test/testing_test.rb
|
200
|
-
- test/twin_test.rb
|
201
|
-
homepage: https://github.com/apotonick/cells
|
176
|
+
homepage: https://github.com/trailblazer/cells
|
202
177
|
licenses:
|
203
178
|
- MIT
|
204
|
-
metadata:
|
179
|
+
metadata:
|
180
|
+
bug_tracker_uri: https://github.com/trailblazer/cells/issues
|
181
|
+
changelog_uri: https://github.com/trailblazer/cells/blob/HEAD/CHANGES.md
|
182
|
+
documentation_uri: https://trailblazer.to/2.1/docs/cells
|
183
|
+
homepage_uri: https://github.com/trailblazer/cells
|
184
|
+
source_code_uri: https://github.com/trailblazer/cells
|
185
|
+
wiki_uri: https://github.com/trailblazer/cells/wiki
|
205
186
|
post_install_message:
|
206
187
|
rdoc_options: []
|
207
188
|
require_paths:
|
@@ -210,15 +191,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
210
191
|
requirements:
|
211
192
|
- - ">="
|
212
193
|
- !ruby/object:Gem::Version
|
213
|
-
version: '
|
194
|
+
version: '2.5'
|
214
195
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
215
196
|
requirements:
|
216
197
|
- - ">="
|
217
198
|
- !ruby/object:Gem::Version
|
218
199
|
version: '0'
|
219
200
|
requirements: []
|
220
|
-
|
221
|
-
rubygems_version: 2.5.2
|
201
|
+
rubygems_version: 3.2.3
|
222
202
|
signing_key:
|
223
203
|
specification_version: 4
|
224
204
|
summary: View Models for Ruby and Rails.
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
@@ -1,28 +0,0 @@
|
|
1
|
-
require 'bundler'
|
2
|
-
Bundler::GemHelper.install_tasks
|
3
|
-
|
4
|
-
require 'rake/testtask'
|
5
|
-
|
6
|
-
desc 'Default: run unit tests.'
|
7
|
-
task :default => :test
|
8
|
-
|
9
|
-
Rake::TestTask.new(:test) do |test|
|
10
|
-
test.libs << 'test'
|
11
|
-
test.pattern = 'test/*_test.rb'
|
12
|
-
test.verbose = true
|
13
|
-
# Ruby built-in warnings contain way too much noise to be useful. Consider turning them on again when the following issues are accepted in ruby:
|
14
|
-
# * https://bugs.ruby-lang.org/issues/10967 (remove warning: private attribute?)
|
15
|
-
# * https://bugs.ruby-lang.org/issues/12299 (customized warning handling)
|
16
|
-
test.warning = false
|
17
|
-
end
|
18
|
-
|
19
|
-
# Rake::TestTask.new(:rails) do |test|
|
20
|
-
# test.libs << 'test/rails'
|
21
|
-
# test.test_files = FileList['test/rails4.2/*_test.rb']
|
22
|
-
# test.verbose = true
|
23
|
-
# end
|
24
|
-
|
25
|
-
# rails_task = Rake::Task["rails"]
|
26
|
-
# test_task = Rake::Task["test"]
|
27
|
-
# default_task.enhance { test_task.invoke }
|
28
|
-
# default_task.enhance { rails_task.invoke }
|
data/TODO.md
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# 4.0
|
2
|
-
|
3
|
-
* Add tests for with_assets config
|
4
|
-
|
5
|
-
|
6
|
-
* Get rid of the annoying `ActionController` dependency that needs to be passed into each cell. We only need it for "contextual links", when people wanna link to the same page. Make them pass in a URL generator object as a normal argument instead.
|
7
|
-
* Generated cells will be view models per default.
|
8
|
-
* Introduce Composition as in Reform, Representable, etc, when passing in a hash.
|
9
|
-
```ruby
|
10
|
-
include Composition
|
11
|
-
property :id, on: :comment
|
12
|
-
```
|
data/benchmarks/class_builder.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'bundler/setup'
|
2
|
-
require 'benchmark/ips'
|
3
|
-
require "cells"
|
4
|
-
require 'cell/view_model'
|
5
|
-
|
6
|
-
class ACell < Cell::ViewModel
|
7
|
-
def show
|
8
|
-
""
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
class ACellWithBuilder < Cell::ViewModel
|
13
|
-
include Cell::Builder
|
14
|
-
|
15
|
-
def show
|
16
|
-
""
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Benchmark.ips do |x|
|
21
|
-
x.report("ACell") { ACell.().() }
|
22
|
-
x.report("ACellWithBuilder") { ACellWithBuilder.().() }
|
23
|
-
x.compare!
|
24
|
-
end
|
25
|
-
|
26
|
-
__END__
|
27
|
-
|
28
|
-
Calculating -------------------------------------
|
29
|
-
ACell 25.710k i/100ms
|
30
|
-
ACellWithBuilder 19.948k i/100ms
|
31
|
-
-------------------------------------------------
|
32
|
-
ACell 419.631k (± 5.0%) i/s - 2.108M
|
33
|
-
ACellWithBuilder 291.924k (± 5.7%) i/s - 1.476M
|
34
|
-
|
35
|
-
Comparison:
|
36
|
-
ACell: 419630.8 i/s
|
37
|
-
ACellWithBuilder: 291923.5 i/s - 1.44x slower
|
data/benchmarks/collection.rb
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
require 'benchmark'
|
3
|
-
require 'benchmark/ips'
|
4
|
-
|
5
|
-
Song = Struct.new(:title)
|
6
|
-
|
7
|
-
|
8
|
-
class SongCell < Cell::ViewModel
|
9
|
-
self.view_paths = ['test/fixtures']
|
10
|
-
property :title
|
11
|
-
|
12
|
-
def show
|
13
|
-
render
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
ary = 1000.times.collect { |i| Song.new(i) }
|
18
|
-
|
19
|
-
Benchmark.ips do |x|
|
20
|
-
x.report("collection, call") { SongCell.(collection: ary).() }
|
21
|
-
x.report("collection, join") { SongCell.(collection: ary).join { |cell, i| cell.() } }
|
22
|
-
# x.report("collection, joinstr") { SongCell.(collection: ary).joinstr { |cell, i| cell.() } }
|
23
|
-
# x.report("collection, joincollect") { SongCell.(collection: ary).joincollect { |cell, i| cell.() } }
|
24
|
-
# x.report("ACellWithBuilder") { ACellWithBuilder.().() }
|
25
|
-
x.compare!
|
26
|
-
end
|
27
|
-
|
28
|
-
__END__
|
29
|
-
|
30
|
-
Calculating -------------------------------------
|
31
|
-
collection, call 3.000 i/100ms
|
32
|
-
collection, join 3.000 i/100ms
|
33
|
-
-------------------------------------------------
|
34
|
-
collection, call 33.403 (± 3.0%) i/s - 168.000
|
35
|
-
collection, join 33.248 (± 3.0%) i/s - 168.000
|
36
|
-
|
37
|
-
Comparison:
|
38
|
-
collection, call: 33.4 i/s
|
39
|
-
collection, join: 33.2 i/s - 1.00x slower
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
Comparison:
|
44
|
-
collection, join: 32.8 i/s
|
45
|
-
collection, call: 32.6 i/s - 1.01x slower
|
46
|
-
collection, joinstr: 32.6 i/s - 1.01x slower
|
47
|
-
collection, joincollect: 32.4 i/s - 1.01x slower # each_with_index.collect.join
|