granite-form 0.1.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CODEOWNERS +1 -2
- data/.github/workflows/{ci.yml → ruby.yml} +22 -4
- data/.rubocop.yml +1 -1
- data/.rubocop_todo.yml +3 -3
- data/Appraisals +1 -2
- data/CHANGELOG.md +14 -0
- data/README.md +0 -2
- data/Rakefile +4 -0
- data/docker-compose.yml +14 -0
- data/gemfiles/rails.5.0.gemfile +0 -1
- data/gemfiles/rails.5.1.gemfile +0 -1
- data/gemfiles/rails.5.2.gemfile +0 -1
- data/granite-form.gemspec +16 -15
- data/lib/granite/form/active_record/associations.rb +1 -1
- data/lib/granite/form/base.rb +1 -2
- data/lib/granite/form/config.rb +10 -10
- data/lib/granite/form/errors.rb +0 -15
- data/lib/granite/form/model/associations/base.rb +0 -4
- data/lib/granite/form/model/associations/collection/embedded.rb +2 -1
- data/lib/granite/form/model/associations/collection/proxy.rb +1 -1
- data/lib/granite/form/model/associations/embeds_any.rb +7 -0
- data/lib/granite/form/model/associations/embeds_many.rb +9 -58
- data/lib/granite/form/model/associations/embeds_one.rb +7 -36
- data/lib/granite/form/model/associations/nested_attributes.rb +8 -8
- data/lib/granite/form/model/associations/persistence_adapters/active_record.rb +0 -4
- data/lib/granite/form/model/associations/persistence_adapters/base.rb +0 -4
- data/lib/granite/form/model/associations/references_many.rb +0 -32
- data/lib/granite/form/model/associations/references_one.rb +0 -28
- data/lib/granite/form/model/associations/reflections/embeds_any.rb +1 -1
- data/lib/granite/form/model/associations/reflections/references_any.rb +0 -4
- data/lib/granite/form/model/associations/reflections/references_many.rb +3 -1
- data/lib/granite/form/model/associations/reflections/references_one.rb +3 -3
- data/lib/granite/form/model/associations/reflections/singular.rb +0 -8
- data/lib/granite/form/model/associations.rb +0 -6
- data/lib/granite/form/model/attributes/attribute.rb +1 -1
- data/lib/granite/form/model/attributes/base.rb +14 -17
- data/lib/granite/form/model/attributes/collection.rb +1 -1
- data/lib/granite/form/model/attributes/dictionary.rb +1 -1
- data/lib/granite/form/model/attributes/localized.rb +1 -1
- data/lib/granite/form/model/attributes/reference_many.rb +1 -1
- data/lib/granite/form/model/attributes/reference_one.rb +1 -9
- data/lib/granite/form/model/attributes/reflections/attribute.rb +0 -6
- data/lib/granite/form/model/attributes/reflections/base.rb +9 -12
- data/lib/granite/form/model/attributes/reflections/reference_one.rb +0 -10
- data/lib/granite/form/model/persistence.rb +1 -19
- data/lib/granite/form/model/validations/nested.rb +1 -1
- data/lib/granite/form/model.rb +0 -2
- data/lib/granite/form/types/active_support/time_zone.rb +22 -0
- data/lib/granite/form/types/array.rb +17 -0
- data/lib/granite/form/types/big_decimal.rb +15 -0
- data/lib/granite/form/types/boolean.rb +38 -0
- data/lib/granite/form/types/date.rb +15 -0
- data/lib/granite/form/types/date_time.rb +15 -0
- data/lib/granite/form/types/float.rb +15 -0
- data/lib/granite/form/types/hash_with_action_controller_parameters.rb +18 -0
- data/lib/granite/form/types/integer.rb +13 -0
- data/lib/granite/form/types/object.rb +30 -0
- data/lib/granite/form/types/string.rb +13 -0
- data/lib/granite/form/types/time.rb +15 -0
- data/lib/granite/form/types/uuid.rb +22 -0
- data/lib/granite/form/types.rb +15 -0
- data/lib/granite/form/version.rb +1 -1
- data/lib/granite/form.rb +19 -118
- data/spec/{lib/granite → granite}/form/active_record/associations_spec.rb +16 -18
- data/spec/{lib/granite → granite}/form/active_record/nested_attributes_spec.rb +0 -1
- data/spec/{lib/granite → granite}/form/config_spec.rb +22 -10
- data/spec/granite/form/extensions_spec.rb +12 -0
- data/spec/{lib/granite → granite}/form/model/associations/embeds_many_spec.rb +29 -305
- data/spec/{lib/granite → granite}/form/model/associations/embeds_one_spec.rb +27 -212
- data/spec/granite/form/model/associations/nested_attributes_spec.rb +23 -0
- data/spec/{lib/granite → granite}/form/model/associations/persistence_adapters/active_record_spec.rb +0 -0
- data/spec/granite/form/model/associations/references_many_spec.rb +251 -0
- data/spec/granite/form/model/associations/references_one_spec.rb +173 -0
- data/spec/{lib/granite → granite}/form/model/associations/reflections/embeds_any_spec.rb +1 -2
- data/spec/{lib/granite → granite}/form/model/associations/reflections/embeds_many_spec.rb +18 -26
- data/spec/{lib/granite → granite}/form/model/associations/reflections/embeds_one_spec.rb +16 -23
- data/spec/{lib/granite → granite}/form/model/associations/reflections/references_many_spec.rb +1 -1
- data/spec/{lib/granite → granite}/form/model/associations/reflections/references_one_spec.rb +1 -22
- data/spec/{lib/granite → granite}/form/model/associations/validations_spec.rb +0 -3
- data/spec/{lib/granite → granite}/form/model/associations_spec.rb +3 -24
- data/spec/{lib/granite → granite}/form/model/attributes/attribute_spec.rb +4 -46
- data/spec/{lib/granite → granite}/form/model/attributes/base_spec.rb +11 -2
- data/spec/{lib/granite → granite}/form/model/attributes/collection_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/attributes/dictionary_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/attributes/localized_spec.rb +1 -1
- data/spec/{lib/granite → granite}/form/model/attributes/reflections/attribute_spec.rb +0 -12
- data/spec/{lib/granite → granite}/form/model/attributes/reflections/base_spec.rb +1 -1
- data/spec/{lib/granite → granite}/form/model/attributes/reflections/collection_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/attributes/reflections/dictionary_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/attributes/reflections/localized_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/attributes/reflections/represents_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/attributes/represents_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/attributes_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/conventions_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/dirty_spec.rb +1 -1
- data/spec/{lib/granite → granite}/form/model/persistence_spec.rb +0 -2
- data/spec/{lib/granite → granite}/form/model/primary_spec.rb +1 -1
- data/spec/{lib/granite → granite}/form/model/representation_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/scopes_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model/validations/associated_spec.rb +2 -4
- data/spec/{lib/granite → granite}/form/model/validations/nested_spec.rb +57 -15
- data/spec/{lib/granite → granite}/form/model/validations_spec.rb +0 -0
- data/spec/{lib/granite → granite}/form/model_spec.rb +0 -0
- data/spec/granite/form/types/active_support/time_zone_spec.rb +24 -0
- data/spec/granite/form/types/array_spec.rb +13 -0
- data/spec/granite/form/types/big_decimal_spec.rb +19 -0
- data/spec/granite/form/types/boolean_spec.rb +21 -0
- data/spec/granite/form/types/date_spec.rb +18 -0
- data/spec/granite/form/types/date_time_spec.rb +20 -0
- data/spec/granite/form/types/float_spec.rb +19 -0
- data/spec/granite/form/types/hash_with_action_controller_parameters_spec.rb +22 -0
- data/spec/granite/form/types/integer_spec.rb +18 -0
- data/spec/granite/form/types/object_spec.rb +40 -0
- data/spec/granite/form/types/string_spec.rb +13 -0
- data/spec/granite/form/types/time_spec.rb +31 -0
- data/spec/granite/form/types/uuid_spec.rb +21 -0
- data/spec/{lib/granite → granite}/form_spec.rb +0 -0
- data/spec/spec_helper.rb +0 -15
- data/spec/support/active_record.rb +20 -0
- data/spec/{shared → support/shared}/nested_attribute_examples.rb +3 -21
- data/spec/support/shared/type_examples.rb +7 -0
- metadata +173 -123
- data/.github/workflows/main.yml +0 -29
- data/gemfiles/rails.4.2.gemfile +0 -15
- data/lib/granite/form/model/callbacks.rb +0 -72
- data/lib/granite/form/model/lifecycle.rb +0 -309
- data/spec/lib/granite/form/model/associations/nested_attributes_spec.rb +0 -119
- data/spec/lib/granite/form/model/associations/references_many_spec.rb +0 -572
- data/spec/lib/granite/form/model/associations/references_one_spec.rb +0 -445
- data/spec/lib/granite/form/model/callbacks_spec.rb +0 -337
- data/spec/lib/granite/form/model/lifecycle_spec.rb +0 -356
- data/spec/lib/granite/form/model/typecasting_spec.rb +0 -193
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: granite-form
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- Toptal Engineering
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '5.0'
|
20
20
|
type: :development
|
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: '
|
26
|
+
version: '5.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activerecord
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '5.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '5.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: appraisal
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: bump
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,7 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: database_cleaner
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
@@ -81,21 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: pg
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
@@ -109,21 +109,21 @@ dependencies:
|
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
112
|
+
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 3.7.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 3.7.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rspec-its
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - ">="
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rubocop
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - '='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.52.1
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - '='
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.52.1
|
139
153
|
- !ruby/object:Gem::Dependency
|
140
154
|
name: uuidtools
|
141
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,28 +170,28 @@ dependencies:
|
|
156
170
|
requirements:
|
157
171
|
- - ">="
|
158
172
|
- !ruby/object:Gem::Version
|
159
|
-
version: '
|
173
|
+
version: '5.0'
|
160
174
|
type: :runtime
|
161
175
|
prerelease: false
|
162
176
|
version_requirements: !ruby/object:Gem::Requirement
|
163
177
|
requirements:
|
164
178
|
- - ">="
|
165
179
|
- !ruby/object:Gem::Version
|
166
|
-
version: '
|
180
|
+
version: '5.0'
|
167
181
|
- !ruby/object:Gem::Dependency
|
168
182
|
name: activesupport
|
169
183
|
requirement: !ruby/object:Gem::Requirement
|
170
184
|
requirements:
|
171
185
|
- - ">="
|
172
186
|
- !ruby/object:Gem::Version
|
173
|
-
version: '
|
187
|
+
version: '5.0'
|
174
188
|
type: :runtime
|
175
189
|
prerelease: false
|
176
190
|
version_requirements: !ruby/object:Gem::Requirement
|
177
191
|
requirements:
|
178
192
|
- - ">="
|
179
193
|
- !ruby/object:Gem::Version
|
180
|
-
version: '
|
194
|
+
version: '5.0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: tzinfo
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,16 +207,14 @@ dependencies:
|
|
193
207
|
- !ruby/object:Gem::Version
|
194
208
|
version: '0'
|
195
209
|
description: Making object from any hash or hash array
|
196
|
-
email:
|
197
|
-
- kinwizard@gmail.com
|
210
|
+
email:
|
198
211
|
executables: []
|
199
212
|
extensions: []
|
200
213
|
extra_rdoc_files: []
|
201
214
|
files:
|
202
215
|
- ".codeclimate.yml"
|
203
216
|
- ".github/CODEOWNERS"
|
204
|
-
- ".github/workflows/
|
205
|
-
- ".github/workflows/main.yml"
|
217
|
+
- ".github/workflows/ruby.yml"
|
206
218
|
- ".gitignore"
|
207
219
|
- ".rspec"
|
208
220
|
- ".rubocop.yml"
|
@@ -214,7 +226,7 @@ files:
|
|
214
226
|
- LICENSE
|
215
227
|
- README.md
|
216
228
|
- Rakefile
|
217
|
-
-
|
229
|
+
- docker-compose.yml
|
218
230
|
- gemfiles/rails.5.0.gemfile
|
219
231
|
- gemfiles/rails.5.1.gemfile
|
220
232
|
- gemfiles/rails.5.2.gemfile
|
@@ -270,10 +282,8 @@ files:
|
|
270
282
|
- lib/granite/form/model/attributes/reflections/reference_one.rb
|
271
283
|
- lib/granite/form/model/attributes/reflections/represents.rb
|
272
284
|
- lib/granite/form/model/attributes/represents.rb
|
273
|
-
- lib/granite/form/model/callbacks.rb
|
274
285
|
- lib/granite/form/model/conventions.rb
|
275
286
|
- lib/granite/form/model/dirty.rb
|
276
|
-
- lib/granite/form/model/lifecycle.rb
|
277
287
|
- lib/granite/form/model/localization.rb
|
278
288
|
- lib/granite/form/model/persistence.rb
|
279
289
|
- lib/granite/form/model/primary.rb
|
@@ -283,57 +293,84 @@ files:
|
|
283
293
|
- lib/granite/form/model/validations/associated.rb
|
284
294
|
- lib/granite/form/model/validations/nested.rb
|
285
295
|
- lib/granite/form/railtie.rb
|
296
|
+
- lib/granite/form/types.rb
|
297
|
+
- lib/granite/form/types/active_support/time_zone.rb
|
298
|
+
- lib/granite/form/types/array.rb
|
299
|
+
- lib/granite/form/types/big_decimal.rb
|
300
|
+
- lib/granite/form/types/boolean.rb
|
301
|
+
- lib/granite/form/types/date.rb
|
302
|
+
- lib/granite/form/types/date_time.rb
|
303
|
+
- lib/granite/form/types/float.rb
|
304
|
+
- lib/granite/form/types/hash_with_action_controller_parameters.rb
|
305
|
+
- lib/granite/form/types/integer.rb
|
306
|
+
- lib/granite/form/types/object.rb
|
307
|
+
- lib/granite/form/types/string.rb
|
308
|
+
- lib/granite/form/types/time.rb
|
309
|
+
- lib/granite/form/types/uuid.rb
|
286
310
|
- lib/granite/form/undefined_class.rb
|
287
311
|
- lib/granite/form/version.rb
|
288
|
-
- spec/
|
289
|
-
- spec/
|
290
|
-
- spec/
|
291
|
-
- spec/
|
292
|
-
- spec/
|
293
|
-
- spec/
|
294
|
-
- spec/
|
295
|
-
- spec/
|
296
|
-
- spec/
|
297
|
-
- spec/
|
298
|
-
- spec/
|
299
|
-
- spec/
|
300
|
-
- spec/
|
301
|
-
- spec/
|
302
|
-
- spec/
|
303
|
-
- spec/
|
304
|
-
- spec/
|
305
|
-
- spec/
|
306
|
-
- spec/
|
307
|
-
- spec/
|
308
|
-
- spec/
|
309
|
-
- spec/
|
310
|
-
- spec/
|
311
|
-
- spec/
|
312
|
-
- spec/
|
313
|
-
- spec/
|
314
|
-
- spec/
|
315
|
-
- spec/
|
316
|
-
- spec/
|
317
|
-
- spec/
|
318
|
-
- spec/
|
319
|
-
- spec/
|
320
|
-
- spec/
|
321
|
-
- spec/
|
322
|
-
- spec/
|
323
|
-
- spec/
|
324
|
-
- spec/
|
325
|
-
- spec/
|
326
|
-
- spec/
|
327
|
-
- spec/
|
328
|
-
- spec/
|
329
|
-
- spec/
|
330
|
-
- spec/
|
331
|
-
- spec/
|
312
|
+
- spec/granite/form/active_record/associations_spec.rb
|
313
|
+
- spec/granite/form/active_record/nested_attributes_spec.rb
|
314
|
+
- spec/granite/form/config_spec.rb
|
315
|
+
- spec/granite/form/extensions_spec.rb
|
316
|
+
- spec/granite/form/model/associations/embeds_many_spec.rb
|
317
|
+
- spec/granite/form/model/associations/embeds_one_spec.rb
|
318
|
+
- spec/granite/form/model/associations/nested_attributes_spec.rb
|
319
|
+
- spec/granite/form/model/associations/persistence_adapters/active_record_spec.rb
|
320
|
+
- spec/granite/form/model/associations/references_many_spec.rb
|
321
|
+
- spec/granite/form/model/associations/references_one_spec.rb
|
322
|
+
- spec/granite/form/model/associations/reflections/embeds_any_spec.rb
|
323
|
+
- spec/granite/form/model/associations/reflections/embeds_many_spec.rb
|
324
|
+
- spec/granite/form/model/associations/reflections/embeds_one_spec.rb
|
325
|
+
- spec/granite/form/model/associations/reflections/references_many_spec.rb
|
326
|
+
- spec/granite/form/model/associations/reflections/references_one_spec.rb
|
327
|
+
- spec/granite/form/model/associations/validations_spec.rb
|
328
|
+
- spec/granite/form/model/associations_spec.rb
|
329
|
+
- spec/granite/form/model/attributes/attribute_spec.rb
|
330
|
+
- spec/granite/form/model/attributes/base_spec.rb
|
331
|
+
- spec/granite/form/model/attributes/collection_spec.rb
|
332
|
+
- spec/granite/form/model/attributes/dictionary_spec.rb
|
333
|
+
- spec/granite/form/model/attributes/localized_spec.rb
|
334
|
+
- spec/granite/form/model/attributes/reflections/attribute_spec.rb
|
335
|
+
- spec/granite/form/model/attributes/reflections/base_spec.rb
|
336
|
+
- spec/granite/form/model/attributes/reflections/collection_spec.rb
|
337
|
+
- spec/granite/form/model/attributes/reflections/dictionary_spec.rb
|
338
|
+
- spec/granite/form/model/attributes/reflections/localized_spec.rb
|
339
|
+
- spec/granite/form/model/attributes/reflections/represents_spec.rb
|
340
|
+
- spec/granite/form/model/attributes/represents_spec.rb
|
341
|
+
- spec/granite/form/model/attributes_spec.rb
|
342
|
+
- spec/granite/form/model/conventions_spec.rb
|
343
|
+
- spec/granite/form/model/dirty_spec.rb
|
344
|
+
- spec/granite/form/model/persistence_spec.rb
|
345
|
+
- spec/granite/form/model/primary_spec.rb
|
346
|
+
- spec/granite/form/model/representation_spec.rb
|
347
|
+
- spec/granite/form/model/scopes_spec.rb
|
348
|
+
- spec/granite/form/model/validations/associated_spec.rb
|
349
|
+
- spec/granite/form/model/validations/nested_spec.rb
|
350
|
+
- spec/granite/form/model/validations_spec.rb
|
351
|
+
- spec/granite/form/model_spec.rb
|
352
|
+
- spec/granite/form/types/active_support/time_zone_spec.rb
|
353
|
+
- spec/granite/form/types/array_spec.rb
|
354
|
+
- spec/granite/form/types/big_decimal_spec.rb
|
355
|
+
- spec/granite/form/types/boolean_spec.rb
|
356
|
+
- spec/granite/form/types/date_spec.rb
|
357
|
+
- spec/granite/form/types/date_time_spec.rb
|
358
|
+
- spec/granite/form/types/float_spec.rb
|
359
|
+
- spec/granite/form/types/hash_with_action_controller_parameters_spec.rb
|
360
|
+
- spec/granite/form/types/integer_spec.rb
|
361
|
+
- spec/granite/form/types/object_spec.rb
|
362
|
+
- spec/granite/form/types/string_spec.rb
|
363
|
+
- spec/granite/form/types/time_spec.rb
|
364
|
+
- spec/granite/form/types/uuid_spec.rb
|
365
|
+
- spec/granite/form_spec.rb
|
332
366
|
- spec/spec_helper.rb
|
367
|
+
- spec/support/active_record.rb
|
333
368
|
- spec/support/model_helpers.rb
|
334
369
|
- spec/support/muffle_helper.rb
|
370
|
+
- spec/support/shared/nested_attribute_examples.rb
|
371
|
+
- spec/support/shared/type_examples.rb
|
335
372
|
- spec/support/translations.rb
|
336
|
-
homepage:
|
373
|
+
homepage: https://github.com/toptal/granite-form
|
337
374
|
licenses: []
|
338
375
|
metadata: {}
|
339
376
|
post_install_message:
|
@@ -344,63 +381,76 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
344
381
|
requirements:
|
345
382
|
- - ">="
|
346
383
|
- !ruby/object:Gem::Version
|
347
|
-
version:
|
384
|
+
version: 2.4.0
|
348
385
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
349
386
|
requirements:
|
350
387
|
- - ">="
|
351
388
|
- !ruby/object:Gem::Version
|
352
389
|
version: '0'
|
353
390
|
requirements: []
|
354
|
-
rubygems_version: 3.
|
391
|
+
rubygems_version: 3.3.26
|
355
392
|
signing_key:
|
356
393
|
specification_version: 4
|
357
394
|
summary: Working with hashes in AR style
|
358
395
|
test_files:
|
359
|
-
- spec/
|
360
|
-
- spec/
|
361
|
-
- spec/
|
362
|
-
- spec/
|
363
|
-
- spec/
|
364
|
-
- spec/
|
365
|
-
- spec/
|
366
|
-
- spec/
|
367
|
-
- spec/
|
368
|
-
- spec/
|
369
|
-
- spec/
|
370
|
-
- spec/
|
371
|
-
- spec/
|
372
|
-
- spec/
|
373
|
-
- spec/
|
374
|
-
- spec/
|
375
|
-
- spec/
|
376
|
-
- spec/
|
377
|
-
- spec/
|
378
|
-
- spec/
|
379
|
-
- spec/
|
380
|
-
- spec/
|
381
|
-
- spec/
|
382
|
-
- spec/
|
383
|
-
- spec/
|
384
|
-
- spec/
|
385
|
-
- spec/
|
386
|
-
- spec/
|
387
|
-
- spec/
|
388
|
-
- spec/
|
389
|
-
- spec/
|
390
|
-
- spec/
|
391
|
-
- spec/
|
392
|
-
- spec/
|
393
|
-
- spec/
|
394
|
-
- spec/
|
395
|
-
- spec/
|
396
|
-
- spec/
|
397
|
-
- spec/
|
398
|
-
- spec/
|
399
|
-
- spec/
|
400
|
-
- spec/
|
401
|
-
- spec/
|
402
|
-
- spec/
|
396
|
+
- spec/granite/form/active_record/associations_spec.rb
|
397
|
+
- spec/granite/form/active_record/nested_attributes_spec.rb
|
398
|
+
- spec/granite/form/config_spec.rb
|
399
|
+
- spec/granite/form/extensions_spec.rb
|
400
|
+
- spec/granite/form/model/associations/embeds_many_spec.rb
|
401
|
+
- spec/granite/form/model/associations/embeds_one_spec.rb
|
402
|
+
- spec/granite/form/model/associations/nested_attributes_spec.rb
|
403
|
+
- spec/granite/form/model/associations/persistence_adapters/active_record_spec.rb
|
404
|
+
- spec/granite/form/model/associations/references_many_spec.rb
|
405
|
+
- spec/granite/form/model/associations/references_one_spec.rb
|
406
|
+
- spec/granite/form/model/associations/reflections/embeds_any_spec.rb
|
407
|
+
- spec/granite/form/model/associations/reflections/embeds_many_spec.rb
|
408
|
+
- spec/granite/form/model/associations/reflections/embeds_one_spec.rb
|
409
|
+
- spec/granite/form/model/associations/reflections/references_many_spec.rb
|
410
|
+
- spec/granite/form/model/associations/reflections/references_one_spec.rb
|
411
|
+
- spec/granite/form/model/associations/validations_spec.rb
|
412
|
+
- spec/granite/form/model/associations_spec.rb
|
413
|
+
- spec/granite/form/model/attributes/attribute_spec.rb
|
414
|
+
- spec/granite/form/model/attributes/base_spec.rb
|
415
|
+
- spec/granite/form/model/attributes/collection_spec.rb
|
416
|
+
- spec/granite/form/model/attributes/dictionary_spec.rb
|
417
|
+
- spec/granite/form/model/attributes/localized_spec.rb
|
418
|
+
- spec/granite/form/model/attributes/reflections/attribute_spec.rb
|
419
|
+
- spec/granite/form/model/attributes/reflections/base_spec.rb
|
420
|
+
- spec/granite/form/model/attributes/reflections/collection_spec.rb
|
421
|
+
- spec/granite/form/model/attributes/reflections/dictionary_spec.rb
|
422
|
+
- spec/granite/form/model/attributes/reflections/localized_spec.rb
|
423
|
+
- spec/granite/form/model/attributes/reflections/represents_spec.rb
|
424
|
+
- spec/granite/form/model/attributes/represents_spec.rb
|
425
|
+
- spec/granite/form/model/attributes_spec.rb
|
426
|
+
- spec/granite/form/model/conventions_spec.rb
|
427
|
+
- spec/granite/form/model/dirty_spec.rb
|
428
|
+
- spec/granite/form/model/persistence_spec.rb
|
429
|
+
- spec/granite/form/model/primary_spec.rb
|
430
|
+
- spec/granite/form/model/representation_spec.rb
|
431
|
+
- spec/granite/form/model/scopes_spec.rb
|
432
|
+
- spec/granite/form/model/validations/associated_spec.rb
|
433
|
+
- spec/granite/form/model/validations/nested_spec.rb
|
434
|
+
- spec/granite/form/model/validations_spec.rb
|
435
|
+
- spec/granite/form/model_spec.rb
|
436
|
+
- spec/granite/form/types/active_support/time_zone_spec.rb
|
437
|
+
- spec/granite/form/types/array_spec.rb
|
438
|
+
- spec/granite/form/types/big_decimal_spec.rb
|
439
|
+
- spec/granite/form/types/boolean_spec.rb
|
440
|
+
- spec/granite/form/types/date_spec.rb
|
441
|
+
- spec/granite/form/types/date_time_spec.rb
|
442
|
+
- spec/granite/form/types/float_spec.rb
|
443
|
+
- spec/granite/form/types/hash_with_action_controller_parameters_spec.rb
|
444
|
+
- spec/granite/form/types/integer_spec.rb
|
445
|
+
- spec/granite/form/types/object_spec.rb
|
446
|
+
- spec/granite/form/types/string_spec.rb
|
447
|
+
- spec/granite/form/types/time_spec.rb
|
448
|
+
- spec/granite/form/types/uuid_spec.rb
|
449
|
+
- spec/granite/form_spec.rb
|
403
450
|
- spec/spec_helper.rb
|
451
|
+
- spec/support/active_record.rb
|
404
452
|
- spec/support/model_helpers.rb
|
405
453
|
- spec/support/muffle_helper.rb
|
454
|
+
- spec/support/shared/nested_attribute_examples.rb
|
455
|
+
- spec/support/shared/type_examples.rb
|
406
456
|
- spec/support/translations.rb
|
data/.github/workflows/main.yml
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
name: Ruby
|
2
|
-
|
3
|
-
on: [push]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
spec:
|
7
|
-
runs-on: ubuntu-latest
|
8
|
-
name: Run specs in ruby v${{ matrix.ruby }} rails v${{ matrix.rails }}
|
9
|
-
strategy:
|
10
|
-
matrix:
|
11
|
-
ruby: [ '2.6', '2.7', '3.0' ]
|
12
|
-
rails: [ '6.0', '6.1' ]
|
13
|
-
steps:
|
14
|
-
- uses: actions/checkout@v2
|
15
|
-
|
16
|
-
- name: Set up Ruby
|
17
|
-
uses: ruby/setup-ruby@v1
|
18
|
-
with:
|
19
|
-
ruby-version: ${{ matrix.ruby }}
|
20
|
-
|
21
|
-
- name: Install dependencies
|
22
|
-
env:
|
23
|
-
BUNDLE_GEMFILE: gemfiles/rails.${{ matrix.rails }}.gemfile
|
24
|
-
run: bundle install
|
25
|
-
|
26
|
-
- name: Run specs
|
27
|
-
env:
|
28
|
-
BUNDLE_GEMFILE: gemfiles/rails.${{ matrix.rails }}.gemfile
|
29
|
-
run: bundle exec rake spec
|
data/gemfiles/rails.4.2.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "activesupport", "~> 4.2.0"
|
6
|
-
gem "activemodel", "~> 4.2.0"
|
7
|
-
gem "activerecord", "~> 4.2.0"
|
8
|
-
gem "sqlite3", "~> 1.3.6"
|
9
|
-
|
10
|
-
group :test do
|
11
|
-
gem "guard"
|
12
|
-
gem "guard-rspec"
|
13
|
-
end
|
14
|
-
|
15
|
-
gemspec path: "../"
|
@@ -1,72 +0,0 @@
|
|
1
|
-
module Granite
|
2
|
-
module Form
|
3
|
-
module Model
|
4
|
-
# == Callbacks for Granite::Form::Model lifecycle
|
5
|
-
#
|
6
|
-
# Provides ActiveModel callbacks support for lifecycle
|
7
|
-
# actions.
|
8
|
-
#
|
9
|
-
# class Book
|
10
|
-
# include Granite::Form::Model
|
11
|
-
#
|
12
|
-
# attribute :id, Integer
|
13
|
-
# attribute :title, String
|
14
|
-
#
|
15
|
-
# define_save do
|
16
|
-
# REDIS.set(id, attributes.to_json)
|
17
|
-
# end
|
18
|
-
#
|
19
|
-
# define_destroy do
|
20
|
-
# REDIS.del(instance.id)
|
21
|
-
# end
|
22
|
-
#
|
23
|
-
# after_initialize :setup_id
|
24
|
-
# before_save :do_something
|
25
|
-
# around_update do |&block|
|
26
|
-
# ...
|
27
|
-
# block.call
|
28
|
-
# ...
|
29
|
-
# end
|
30
|
-
# after_destroy { ... }
|
31
|
-
# end
|
32
|
-
#
|
33
|
-
module Callbacks
|
34
|
-
extend ActiveSupport::Concern
|
35
|
-
|
36
|
-
included do
|
37
|
-
extend ActiveModel::Callbacks
|
38
|
-
|
39
|
-
include ActiveModel::Validations::Callbacks
|
40
|
-
include Lifecycle
|
41
|
-
prepend PrependMethods
|
42
|
-
|
43
|
-
define_model_callbacks :initialize, only: :after
|
44
|
-
define_model_callbacks :save, :create, :update, :destroy
|
45
|
-
end
|
46
|
-
|
47
|
-
module PrependMethods
|
48
|
-
def initialize(*_)
|
49
|
-
super
|
50
|
-
run_callbacks :initialize
|
51
|
-
end
|
52
|
-
|
53
|
-
def save_object(&block)
|
54
|
-
run_callbacks(:save) { super(&block) }
|
55
|
-
end
|
56
|
-
|
57
|
-
def create_object(&block)
|
58
|
-
run_callbacks(:create) { super(&block) }
|
59
|
-
end
|
60
|
-
|
61
|
-
def update_object(&block)
|
62
|
-
run_callbacks(:update) { super(&block) }
|
63
|
-
end
|
64
|
-
|
65
|
-
def destroy_object(&block)
|
66
|
-
run_callbacks(:destroy) { super(&block) }
|
67
|
-
end
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
end
|