dry-view 0.5.1 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +143 -18
  3. data/LICENSE +20 -0
  4. data/README.md +22 -14
  5. data/dry-view.gemspec +29 -21
  6. data/lib/dry-view.rb +3 -1
  7. data/lib/dry/view.rb +514 -2
  8. data/lib/dry/view/context.rb +80 -0
  9. data/lib/dry/view/decorated_attributes.rb +82 -0
  10. data/lib/dry/view/errors.rb +29 -0
  11. data/lib/dry/view/exposure.rb +35 -14
  12. data/lib/dry/view/exposures.rb +18 -6
  13. data/lib/dry/view/part.rb +166 -53
  14. data/lib/dry/view/part_builder.rb +140 -0
  15. data/lib/dry/view/path.rb +35 -7
  16. data/lib/dry/view/render_environment.rb +62 -0
  17. data/lib/dry/view/render_environment_missing.rb +44 -0
  18. data/lib/dry/view/rendered.rb +55 -0
  19. data/lib/dry/view/renderer.rb +36 -29
  20. data/lib/dry/view/scope.rb +160 -14
  21. data/lib/dry/view/scope_builder.rb +98 -0
  22. data/lib/dry/view/tilt.rb +78 -0
  23. data/lib/dry/view/tilt/erb.rb +26 -0
  24. data/lib/dry/view/tilt/erbse.rb +21 -0
  25. data/lib/dry/view/tilt/haml.rb +26 -0
  26. data/lib/dry/view/version.rb +5 -2
  27. metadata +78 -115
  28. data/.gitignore +0 -26
  29. data/.rspec +0 -2
  30. data/.travis.yml +0 -23
  31. data/CONTRIBUTING.md +0 -29
  32. data/Gemfile +0 -22
  33. data/LICENSE.md +0 -10
  34. data/Rakefile +0 -6
  35. data/benchmarks/templates/button.html.erb +0 -1
  36. data/benchmarks/view.rb +0 -24
  37. data/bin/console +0 -7
  38. data/lib/dry/view/controller.rb +0 -155
  39. data/lib/dry/view/decorator.rb +0 -45
  40. data/lib/dry/view/missing_renderer.rb +0 -15
  41. data/spec/fixtures/templates/_hello.html.slim +0 -1
  42. data/spec/fixtures/templates/decorated_parts.html.slim +0 -4
  43. data/spec/fixtures/templates/edit.html.slim +0 -11
  44. data/spec/fixtures/templates/empty.html.slim +0 -1
  45. data/spec/fixtures/templates/greeting.html.slim +0 -2
  46. data/spec/fixtures/templates/hello.html.slim +0 -1
  47. data/spec/fixtures/templates/layouts/app.html.slim +0 -6
  48. data/spec/fixtures/templates/layouts/app.txt.erb +0 -3
  49. data/spec/fixtures/templates/parts_with_args.html.slim +0 -3
  50. data/spec/fixtures/templates/parts_with_args/_box.html.slim +0 -3
  51. data/spec/fixtures/templates/shared/_index_table.html.slim +0 -2
  52. data/spec/fixtures/templates/shared/_shared_hello.html.slim +0 -1
  53. data/spec/fixtures/templates/tasks.html.slim +0 -3
  54. data/spec/fixtures/templates/user.html.slim +0 -2
  55. data/spec/fixtures/templates/users.html.slim +0 -5
  56. data/spec/fixtures/templates/users.txt.erb +0 -3
  57. data/spec/fixtures/templates/users/_row.html.slim +0 -2
  58. data/spec/fixtures/templates/users/_tbody.html.slim +0 -5
  59. data/spec/fixtures/templates/users_with_count.html.slim +0 -5
  60. data/spec/fixtures/templates/users_with_count_inherit.html.slim +0 -6
  61. data/spec/fixtures/templates_override/_hello.html.slim +0 -1
  62. data/spec/fixtures/templates_override/users.html.slim +0 -5
  63. data/spec/integration/decorator_spec.rb +0 -80
  64. data/spec/integration/exposures_spec.rb +0 -392
  65. data/spec/integration/part/decorated_attributes_spec.rb +0 -157
  66. data/spec/integration/view_spec.rb +0 -133
  67. data/spec/spec_helper.rb +0 -46
  68. data/spec/unit/controller_spec.rb +0 -37
  69. data/spec/unit/decorator_spec.rb +0 -61
  70. data/spec/unit/exposure_spec.rb +0 -227
  71. data/spec/unit/exposures_spec.rb +0 -103
  72. data/spec/unit/part_spec.rb +0 -90
  73. data/spec/unit/renderer_spec.rb +0 -57
  74. data/spec/unit/scope_spec.rb +0 -53
@@ -1,5 +1,8 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Dry
2
- module View
3
- VERSION = '0.5.1'.freeze
4
+ class View
5
+ # @api private
6
+ VERSION = "0.7.1"
4
7
  end
5
8
  end
metadata CHANGED
@@ -1,46 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dry-view
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
- - Piotr Solnica
8
7
  - Tim Riley
8
+ - Piotr Solnica
9
9
  autorequire:
10
- bindir: exe
10
+ bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-19 00:00:00.000000000 Z
12
+ date: 2021-02-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: tilt
15
+ name: concurrent-ruby
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '2.0'
20
+ version: '1.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '2.0'
27
+ version: '1.0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: dry-configurable
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.1'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '0.1'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: dry-core
30
44
  requirement: !ruby/object:Gem::Requirement
31
45
  requirements:
32
46
  - - "~>"
33
47
  - !ruby/object:Gem::Version
34
- version: '0.2'
48
+ version: '0.5'
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: '0.5'
35
52
  type: :runtime
36
53
  prerelease: false
37
54
  version_requirements: !ruby/object:Gem::Requirement
38
55
  requirements:
39
56
  - - "~>"
40
57
  - !ruby/object:Gem::Version
41
- version: '0.2'
58
+ version: '0.5'
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0.5'
42
62
  - !ruby/object:Gem::Dependency
43
- name: dry-configurable
63
+ name: dry-inflector
44
64
  requirement: !ruby/object:Gem::Requirement
45
65
  requirements:
46
66
  - - "~>"
@@ -54,132 +74,109 @@ dependencies:
54
74
  - !ruby/object:Gem::Version
55
75
  version: '0.1'
56
76
  - !ruby/object:Gem::Dependency
57
- name: dry-equalizer
77
+ name: tilt
58
78
  requirement: !ruby/object:Gem::Requirement
59
79
  requirements:
60
80
  - - "~>"
61
81
  - !ruby/object:Gem::Version
62
- version: '0.2'
82
+ version: '2.0'
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: 2.0.6
63
86
  type: :runtime
64
87
  prerelease: false
65
88
  version_requirements: !ruby/object:Gem::Requirement
66
89
  requirements:
67
90
  - - "~>"
68
91
  - !ruby/object:Gem::Version
69
- version: '0.2'
92
+ version: '2.0'
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: 2.0.6
70
96
  - !ruby/object:Gem::Dependency
71
97
  name: bundler
72
98
  requirement: !ruby/object:Gem::Requirement
73
99
  requirements:
74
- - - "~>"
100
+ - - ">="
75
101
  - !ruby/object:Gem::Version
76
- version: '1.7'
102
+ version: '0'
77
103
  type: :development
78
104
  prerelease: false
79
105
  version_requirements: !ruby/object:Gem::Requirement
80
106
  requirements:
81
- - - "~>"
107
+ - - ">="
82
108
  - !ruby/object:Gem::Version
83
- version: '1.7'
109
+ version: '0'
84
110
  - !ruby/object:Gem::Dependency
85
111
  name: rake
86
112
  requirement: !ruby/object:Gem::Requirement
87
113
  requirements:
88
- - - "~>"
114
+ - - ">="
89
115
  - !ruby/object:Gem::Version
90
- version: '10.0'
116
+ version: '0'
91
117
  type: :development
92
118
  prerelease: false
93
119
  version_requirements: !ruby/object:Gem::Requirement
94
120
  requirements:
95
- - - "~>"
121
+ - - ">="
96
122
  - !ruby/object:Gem::Version
97
- version: '10.0'
123
+ version: '0'
98
124
  - !ruby/object:Gem::Dependency
99
125
  name: rspec
100
126
  requirement: !ruby/object:Gem::Requirement
101
127
  requirements:
102
- - - "~>"
128
+ - - ">="
103
129
  - !ruby/object:Gem::Version
104
- version: '3.1'
130
+ version: '0'
105
131
  type: :development
106
132
  prerelease: false
107
133
  version_requirements: !ruby/object:Gem::Requirement
108
134
  requirements:
109
- - - "~>"
135
+ - - ">="
110
136
  - !ruby/object:Gem::Version
111
- version: '3.1'
112
- description: Functional view rendering system
137
+ version: '0'
138
+ description: A complete, standalone view rendering system that gives you everything
139
+ you need to write well-factored view code
113
140
  email:
114
- - piotr.solnica@gmail.com
115
141
  - tim@icelab.com.au
142
+ - piotr.solnica@gmail.com
116
143
  executables: []
117
144
  extensions: []
118
145
  extra_rdoc_files: []
119
146
  files:
120
- - ".gitignore"
121
- - ".rspec"
122
- - ".travis.yml"
123
147
  - CHANGELOG.md
124
- - CONTRIBUTING.md
125
- - Gemfile
126
- - LICENSE.md
148
+ - LICENSE
127
149
  - README.md
128
- - Rakefile
129
- - benchmarks/templates/button.html.erb
130
- - benchmarks/view.rb
131
- - bin/console
132
150
  - dry-view.gemspec
133
151
  - lib/dry-view.rb
134
152
  - lib/dry/view.rb
135
- - lib/dry/view/controller.rb
136
- - lib/dry/view/decorator.rb
153
+ - lib/dry/view/context.rb
154
+ - lib/dry/view/decorated_attributes.rb
155
+ - lib/dry/view/errors.rb
137
156
  - lib/dry/view/exposure.rb
138
157
  - lib/dry/view/exposures.rb
139
- - lib/dry/view/missing_renderer.rb
140
158
  - lib/dry/view/part.rb
159
+ - lib/dry/view/part_builder.rb
141
160
  - lib/dry/view/path.rb
161
+ - lib/dry/view/render_environment.rb
162
+ - lib/dry/view/render_environment_missing.rb
163
+ - lib/dry/view/rendered.rb
142
164
  - lib/dry/view/renderer.rb
143
165
  - lib/dry/view/scope.rb
166
+ - lib/dry/view/scope_builder.rb
167
+ - lib/dry/view/tilt.rb
168
+ - lib/dry/view/tilt/erb.rb
169
+ - lib/dry/view/tilt/erbse.rb
170
+ - lib/dry/view/tilt/haml.rb
144
171
  - lib/dry/view/version.rb
145
- - spec/fixtures/templates/_hello.html.slim
146
- - spec/fixtures/templates/decorated_parts.html.slim
147
- - spec/fixtures/templates/edit.html.slim
148
- - spec/fixtures/templates/empty.html.slim
149
- - spec/fixtures/templates/greeting.html.slim
150
- - spec/fixtures/templates/hello.html.slim
151
- - spec/fixtures/templates/layouts/app.html.slim
152
- - spec/fixtures/templates/layouts/app.txt.erb
153
- - spec/fixtures/templates/parts_with_args.html.slim
154
- - spec/fixtures/templates/parts_with_args/_box.html.slim
155
- - spec/fixtures/templates/shared/_index_table.html.slim
156
- - spec/fixtures/templates/shared/_shared_hello.html.slim
157
- - spec/fixtures/templates/tasks.html.slim
158
- - spec/fixtures/templates/user.html.slim
159
- - spec/fixtures/templates/users.html.slim
160
- - spec/fixtures/templates/users.txt.erb
161
- - spec/fixtures/templates/users/_row.html.slim
162
- - spec/fixtures/templates/users/_tbody.html.slim
163
- - spec/fixtures/templates/users_with_count.html.slim
164
- - spec/fixtures/templates/users_with_count_inherit.html.slim
165
- - spec/fixtures/templates_override/_hello.html.slim
166
- - spec/fixtures/templates_override/users.html.slim
167
- - spec/integration/decorator_spec.rb
168
- - spec/integration/exposures_spec.rb
169
- - spec/integration/part/decorated_attributes_spec.rb
170
- - spec/integration/view_spec.rb
171
- - spec/spec_helper.rb
172
- - spec/unit/controller_spec.rb
173
- - spec/unit/decorator_spec.rb
174
- - spec/unit/exposure_spec.rb
175
- - spec/unit/exposures_spec.rb
176
- - spec/unit/part_spec.rb
177
- - spec/unit/renderer_spec.rb
178
- - spec/unit/scope_spec.rb
179
- homepage: https://github.com/dry-rb/dry-view
172
+ homepage: https://dry-rb.org/gems/dry-view
180
173
  licenses:
181
174
  - MIT
182
- metadata: {}
175
+ metadata:
176
+ allowed_push_host: https://rubygems.org
177
+ changelog_uri: https://github.com/dry-rb/dry-view/blob/master/CHANGELOG.md
178
+ source_code_uri: https://github.com/dry-rb/dry-view
179
+ bug_tracker_uri: https://github.com/dry-rb/dry-view/issues
183
180
  post_install_message:
184
181
  rdoc_options: []
185
182
  require_paths:
@@ -188,50 +185,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
185
  requirements:
189
186
  - - ">="
190
187
  - !ruby/object:Gem::Version
191
- version: 2.2.0
188
+ version: 2.5.0
192
189
  required_rubygems_version: !ruby/object:Gem::Requirement
193
190
  requirements:
194
191
  - - ">="
195
192
  - !ruby/object:Gem::Version
196
193
  version: '0'
197
194
  requirements: []
198
- rubyforge_project:
199
- rubygems_version: 2.7.5
195
+ rubygems_version: 3.1.4
200
196
  signing_key:
201
197
  specification_version: 4
202
- summary: Functional view rendering system
203
- test_files:
204
- - spec/fixtures/templates/_hello.html.slim
205
- - spec/fixtures/templates/decorated_parts.html.slim
206
- - spec/fixtures/templates/edit.html.slim
207
- - spec/fixtures/templates/empty.html.slim
208
- - spec/fixtures/templates/greeting.html.slim
209
- - spec/fixtures/templates/hello.html.slim
210
- - spec/fixtures/templates/layouts/app.html.slim
211
- - spec/fixtures/templates/layouts/app.txt.erb
212
- - spec/fixtures/templates/parts_with_args.html.slim
213
- - spec/fixtures/templates/parts_with_args/_box.html.slim
214
- - spec/fixtures/templates/shared/_index_table.html.slim
215
- - spec/fixtures/templates/shared/_shared_hello.html.slim
216
- - spec/fixtures/templates/tasks.html.slim
217
- - spec/fixtures/templates/user.html.slim
218
- - spec/fixtures/templates/users.html.slim
219
- - spec/fixtures/templates/users.txt.erb
220
- - spec/fixtures/templates/users/_row.html.slim
221
- - spec/fixtures/templates/users/_tbody.html.slim
222
- - spec/fixtures/templates/users_with_count.html.slim
223
- - spec/fixtures/templates/users_with_count_inherit.html.slim
224
- - spec/fixtures/templates_override/_hello.html.slim
225
- - spec/fixtures/templates_override/users.html.slim
226
- - spec/integration/decorator_spec.rb
227
- - spec/integration/exposures_spec.rb
228
- - spec/integration/part/decorated_attributes_spec.rb
229
- - spec/integration/view_spec.rb
230
- - spec/spec_helper.rb
231
- - spec/unit/controller_spec.rb
232
- - spec/unit/decorator_spec.rb
233
- - spec/unit/exposure_spec.rb
234
- - spec/unit/exposures_spec.rb
235
- - spec/unit/part_spec.rb
236
- - spec/unit/renderer_spec.rb
237
- - spec/unit/scope_spec.rb
198
+ summary: A complete, standalone view rendering system that gives you everything you
199
+ need to write well-factored view code
200
+ test_files: []
data/.gitignore DELETED
@@ -1,26 +0,0 @@
1
- *.gem
2
- *.rbc
3
- /.config
4
- /coverage/
5
- /InstalledFiles
6
- /pkg/
7
- /spec/reports/
8
- /test/tmp/
9
- /test/version_tmp/
10
- /tmp/
11
-
12
- ## Documentation cache and generated files:
13
- /.yardoc/
14
- /_yardoc/
15
- /doc/
16
- /rdoc/
17
-
18
- ## Environment normalisation:
19
- /.bundle/
20
- /lib/bundler/man/
21
-
22
- # For a library or gem, you might want to ignore these files since the code is
23
- # intended to run in multiple environments; otherwise, check them in:
24
- Gemfile.lock
25
- .ruby-version
26
- .rvmrc
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/.travis.yml DELETED
@@ -1,23 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- bundler_args: --without tools benchmarks
4
- before_install:
5
- - gem update --system
6
- script:
7
- - bundle exec rake
8
- after_success:
9
- # Send coverage report from the job #1 == current MRI release
10
- - '[ "${TRAVIS_JOB_NUMBER#*.}" = "1" ] && [ "$TRAVIS_BRANCH" = "master" ] && bundle exec codeclimate-test-reporter'
11
- rvm:
12
- - 2.5.0
13
- - 2.4.2
14
- - 2.3.6
15
- - jruby-9.1.10.0
16
- notifications:
17
- email: false
18
- webhooks:
19
- urls:
20
- - https://webhooks.gitter.im/e/19098b4253a72c9796db
21
- on_success: change # options: [always|never|change] default: always
22
- on_failure: always # options: [always|never|change] default: always
23
- on_start: false # default: false
data/CONTRIBUTING.md DELETED
@@ -1,29 +0,0 @@
1
- # Issue Guidelines
2
-
3
- ## Reporting bugs
4
-
5
- If you found a bug, report an issue and describe what's the expected behavior versus what actually happens. If the bug causes a crash, attach a full backtrace. If possible, a reproduction script showing the problem is highly appreciated.
6
-
7
- ## Reporting feature requests
8
-
9
- Report a feature request **only after discussing it first on [discourse.dry-rb.org](https://discourse.dry-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
10
-
11
- ## Reporting questions, support requests, ideas, concerns etc.
12
-
13
- **PLEASE DON'T** - use [discourse.dry-rb.org](http://discourse.dry-rb.org) instead.
14
-
15
- # Pull Request Guidelines
16
-
17
- A Pull Request will only be accepted if it addresses a specific issue that was reported previously, or fixes typos, mistakes in documentation etc.
18
-
19
- Other requirements:
20
-
21
- 1) Do not open a pull request if you can't provide tests along with it. If you have problems writing tests, ask for help in the related issue.
22
- 2) Follow the style conventions of the surrounding code. In most cases, this is standard ruby style.
23
- 3) Add API documentation if it's a new feature
24
- 4) Update API documentation if it changes an existing feature
25
- 5) Bonus points for sending a PR to [github.com/dry-rb/dry-rb.org](github.com/dry-rb/dry-rb.org) which updates user documentation and guides
26
-
27
- # Asking for help
28
-
29
- If these guidelines aren't helpful, and you're stuck, please post a message on [discourse.dry-rb.org](https://discourse.dry-rb.org).
data/Gemfile DELETED
@@ -1,22 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- gem 'inflecto'
6
-
7
- group :tools do
8
- gem 'pry-byebug', platform: :mri
9
- end
10
-
11
- group :test do
12
- gem 'rack', '>= 1.0.0', '<= 2.0.0'
13
- gem 'slim'
14
-
15
- gem 'simplecov'
16
- gem 'codeclimate-test-reporter'
17
- end
18
-
19
- group :benchmarks do
20
- gem 'benchmark-ips'
21
- gem 'actionview'
22
- end
data/LICENSE.md DELETED
@@ -1,10 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Piotr Solnica
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
6
- furnished to do so, subject to the following conditions:
7
-
8
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
9
-
10
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
3
- require "rspec/core/rake_task"
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: [:spec]