activevalidation 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +32 -9
- data/.overcommit.yml +93 -0
- data/.rspec +1 -1
- data/.rubocop.yml +80 -0
- data/.rubocop_todo.yml +7 -0
- data/.travis.yml +42 -2
- data/.yardops +9 -0
- data/Appraisals +27 -0
- data/Gemfile +24 -1
- data/MIT-LICENSE +20 -0
- data/README.md +142 -20
- data/Rakefile +21 -3
- data/activevalidation.gemspec +35 -25
- data/bin/console +4 -7
- data/gemfiles/am_5.0.gemfile +17 -0
- data/gemfiles/am_5.0.gemfile.lock +159 -0
- data/gemfiles/am_5.1.gemfile +17 -0
- data/gemfiles/am_5.1.gemfile.lock +159 -0
- data/gemfiles/am_5.2.gemfile +17 -0
- data/gemfiles/am_5.2.gemfile.lock +159 -0
- data/gemfiles/am_6.0.gemfile +18 -0
- data/gemfiles/am_6.0.gemfile.lock +158 -0
- data/lib/active_validation.rb +27 -0
- data/lib/active_validation/base_adapter.rb +103 -0
- data/lib/active_validation/configuration.rb +52 -0
- data/lib/active_validation/decorator.rb +27 -0
- data/lib/active_validation/decorators/consistent_registry.rb +36 -0
- data/lib/active_validation/decorators/disallows_duplicates_registry.rb +17 -0
- data/lib/active_validation/errors.rb +28 -0
- data/lib/active_validation/ext/add_active_validation_context_check.rb +21 -0
- data/lib/active_validation/formatters/manifest_name_formatter.rb +13 -0
- data/lib/active_validation/formatters/validation_context_formatter.rb +28 -0
- data/lib/active_validation/frameworks/rspec.rb +10 -0
- data/lib/active_validation/frameworks/rspec/helpers.rb +15 -0
- data/lib/active_validation/internal/models/check.rb +51 -0
- data/lib/active_validation/internal/models/concerns/to_internal.rb +27 -0
- data/lib/active_validation/internal/models/manifest.rb +122 -0
- data/lib/active_validation/internal/models/manifest/installer.rb +86 -0
- data/lib/active_validation/internal/observers/manifest.rb +114 -0
- data/lib/active_validation/model_extension_base.rb +33 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/adapter.rb +59 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/internals/active_validation/internal_model_extensions/check.rb +11 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/model_extension/active_validation/active_record_model_extension.rb +25 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/models/active_validation/check.rb +31 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/models/active_validation/check/concerns/method_must_be_allowed.rb +38 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/models/active_validation/check/validate_method.rb +9 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/models/active_validation/check/validates_method.rb +9 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/models/active_validation/check/validates_with_method.rb +19 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/models/active_validation/concerns/protect_from_mutable_instance_methods.rb +31 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/models/active_validation/manifest.rb +21 -0
- data/lib/active_validation/orm_plugins/active_record_plugin/types/active_validation/type/version.rb +17 -0
- data/lib/active_validation/registry.rb +55 -0
- data/lib/active_validation/values/base.rb +39 -0
- data/lib/active_validation/values/method_name.rb +22 -0
- data/lib/active_validation/values/version.rb +17 -0
- data/lib/active_validation/verifier.rb +150 -0
- data/lib/active_validation/version.rb +5 -0
- data/spec/active_validation/base_adapter_spec.rb +23 -0
- data/spec/active_validation/configuration_spec.rb +52 -0
- data/spec/active_validation/decorators/consistent_registry_spec.rb +117 -0
- data/spec/active_validation/decorators/disallows_duplicates_registry_spec.rb +21 -0
- data/spec/active_validation/formatters/manifest_name_formatter_spec.rb +7 -0
- data/spec/active_validation/formatters/validation_context_formatter_spec.rb +39 -0
- data/spec/active_validation/internal/models/check_spec.rb +67 -0
- data/spec/active_validation/internal/models/manifest/installer_spec.rb +177 -0
- data/spec/active_validation/internal/models/manifest_spec.rb +136 -0
- data/spec/active_validation/internal/observers/manifest_spec.rb +201 -0
- data/spec/active_validation/model_extension_base_spec.rb +71 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/adapter_spec.rb +31 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/adapter_spec_orm_specific_spec.rb +84 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/models/active_validation/check/validate_method_spec.rb +26 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/models/active_validation/check/validates_method_spec.rb +26 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/models/active_validation/check/validates_with_method_spec.rb +34 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/models/active_validation/check_spec.rb +48 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/models/active_validation/manifest_spec.rb +61 -0
- data/spec/active_validation/orm_plugins/active_record_plugin/readme_spec.rb +89 -0
- data/spec/active_validation/registry_spec.rb +76 -0
- data/spec/active_validation/values/base_spec.rb +61 -0
- data/spec/active_validation/values/method_name_spec.rb +16 -0
- data/spec/active_validation/values/version_spec.rb +36 -0
- data/spec/active_validation/verifier_spec.rb +214 -0
- data/spec/active_validation_spec.rb +19 -0
- data/spec/factories/internal/internal_check.rb +43 -0
- data/spec/features/active_record/child_record.feature +32 -0
- data/spec/features/active_record/new_record.feature +22 -0
- data/spec/features/no_orm/install.feature +19 -0
- data/spec/features/no_orm/validate.feature +27 -0
- data/spec/features/no_orm/validate_with_multiple_manifests.feature +29 -0
- data/spec/features/no_orm/validate_with_multiple_versions.feature +42 -0
- data/spec/features/placeholders/be_matcher.rb +7 -0
- data/spec/features/placeholders/klass.rb +5 -0
- data/spec/features/placeholders/version.rb +11 -0
- data/spec/features/placeholders/whether_to.rb +11 -0
- data/spec/features/step_definitions/active_record_steps.rb +7 -0
- data/spec/features/step_definitions/steps.rb +85 -0
- data/spec/orm/active_record/db_adapters/database.mysql.yml +12 -0
- data/spec/orm/active_record/db_adapters/database.postgres.yml +11 -0
- data/spec/orm/active_record/db_adapters/database.sqlite.yml +8 -0
- data/spec/orm/active_record/factories/check/check_validate.rb +8 -0
- data/spec/orm/active_record/factories/check/check_validates.rb +8 -0
- data/spec/orm/active_record/factories/check/check_validates_with.rb +19 -0
- data/spec/orm/active_record/factories/manifest.rb +29 -0
- data/spec/orm/active_record/prepare_db.rb +89 -0
- data/spec/orm/active_record/setup.rb +11 -0
- data/spec/orm/mongoid/setup.rb +15 -0
- data/spec/spec_helper.rb +38 -0
- data/spec/support/database_cleaner.rb +16 -0
- data/spec/support/deferred_garbage_collection.rb +31 -0
- data/spec/support/define_constant_macros.rb +17 -0
- data/spec/support/factory_bot.rb +12 -0
- data/spec/support/helpers.rb +3 -0
- data/spec/support/helpers/only_with_active_record.rb +15 -0
- data/spec/support/matchers/delegate.rb +50 -0
- data/spec/support/matchers/have_attr.rb +58 -0
- data/spec/support/mongoid.yml +6 -0
- data/spec/support/shared_examples/check_attributes.rb +9 -0
- data/spec/support/shared_examples/verifiers_registry.rb +10 -0
- data/spec/support/simplecov.rb +11 -0
- data/spec/turnip_helper.rb +4 -0
- metadata +304 -20
- data/lib/activevalidation.rb +0 -6
- data/lib/activevalidation/version.rb +0 -3
@@ -0,0 +1,17 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "activerecord", "~> 5.2.0"
|
6
|
+
|
7
|
+
group :local_development do
|
8
|
+
gem "appraisal", "~> 2.2.0"
|
9
|
+
gem "overcommit", "~> 0.48.0"
|
10
|
+
gem "pry", "~> 0.12.0"
|
11
|
+
gem "pry-byebug", "~> 3.7.0"
|
12
|
+
gem "reek", "~> 5.4.0"
|
13
|
+
gem "rubocop", "~> 0.72.0"
|
14
|
+
gem "rubocop-rspec", "~> 1.32"
|
15
|
+
end
|
16
|
+
|
17
|
+
gemspec path: "../"
|
@@ -0,0 +1,159 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
activevalidation (0.1.0)
|
5
|
+
activemodel (>= 5.0.0, < 6.1)
|
6
|
+
activesupport (>= 5.0.0, < 6.1)
|
7
|
+
concurrent-ruby (>= 1.0.0, < 2.0)
|
8
|
+
zeitwerk (~> 2.1.9)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activemodel (5.2.3)
|
14
|
+
activesupport (= 5.2.3)
|
15
|
+
activerecord (5.2.3)
|
16
|
+
activemodel (= 5.2.3)
|
17
|
+
activesupport (= 5.2.3)
|
18
|
+
arel (>= 9.0)
|
19
|
+
activesupport (5.2.3)
|
20
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
21
|
+
i18n (>= 0.7, < 2)
|
22
|
+
minitest (~> 5.1)
|
23
|
+
tzinfo (~> 1.1)
|
24
|
+
appraisal (2.2.0)
|
25
|
+
bundler
|
26
|
+
rake
|
27
|
+
thor (>= 0.14.0)
|
28
|
+
arel (9.0.0)
|
29
|
+
ast (2.4.0)
|
30
|
+
axiom-types (0.1.1)
|
31
|
+
descendants_tracker (~> 0.0.4)
|
32
|
+
ice_nine (~> 0.11.0)
|
33
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
34
|
+
byebug (11.0.1)
|
35
|
+
c21e (1.1.9)
|
36
|
+
childprocess (0.9.0)
|
37
|
+
ffi (~> 1.0, >= 1.0.11)
|
38
|
+
codeclimate-engine-rb (0.4.1)
|
39
|
+
virtus (~> 1.0)
|
40
|
+
coderay (1.1.2)
|
41
|
+
coercible (1.0.0)
|
42
|
+
descendants_tracker (~> 0.0.1)
|
43
|
+
concurrent-ruby (1.1.5)
|
44
|
+
cucumber-messages (2.1.2)
|
45
|
+
google-protobuf (>= 3.2, <= 3.7)
|
46
|
+
database_cleaner (1.7.0)
|
47
|
+
descendants_tracker (0.0.4)
|
48
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
49
|
+
diff-lcs (1.3)
|
50
|
+
docile (1.3.2)
|
51
|
+
equalizer (0.0.11)
|
52
|
+
factory_bot (5.0.2)
|
53
|
+
activesupport (>= 4.2.0)
|
54
|
+
ffi (1.11.1)
|
55
|
+
gherkin (6.0.17)
|
56
|
+
c21e (~> 1.1.9)
|
57
|
+
cucumber-messages (~> 2.1.2)
|
58
|
+
google-protobuf (3.7.0-universal-darwin)
|
59
|
+
i18n (1.6.0)
|
60
|
+
concurrent-ruby (~> 1.0)
|
61
|
+
ice_nine (0.11.2)
|
62
|
+
iniparse (1.4.4)
|
63
|
+
jaro_winkler (1.5.3)
|
64
|
+
json (2.2.0)
|
65
|
+
kwalify (0.7.2)
|
66
|
+
method_source (0.9.2)
|
67
|
+
minitest (5.12.2)
|
68
|
+
mysql2 (0.5.2)
|
69
|
+
overcommit (0.48.1)
|
70
|
+
childprocess (~> 0.6, >= 0.6.3)
|
71
|
+
iniparse (~> 1.4)
|
72
|
+
parallel (1.17.0)
|
73
|
+
parser (2.6.4.1)
|
74
|
+
ast (~> 2.4.0)
|
75
|
+
pg (1.0.0)
|
76
|
+
pry (0.12.2)
|
77
|
+
coderay (~> 1.1.0)
|
78
|
+
method_source (~> 0.9.0)
|
79
|
+
pry-byebug (3.7.0)
|
80
|
+
byebug (~> 11.0)
|
81
|
+
pry (~> 0.10)
|
82
|
+
psych (3.1.0)
|
83
|
+
rainbow (3.0.0)
|
84
|
+
rake (13.0.0)
|
85
|
+
reek (5.4.0)
|
86
|
+
codeclimate-engine-rb (~> 0.4.0)
|
87
|
+
kwalify (~> 0.7.0)
|
88
|
+
parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
|
89
|
+
psych (~> 3.1.0)
|
90
|
+
rainbow (>= 2.0, < 4.0)
|
91
|
+
rspec (3.8.0)
|
92
|
+
rspec-core (~> 3.8.0)
|
93
|
+
rspec-expectations (~> 3.8.0)
|
94
|
+
rspec-mocks (~> 3.8.0)
|
95
|
+
rspec-core (3.8.2)
|
96
|
+
rspec-support (~> 3.8.0)
|
97
|
+
rspec-expectations (3.8.4)
|
98
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
99
|
+
rspec-support (~> 3.8.0)
|
100
|
+
rspec-mocks (3.8.1)
|
101
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
102
|
+
rspec-support (~> 3.8.0)
|
103
|
+
rspec-support (3.8.2)
|
104
|
+
rubocop (0.72.0)
|
105
|
+
jaro_winkler (~> 1.5.1)
|
106
|
+
parallel (~> 1.10)
|
107
|
+
parser (>= 2.6)
|
108
|
+
rainbow (>= 2.2.2, < 4.0)
|
109
|
+
ruby-progressbar (~> 1.7)
|
110
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
111
|
+
rubocop-rspec (1.36.0)
|
112
|
+
rubocop (>= 0.68.1)
|
113
|
+
ruby-progressbar (1.10.1)
|
114
|
+
simplecov (0.17.1)
|
115
|
+
docile (~> 1.1)
|
116
|
+
json (>= 1.8, < 3)
|
117
|
+
simplecov-html (~> 0.10.0)
|
118
|
+
simplecov-html (0.10.2)
|
119
|
+
sqlite3 (1.3.13)
|
120
|
+
thor (0.20.3)
|
121
|
+
thread_safe (0.3.6)
|
122
|
+
turnip (4.0.1)
|
123
|
+
gherkin (~> 6.0.17)
|
124
|
+
rspec (>= 3.0, < 4.0)
|
125
|
+
tzinfo (1.2.5)
|
126
|
+
thread_safe (~> 0.1)
|
127
|
+
unicode-display_width (1.6.0)
|
128
|
+
virtus (1.0.5)
|
129
|
+
axiom-types (~> 0.1)
|
130
|
+
coercible (~> 1.0)
|
131
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
132
|
+
equalizer (~> 0.0, >= 0.0.9)
|
133
|
+
zeitwerk (2.1.10)
|
134
|
+
|
135
|
+
PLATFORMS
|
136
|
+
ruby
|
137
|
+
|
138
|
+
DEPENDENCIES
|
139
|
+
activerecord (~> 5.2.0)
|
140
|
+
activevalidation!
|
141
|
+
appraisal (~> 2.2.0)
|
142
|
+
bundler (~> 1.17)
|
143
|
+
database_cleaner (~> 1.7.0)
|
144
|
+
factory_bot (~> 5.0.0)
|
145
|
+
mysql2 (~> 0.5.2)
|
146
|
+
overcommit (~> 0.48.0)
|
147
|
+
pg (~> 1.0.0)
|
148
|
+
pry (~> 0.12.0)
|
149
|
+
pry-byebug (~> 3.7.0)
|
150
|
+
reek (~> 5.4.0)
|
151
|
+
rspec (~> 3.8)
|
152
|
+
rubocop (~> 0.72.0)
|
153
|
+
rubocop-rspec (~> 1.32)
|
154
|
+
simplecov (~> 0.16)
|
155
|
+
sqlite3 (>= 1.3.13)
|
156
|
+
turnip (~> 4.0.0)
|
157
|
+
|
158
|
+
BUNDLED WITH
|
159
|
+
1.17.3
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
gem "activerecord", "~> 6.0.0"
|
6
|
+
gem "sqlite3", "~> 1.4.0"
|
7
|
+
|
8
|
+
group :local_development do
|
9
|
+
gem "appraisal", "~> 2.2.0"
|
10
|
+
gem "overcommit", "~> 0.48.0"
|
11
|
+
gem "pry", "~> 0.12.0"
|
12
|
+
gem "pry-byebug", "~> 3.7.0"
|
13
|
+
gem "reek", "~> 5.4.0"
|
14
|
+
gem "rubocop", "~> 0.72.0"
|
15
|
+
gem "rubocop-rspec", "~> 1.32"
|
16
|
+
end
|
17
|
+
|
18
|
+
gemspec path: "../"
|
@@ -0,0 +1,158 @@
|
|
1
|
+
PATH
|
2
|
+
remote: ..
|
3
|
+
specs:
|
4
|
+
activevalidation (0.1.0)
|
5
|
+
activemodel (>= 5.0.0, < 6.1)
|
6
|
+
activesupport (>= 5.0.0, < 6.1)
|
7
|
+
concurrent-ruby (>= 1.0.0, < 2.0)
|
8
|
+
zeitwerk (~> 2.1.9)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
activemodel (6.0.0)
|
14
|
+
activesupport (= 6.0.0)
|
15
|
+
activerecord (6.0.0)
|
16
|
+
activemodel (= 6.0.0)
|
17
|
+
activesupport (= 6.0.0)
|
18
|
+
activesupport (6.0.0)
|
19
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
+
i18n (>= 0.7, < 2)
|
21
|
+
minitest (~> 5.1)
|
22
|
+
tzinfo (~> 1.1)
|
23
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
24
|
+
appraisal (2.2.0)
|
25
|
+
bundler
|
26
|
+
rake
|
27
|
+
thor (>= 0.14.0)
|
28
|
+
ast (2.4.0)
|
29
|
+
axiom-types (0.1.1)
|
30
|
+
descendants_tracker (~> 0.0.4)
|
31
|
+
ice_nine (~> 0.11.0)
|
32
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
33
|
+
byebug (11.0.1)
|
34
|
+
c21e (1.1.9)
|
35
|
+
childprocess (0.9.0)
|
36
|
+
ffi (~> 1.0, >= 1.0.11)
|
37
|
+
codeclimate-engine-rb (0.4.1)
|
38
|
+
virtus (~> 1.0)
|
39
|
+
coderay (1.1.2)
|
40
|
+
coercible (1.0.0)
|
41
|
+
descendants_tracker (~> 0.0.1)
|
42
|
+
concurrent-ruby (1.1.5)
|
43
|
+
cucumber-messages (2.1.2)
|
44
|
+
google-protobuf (>= 3.2, <= 3.7)
|
45
|
+
database_cleaner (1.7.0)
|
46
|
+
descendants_tracker (0.0.4)
|
47
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
48
|
+
diff-lcs (1.3)
|
49
|
+
docile (1.3.2)
|
50
|
+
equalizer (0.0.11)
|
51
|
+
factory_bot (5.0.2)
|
52
|
+
activesupport (>= 4.2.0)
|
53
|
+
ffi (1.11.1)
|
54
|
+
gherkin (6.0.17)
|
55
|
+
c21e (~> 1.1.9)
|
56
|
+
cucumber-messages (~> 2.1.2)
|
57
|
+
google-protobuf (3.7.0)
|
58
|
+
i18n (1.6.0)
|
59
|
+
concurrent-ruby (~> 1.0)
|
60
|
+
ice_nine (0.11.2)
|
61
|
+
iniparse (1.4.4)
|
62
|
+
jaro_winkler (1.5.3)
|
63
|
+
json (2.2.0)
|
64
|
+
kwalify (0.7.2)
|
65
|
+
method_source (0.9.2)
|
66
|
+
minitest (5.12.2)
|
67
|
+
mysql2 (0.5.2)
|
68
|
+
overcommit (0.48.1)
|
69
|
+
childprocess (~> 0.6, >= 0.6.3)
|
70
|
+
iniparse (~> 1.4)
|
71
|
+
parallel (1.17.0)
|
72
|
+
parser (2.6.4.1)
|
73
|
+
ast (~> 2.4.0)
|
74
|
+
pg (1.0.0)
|
75
|
+
pry (0.12.2)
|
76
|
+
coderay (~> 1.1.0)
|
77
|
+
method_source (~> 0.9.0)
|
78
|
+
pry-byebug (3.7.0)
|
79
|
+
byebug (~> 11.0)
|
80
|
+
pry (~> 0.10)
|
81
|
+
psych (3.1.0)
|
82
|
+
rainbow (3.0.0)
|
83
|
+
rake (13.0.0)
|
84
|
+
reek (5.4.0)
|
85
|
+
codeclimate-engine-rb (~> 0.4.0)
|
86
|
+
kwalify (~> 0.7.0)
|
87
|
+
parser (>= 2.5.0.0, < 2.7, != 2.5.1.1)
|
88
|
+
psych (~> 3.1.0)
|
89
|
+
rainbow (>= 2.0, < 4.0)
|
90
|
+
rspec (3.8.0)
|
91
|
+
rspec-core (~> 3.8.0)
|
92
|
+
rspec-expectations (~> 3.8.0)
|
93
|
+
rspec-mocks (~> 3.8.0)
|
94
|
+
rspec-core (3.8.2)
|
95
|
+
rspec-support (~> 3.8.0)
|
96
|
+
rspec-expectations (3.8.4)
|
97
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
98
|
+
rspec-support (~> 3.8.0)
|
99
|
+
rspec-mocks (3.8.1)
|
100
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
101
|
+
rspec-support (~> 3.8.0)
|
102
|
+
rspec-support (3.8.2)
|
103
|
+
rubocop (0.72.0)
|
104
|
+
jaro_winkler (~> 1.5.1)
|
105
|
+
parallel (~> 1.10)
|
106
|
+
parser (>= 2.6)
|
107
|
+
rainbow (>= 2.2.2, < 4.0)
|
108
|
+
ruby-progressbar (~> 1.7)
|
109
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
110
|
+
rubocop-rspec (1.36.0)
|
111
|
+
rubocop (>= 0.68.1)
|
112
|
+
ruby-progressbar (1.10.1)
|
113
|
+
simplecov (0.17.1)
|
114
|
+
docile (~> 1.1)
|
115
|
+
json (>= 1.8, < 3)
|
116
|
+
simplecov-html (~> 0.10.0)
|
117
|
+
simplecov-html (0.10.2)
|
118
|
+
sqlite3 (1.4.1)
|
119
|
+
thor (0.20.3)
|
120
|
+
thread_safe (0.3.6)
|
121
|
+
turnip (4.0.1)
|
122
|
+
gherkin (~> 6.0.17)
|
123
|
+
rspec (>= 3.0, < 4.0)
|
124
|
+
tzinfo (1.2.5)
|
125
|
+
thread_safe (~> 0.1)
|
126
|
+
unicode-display_width (1.6.0)
|
127
|
+
virtus (1.0.5)
|
128
|
+
axiom-types (~> 0.1)
|
129
|
+
coercible (~> 1.0)
|
130
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
131
|
+
equalizer (~> 0.0, >= 0.0.9)
|
132
|
+
zeitwerk (2.1.10)
|
133
|
+
|
134
|
+
PLATFORMS
|
135
|
+
ruby
|
136
|
+
|
137
|
+
DEPENDENCIES
|
138
|
+
activerecord (~> 6.0.0)
|
139
|
+
activevalidation!
|
140
|
+
appraisal (~> 2.2.0)
|
141
|
+
bundler (~> 1.17)
|
142
|
+
database_cleaner (~> 1.7.0)
|
143
|
+
factory_bot (~> 5.0.0)
|
144
|
+
mysql2 (~> 0.5.2)
|
145
|
+
overcommit (~> 0.48.0)
|
146
|
+
pg (~> 1.0.0)
|
147
|
+
pry (~> 0.12.0)
|
148
|
+
pry-byebug (~> 3.7.0)
|
149
|
+
reek (~> 5.4.0)
|
150
|
+
rspec (~> 3.8)
|
151
|
+
rubocop (~> 0.72.0)
|
152
|
+
rubocop-rspec (~> 1.32)
|
153
|
+
simplecov (~> 0.16)
|
154
|
+
sqlite3 (~> 1.4.0)
|
155
|
+
turnip (~> 4.0.0)
|
156
|
+
|
157
|
+
BUNDLED WITH
|
158
|
+
1.17.3
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "set"
|
4
|
+
require "active_support/core_ext/string/inflections"
|
5
|
+
require "active_support/core_ext/module/delegation"
|
6
|
+
require "active_support/core_ext/hash/indifferent_access"
|
7
|
+
require "active_support/ordered_options"
|
8
|
+
require "active_support/concern"
|
9
|
+
require "active_model"
|
10
|
+
require "zeitwerk"
|
11
|
+
|
12
|
+
loader = Zeitwerk::Loader.for_gem
|
13
|
+
loader.ignore "#{__dir__}/active_validation/orm_plugins"
|
14
|
+
loader.setup
|
15
|
+
|
16
|
+
module ActiveValidation
|
17
|
+
class << self
|
18
|
+
def configuration
|
19
|
+
@configuration ||= Configuration.new
|
20
|
+
yield(@configuration) if block_given?
|
21
|
+
@configuration
|
22
|
+
end
|
23
|
+
alias config configuration
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
::ActiveModel::Validations.prepend ActiveValidation::Ext::AddActiveValidationContextCheck
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ActiveValidation
|
4
|
+
class BaseAdapter
|
5
|
+
class << self
|
6
|
+
mattr_accessor :initialised, default: false
|
7
|
+
|
8
|
+
def inherited(base)
|
9
|
+
# ruby 2.4 require this :send
|
10
|
+
base.singleton_class.send(:attr_accessor, :abstract)
|
11
|
+
|
12
|
+
# set default loading paths from the plugin root folder
|
13
|
+
base.singleton_class.send(:attr_accessor, :loading_paths)
|
14
|
+
base.loading_paths = []
|
15
|
+
base.abstract = false
|
16
|
+
ActiveValidation.config.orm_adapters_registry.register base.plugin_name, base
|
17
|
+
super
|
18
|
+
end
|
19
|
+
|
20
|
+
def loader
|
21
|
+
return @loader if @loader
|
22
|
+
|
23
|
+
@loader = Zeitwerk::Loader.new
|
24
|
+
loading_paths.each do |loading_path|
|
25
|
+
@loader.push_dir(Pathname.new(File.expand_path(__dir__)).join("orm_plugins", plugin_name, loading_path))
|
26
|
+
end
|
27
|
+
@loader.setup
|
28
|
+
@loader
|
29
|
+
end
|
30
|
+
|
31
|
+
# Abstract adapter should not be used directly
|
32
|
+
def abstract
|
33
|
+
true
|
34
|
+
end
|
35
|
+
|
36
|
+
def plugin_name
|
37
|
+
klass_name = name.split("::").detect { |c| c =~ /Plugin\z/ }
|
38
|
+
klass_name ? klass_name.underscore : "base"
|
39
|
+
end
|
40
|
+
|
41
|
+
def adapter_name
|
42
|
+
plugin_name.sub(/_plugin\z/, "")
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_s
|
46
|
+
abstract ? "#{plugin_name} (abstract)" : plugin_name
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
delegate :to_s, :plugin_name, :adapter_name, to: :class
|
51
|
+
|
52
|
+
# @abstract
|
53
|
+
# should setup self.class.initialised to true after loading all dependencies
|
54
|
+
def setup
|
55
|
+
raise NotImplementedError, "abstract"
|
56
|
+
end
|
57
|
+
|
58
|
+
# @abstract
|
59
|
+
# @param [Internal::Models::Manifest] :manifest
|
60
|
+
# @return [Internal::Models::Manifest] :manifest
|
61
|
+
def add_manifest(_manifest)
|
62
|
+
raise NotImplementedError, "abstract"
|
63
|
+
end
|
64
|
+
|
65
|
+
# @abstract
|
66
|
+
# Return the most recent Manifest, which meet the criteria
|
67
|
+
#
|
68
|
+
# @param [Hash] Look up criteria
|
69
|
+
# @option manifest_hash [String] :name Human readable name, by default build with selected
|
70
|
+
# formatter for current manifest
|
71
|
+
# @option manifest_hash [String, Class] :base_klass (base_klass) Base klass for the Manifest
|
72
|
+
# @option manifest_hash [String, Symbol, Integer, Values::Version] :version (:current) Version
|
73
|
+
# of the current manifest
|
74
|
+
#
|
75
|
+
# @example find_manifest({ base_klass: 'Bar' })
|
76
|
+
#
|
77
|
+
# @see Internal::Models::Manifest
|
78
|
+
#
|
79
|
+
# @return [Internal::Models::Manifest]
|
80
|
+
def find_manifest(**_wheres)
|
81
|
+
raise NotImplementedError, "abstract"
|
82
|
+
end
|
83
|
+
|
84
|
+
# @abstract
|
85
|
+
# Return the most recent Manifests, which meet the criteria
|
86
|
+
#
|
87
|
+
# @param [Hash] Look up criteria
|
88
|
+
# @option manifest_hash [String] :name Human readable name, by default build with selected
|
89
|
+
# formatter for current manifest
|
90
|
+
# @option manifest_hash [String, Class] :base_klass (base_klass) Base klass for the Manifest
|
91
|
+
# @option manifest_hash [String, Symbol, Integer, Values::Version] :version (:current) Version
|
92
|
+
# of the current manifest
|
93
|
+
#
|
94
|
+
# @example find_manifests({ base_klass: 'Bar' })
|
95
|
+
#
|
96
|
+
# @see Internal::Models::Manifest
|
97
|
+
#
|
98
|
+
# @return [Array<Internal::Models::Manifest>]
|
99
|
+
def find_manifests(**_wheres)
|
100
|
+
raise NotImplementedError, "abstract"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|