simple_form 5.2.0 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -1
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +3 -4
  5. data/lib/simple_form/components/label_input.rb +1 -1
  6. data/lib/simple_form/form_builder.rb +1 -5
  7. data/lib/simple_form/railtie.rb +4 -0
  8. data/lib/simple_form/version.rb +1 -1
  9. data/lib/simple_form/wrappers/leaf.rb +1 -1
  10. data/lib/simple_form.rb +8 -4
  11. metadata +5 -85
  12. data/test/action_view_extensions/builder_test.rb +0 -634
  13. data/test/action_view_extensions/form_helper_test.rb +0 -172
  14. data/test/components/custom_components_test.rb +0 -62
  15. data/test/components/label_test.rb +0 -352
  16. data/test/form_builder/association_test.rb +0 -252
  17. data/test/form_builder/button_test.rb +0 -48
  18. data/test/form_builder/error_notification_test.rb +0 -80
  19. data/test/form_builder/error_test.rb +0 -281
  20. data/test/form_builder/general_test.rb +0 -539
  21. data/test/form_builder/hint_test.rb +0 -150
  22. data/test/form_builder/input_field_test.rb +0 -195
  23. data/test/form_builder/label_test.rb +0 -136
  24. data/test/form_builder/wrapper_test.rb +0 -378
  25. data/test/generators/simple_form_generator_test.rb +0 -43
  26. data/test/inputs/boolean_input_test.rb +0 -256
  27. data/test/inputs/collection_check_boxes_input_test.rb +0 -323
  28. data/test/inputs/collection_radio_buttons_input_test.rb +0 -446
  29. data/test/inputs/collection_select_input_test.rb +0 -380
  30. data/test/inputs/color_input_test.rb +0 -10
  31. data/test/inputs/country_input_test.rb +0 -36
  32. data/test/inputs/datetime_input_test.rb +0 -176
  33. data/test/inputs/disabled_test.rb +0 -92
  34. data/test/inputs/discovery_test.rb +0 -142
  35. data/test/inputs/file_input_test.rb +0 -17
  36. data/test/inputs/general_test.rb +0 -133
  37. data/test/inputs/grouped_collection_select_input_test.rb +0 -196
  38. data/test/inputs/hidden_input_test.rb +0 -32
  39. data/test/inputs/numeric_input_test.rb +0 -177
  40. data/test/inputs/readonly_test.rb +0 -102
  41. data/test/inputs/required_test.rb +0 -158
  42. data/test/inputs/rich_text_area_input_test.rb +0 -15
  43. data/test/inputs/string_input_test.rb +0 -158
  44. data/test/inputs/text_input_test.rb +0 -37
  45. data/test/inputs/time_zone_input_test.rb +0 -36
  46. data/test/simple_form_test.rb +0 -18
  47. data/test/support/discovery_inputs.rb +0 -65
  48. data/test/support/misc_helpers.rb +0 -274
  49. data/test/support/mock_controller.rb +0 -30
  50. data/test/support/models.rb +0 -357
  51. data/test/test_helper.rb +0 -95
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ad9e2ec1c9f339ea03d225a1dc971adea0fb60efc571cd40655b7738eff273f
4
- data.tar.gz: 937cee947cb4432fea02ff967879356442721bed0e01cb0c4fa3e9f50626a2cb
3
+ metadata.gz: 3b89606503cd2fc01363418e51dd00630a770820b8482f35aa85ddba1a653cc5
4
+ data.tar.gz: 1a078f896c0e4bd41b0462a5b591fcc04038dbb0dd64c65c61b5584450a9b569
5
5
  SHA512:
6
- metadata.gz: cf3e4b076014b076ff2168a0a1d236e21fbdf631ea0198d9e6a3b86eff908de1068f8a0f972fa7f4f9990ca3e3f7ae1d63a762b53f9975cebbd71e4f1a5a233e
7
- data.tar.gz: a0a12ac9760afd5ade06c4a26942adbe515570947b0ae1eb7889fb0d626e2e57b177e82e32a02346ec0fe23591ce74cd609f669892df0d9969ae8b858562ec91
6
+ metadata.gz: 17a0ecd1d326536cdb1e4e1291bcfbad43fac2d8e4e0895ad0619515e9f951c4618da9b4ad8c568bcd9b702f94227f58b3967a14eb9b7adc3343ca07cfb8f451
7
+ data.tar.gz: 810793e24f74792775bbe3e5bba0b157f59673879b8c6c360c4af15ba2d91fc0d293eace5556aba5b32e7a99f01d7e3e96099046401e802fbba3a1b2bcddcaf5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
- ## Unreleased
1
+ ## 5.3.0
2
2
 
3
+ * Add support for Rails 7.1. (no meaningful changes required.)
4
+ * Add `SimpleForm.deprecator` to integrate with new application deprecators in Rails 7.1.
5
+ * Remove test files from the gem package. [@orien](https://github.com/orien)
6
+ * Speed up input mapping lookup by avoiding rescuing exceptions. [@meanphil](https://github.com/meanphil) [@kriom](https://github.com/kriom) [@egeek](https://github.com/egeek)
3
7
 
4
8
  ## 5.2.0
5
9
 
data/MIT-LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020 Rafael França, Carlos Antônio da Silva
1
+ Copyright (c) 2020-2023 Rafael França, Carlos Antônio da Silva
2
2
  Copyright (c) 2009-2019 Plataformatec
3
3
 
4
4
  Permission is hereby granted, free of charge, to any person obtaining
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- ![Simple Form Logo](https://raw.github.com/heartcombo/simple_form/master/simple_form.png)
1
+ ![Simple Form Logo](https://raw.github.com/heartcombo/simple_form/main/simple_form.png)
2
2
 
3
3
  Rails forms made easy.
4
4
 
@@ -262,7 +262,7 @@ the wrapper as well:
262
262
  <% end %>
263
263
  ```
264
264
 
265
- By default, **Simple Form** generates a hidden field to handle the un-checked case for boolean fields.
265
+ By default, **Simple Form** generates a hidden field to handle the un-checked case for boolean fields.
266
266
  Passing `unchecked_value: false` in the options for boolean fields will cause this hidden field to be omitted,
267
267
  following the convention in Rails. You can also specify `include_hidden: false` to skip the hidden field:
268
268
 
@@ -1289,11 +1289,10 @@ If you have discovered a security related bug, please do NOT use the GitHub issu
1289
1289
  * Felipe Renan (https://github.com/feliperenan)
1290
1290
 
1291
1291
  [![Gem Version](https://fury-badge.herokuapp.com/rb/simple_form.png)](http://badge.fury.io/rb/simple_form)
1292
- [![Code Climate](https://codeclimate.com/github/heartcombo/simple_form.png)](https://codeclimate.com/github/heartcombo/simple_form)
1293
1292
  [![Inline docs](http://inch-ci.org/github/heartcombo/simple_form.png)](http://inch-ci.org/github/heartcombo/simple_form)
1294
1293
 
1295
1294
  ## License
1296
1295
 
1297
- MIT License. Copyright 2020 Rafael França, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
1296
+ MIT License. Copyright 2020-2023 Rafael França, Carlos Antônio da Silva. Copyright 2009-2019 Plataformatec.
1298
1297
 
1299
1298
  The Simple Form logo is licensed under [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License](https://creativecommons.org/licenses/by-nc-nd/4.0/).
@@ -22,7 +22,7 @@ module SimpleForm
22
22
  method = method(namespace)
23
23
 
24
24
  if method.arity.zero?
25
- ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })
25
+ SimpleForm.deprecator.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })
26
26
 
27
27
  method.call
28
28
  else
@@ -673,11 +673,7 @@ module SimpleForm
673
673
  def attempt_mapping(mapping, at)
674
674
  return if SimpleForm.inputs_discovery == false && at == Object
675
675
 
676
- begin
677
- at.const_get(mapping)
678
- rescue NameError => e
679
- raise if e.message !~ /#{mapping}$/
680
- end
676
+ at.const_get(mapping) if at.const_defined?(mapping)
681
677
  end
682
678
 
683
679
  def attempt_mapping_with_custom_namespace(input_name)
@@ -11,5 +11,9 @@ module SimpleForm
11
11
  ' Use `rails generate simple_form:install` to generate the Simple Form configuration.'
12
12
  end
13
13
  end
14
+
15
+ initializer "simple_form.deprecator" do |app|
16
+ app.deprecators[:simple_form] = SimpleForm.deprecator if app.respond_to?(:deprecators)
17
+ end
14
18
  end
15
19
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module SimpleForm
3
- VERSION = "5.2.0".freeze
3
+ VERSION = "5.3.0".freeze
4
4
  end
@@ -13,7 +13,7 @@ module SimpleForm
13
13
  method = input.method(@namespace)
14
14
 
15
15
  if method.arity.zero?
16
- ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: @namespace })
16
+ SimpleForm.deprecator.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: @namespace })
17
17
 
18
18
  method.call
19
19
  else
data/lib/simple_form.rb CHANGED
@@ -55,6 +55,10 @@ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-
55
55
  @@configured
56
56
  end
57
57
 
58
+ def self.deprecator
59
+ @deprecator ||= ActiveSupport::Deprecation.new("5.3", "SimpleForm")
60
+ end
61
+
58
62
  ## CONFIGURATION OPTIONS
59
63
 
60
64
  # Method used to tidy up errors.
@@ -264,21 +268,21 @@ See http://blog.plataformatec.com.br/2019/09/incorrect-access-control-in-simple-
264
268
  ## SETUP
265
269
 
266
270
  def self.default_input_size=(*)
267
- ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
271
+ SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
268
272
  end
269
273
 
270
274
  def self.form_class=(value)
271
- ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.form_class= is deprecated and will be removed in 4.x. Use SimpleForm.default_form_class= instead", caller
275
+ SimpleForm.deprecator.warn "[SIMPLE_FORM] SimpleForm.form_class= is deprecated and will be removed in 4.x. Use SimpleForm.default_form_class= instead", caller
272
276
  @@form_class = value
273
277
  end
274
278
 
275
279
  def self.file_methods=(file_methods)
276
- ActiveSupport::Deprecation.warn(FILE_METHODS_DEPRECATION_WARN, caller)
280
+ SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
277
281
  @@file_methods = file_methods
278
282
  end
279
283
 
280
284
  def self.file_methods
281
- ActiveSupport::Deprecation.warn(FILE_METHODS_DEPRECATION_WARN, caller)
285
+ SimpleForm.deprecator.warn(FILE_METHODS_DEPRECATION_WARN, caller)
282
286
  @@file_methods
283
287
  end
284
288
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_form
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.0
4
+ version: 5.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2023-01-29 00:00:00.000000000 Z
13
+ date: 2023-10-11 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activemodel
@@ -112,53 +112,13 @@ files:
112
112
  - lib/simple_form/wrappers/many.rb
113
113
  - lib/simple_form/wrappers/root.rb
114
114
  - lib/simple_form/wrappers/single.rb
115
- - test/action_view_extensions/builder_test.rb
116
- - test/action_view_extensions/form_helper_test.rb
117
- - test/components/custom_components_test.rb
118
- - test/components/label_test.rb
119
- - test/form_builder/association_test.rb
120
- - test/form_builder/button_test.rb
121
- - test/form_builder/error_notification_test.rb
122
- - test/form_builder/error_test.rb
123
- - test/form_builder/general_test.rb
124
- - test/form_builder/hint_test.rb
125
- - test/form_builder/input_field_test.rb
126
- - test/form_builder/label_test.rb
127
- - test/form_builder/wrapper_test.rb
128
- - test/generators/simple_form_generator_test.rb
129
- - test/inputs/boolean_input_test.rb
130
- - test/inputs/collection_check_boxes_input_test.rb
131
- - test/inputs/collection_radio_buttons_input_test.rb
132
- - test/inputs/collection_select_input_test.rb
133
- - test/inputs/color_input_test.rb
134
- - test/inputs/country_input_test.rb
135
- - test/inputs/datetime_input_test.rb
136
- - test/inputs/disabled_test.rb
137
- - test/inputs/discovery_test.rb
138
- - test/inputs/file_input_test.rb
139
- - test/inputs/general_test.rb
140
- - test/inputs/grouped_collection_select_input_test.rb
141
- - test/inputs/hidden_input_test.rb
142
- - test/inputs/numeric_input_test.rb
143
- - test/inputs/readonly_test.rb
144
- - test/inputs/required_test.rb
145
- - test/inputs/rich_text_area_input_test.rb
146
- - test/inputs/string_input_test.rb
147
- - test/inputs/text_input_test.rb
148
- - test/inputs/time_zone_input_test.rb
149
- - test/simple_form_test.rb
150
- - test/support/discovery_inputs.rb
151
- - test/support/misc_helpers.rb
152
- - test/support/mock_controller.rb
153
- - test/support/models.rb
154
- - test/test_helper.rb
155
115
  homepage: https://github.com/heartcombo/simple_form
156
116
  licenses:
157
117
  - MIT
158
118
  metadata:
159
119
  homepage_uri: https://github.com/heartcombo/simple_form
160
120
  documentation_uri: https://rubydoc.info/github/heartcombo/simple_form
161
- changelog_uri: https://github.com/heartcombo/simple_form/blob/master/CHANGELOG.md
121
+ changelog_uri: https://github.com/heartcombo/simple_form/blob/main/CHANGELOG.md
162
122
  source_code_uri: https://github.com/heartcombo/simple_form
163
123
  bug_tracker_uri: https://github.com/heartcombo/simple_form/issues
164
124
  wiki_uri: https://github.com/heartcombo/simple_form/wiki
@@ -177,48 +137,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
137
  - !ruby/object:Gem::Version
178
138
  version: '0'
179
139
  requirements: []
180
- rubygems_version: 3.4.5
140
+ rubygems_version: 3.4.10
181
141
  signing_key:
182
142
  specification_version: 4
183
143
  summary: Forms made easy!
184
- test_files:
185
- - test/action_view_extensions/builder_test.rb
186
- - test/action_view_extensions/form_helper_test.rb
187
- - test/components/custom_components_test.rb
188
- - test/components/label_test.rb
189
- - test/form_builder/association_test.rb
190
- - test/form_builder/button_test.rb
191
- - test/form_builder/error_notification_test.rb
192
- - test/form_builder/error_test.rb
193
- - test/form_builder/general_test.rb
194
- - test/form_builder/hint_test.rb
195
- - test/form_builder/input_field_test.rb
196
- - test/form_builder/label_test.rb
197
- - test/form_builder/wrapper_test.rb
198
- - test/generators/simple_form_generator_test.rb
199
- - test/inputs/boolean_input_test.rb
200
- - test/inputs/collection_check_boxes_input_test.rb
201
- - test/inputs/collection_radio_buttons_input_test.rb
202
- - test/inputs/collection_select_input_test.rb
203
- - test/inputs/color_input_test.rb
204
- - test/inputs/country_input_test.rb
205
- - test/inputs/datetime_input_test.rb
206
- - test/inputs/disabled_test.rb
207
- - test/inputs/discovery_test.rb
208
- - test/inputs/file_input_test.rb
209
- - test/inputs/general_test.rb
210
- - test/inputs/grouped_collection_select_input_test.rb
211
- - test/inputs/hidden_input_test.rb
212
- - test/inputs/numeric_input_test.rb
213
- - test/inputs/readonly_test.rb
214
- - test/inputs/required_test.rb
215
- - test/inputs/rich_text_area_input_test.rb
216
- - test/inputs/string_input_test.rb
217
- - test/inputs/text_input_test.rb
218
- - test/inputs/time_zone_input_test.rb
219
- - test/simple_form_test.rb
220
- - test/support/discovery_inputs.rb
221
- - test/support/misc_helpers.rb
222
- - test/support/mock_controller.rb
223
- - test/support/models.rb
224
- - test/test_helper.rb
144
+ test_files: []