trailblazer-finder 0.10.1 → 0.70.0

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.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +16 -0
  3. data/.rubocop.yml +7 -1
  4. data/CHANGES.md +15 -0
  5. data/Gemfile +3 -1
  6. data/README.md +4 -4
  7. data/Rakefile +0 -6
  8. data/lib/trailblazer/finder/activities/find.rb +20 -21
  9. data/lib/trailblazer/finder/activities/prepare.rb +2 -3
  10. data/lib/trailblazer/finder/activities/prepare_adapter.rb +25 -0
  11. data/lib/trailblazer/finder/activities/prepare_entity.rb +5 -5
  12. data/lib/trailblazer/finder/activities/prepare_paging.rb +5 -11
  13. data/lib/trailblazer/finder/activities/prepare_params.rb +3 -3
  14. data/lib/trailblazer/finder/activities/prepare_properties.rb +1 -5
  15. data/lib/trailblazer/finder/activities/prepare_sorting.rb +3 -8
  16. data/lib/trailblazer/finder/activities/process.rb +0 -1
  17. data/lib/trailblazer/finder/activities/process_adapters.rb +25 -23
  18. data/lib/trailblazer/finder/adapters/active_record/paging.rb +1 -1
  19. data/lib/trailblazer/finder/adapters/active_record/predicates.rb +14 -14
  20. data/lib/trailblazer/finder/adapters/active_record/sorting.rb +1 -1
  21. data/lib/trailblazer/finder/adapters/basic/paging.rb +1 -1
  22. data/lib/trailblazer/finder/adapters/basic/predicates.rb +14 -14
  23. data/lib/trailblazer/finder/adapters/basic/sorting.rb +1 -1
  24. data/lib/trailblazer/finder/adapters/kaminari/paging.rb +2 -3
  25. data/lib/trailblazer/finder/adapters/sequel/paging.rb +1 -1
  26. data/lib/trailblazer/finder/adapters/sequel/predicates.rb +14 -14
  27. data/lib/trailblazer/finder/adapters/sequel/sorting.rb +1 -1
  28. data/lib/trailblazer/finder/adapters/will_paginate/paging.rb +2 -3
  29. data/lib/trailblazer/finder/dsl.rb +12 -9
  30. data/lib/trailblazer/finder/find.rb +4 -2
  31. data/lib/trailblazer/finder/helpers/sorting.rb +4 -1
  32. data/lib/trailblazer/finder/version.rb +1 -1
  33. data/lib/trailblazer/finder.rb +1 -7
  34. data/lib/trailblazer/operation/finder.rb +3 -3
  35. data/spec/spec_helper.rb +0 -1
  36. data/spec/trailblazer/finder/adapters/active_record_spec.rb +5 -5
  37. data/spec/trailblazer/finder/adapters/basic_spec.rb +12 -3
  38. data/spec/trailblazer/finder/adapters/kaminari_spec.rb +13 -8
  39. data/spec/trailblazer/finder/adapters/sequel_spec.rb +5 -5
  40. data/spec/trailblazer/finder/adapters/will_paginate_spec.rb +12 -7
  41. data/spec/trailblazer/finder/dsl_spec.rb +4 -13
  42. data/spec/trailblazer/operation/finder_spec.rb +18 -3
  43. data/trailblazer-finder.gemspec +4 -5
  44. metadata +21 -36
  45. data/.rubocop_todo.yml +0 -78
  46. data/.travis.yml +0 -7
  47. data/lib/trailblazer/finder/activities/prepare_adapters.rb +0 -52
@@ -38,11 +38,11 @@ module Trailblazer
38
38
  it "cannot use kaminari without an actual orm" do
39
39
  10.times { |i| Product.create name: "product_#{i}" }
40
40
  finder = new_finder do
41
- adapters WillPaginate
41
+ paginator "WillPaginate"
42
42
  paging per_page: 2, min_per_page: 1, max_per_page: 5
43
43
  end
44
44
 
45
- expect(finder.errors).to eq [{adapters: "Can't use paging adapters like Kaminari without using an ORM like ActiveRecord or Sequel"}]
45
+ expect(finder.errors).to eq [{paginator: "Can't use paginator WillPaginate without using an ORM like ActiveRecord or Sequel"}]
46
46
  end
47
47
  end
48
48
 
@@ -50,7 +50,8 @@ module Trailblazer
50
50
  it "sets the paging values and shows only the first page results" do
51
51
  10.times { |i| Product.create name: "product_#{i}" }
52
52
  finder = new_finder do
53
- adapters ActiveRecord, WillPaginate
53
+ adapter "ActiveRecord"
54
+ paginator "WillPaginate"
54
55
  paging per_page: 2, min_per_page: 1, max_per_page: 5
55
56
  end
56
57
 
@@ -60,7 +61,8 @@ module Trailblazer
60
61
  it "accepts per_page as a parameter" do
61
62
  10.times { |i| Product.create name: "product_#{i}" }
62
63
  finder = new_finder page: 2, per_page: 4 do
63
- adapters ActiveRecord, WillPaginate
64
+ adapter "ActiveRecord"
65
+ paginator "WillPaginate"
64
66
  paging per_page: 5, min_per_page: 2, max_per_page: 8
65
67
  end
66
68
 
@@ -71,7 +73,8 @@ module Trailblazer
71
73
  it "uses max_per_page in finder as maximum per_page" do
72
74
  10.times { |i| Product.create name: "product_#{i}" }
73
75
  finder = new_finder page: 2, per_page: 9 do
74
- adapters ActiveRecord, WillPaginate
76
+ adapter "ActiveRecord"
77
+ paginator "WillPaginate"
75
78
  paging per_page: 5, min_per_page: 2, max_per_page: 8
76
79
  end
77
80
 
@@ -82,7 +85,8 @@ module Trailblazer
82
85
  it "uses min_per_page in finder as minimum per_page" do
83
86
  10.times { |i| Product.create name: "product_#{i}" }
84
87
  finder = new_finder page: 2, per_page: 1 do
85
- adapters ActiveRecord, WillPaginate
88
+ adapter "ActiveRecord"
89
+ paginator "WillPaginate"
86
90
  paging per_page: 5, min_per_page: 2, max_per_page: 8
87
91
  end
88
92
 
@@ -96,7 +100,8 @@ module Trailblazer
96
100
  5.times { |i| Product.create name: "product_#{i}" }
97
101
  5.times { |_i| Product.create name: "product" }
98
102
  finder = new_finder name_eq: "product", sort: "id desc", page: 2 do
99
- adapters ActiveRecord, WillPaginate
103
+ adapter "ActiveRecord"
104
+ paginator "WillPaginate"
100
105
  paging per_page: 2, min_per_page: 1, max_per_page: 5
101
106
  property :name, type: Types::String
102
107
  property :id, type: Types::Integer, sortable: true
@@ -60,29 +60,20 @@ module Trailblazer
60
60
  it "checks for a valid adapter and returns an error" do
61
61
  entity = [{id: 1, value: "Test 1"}, {id: 2, value: "Test 2"}, {id: 3, value: "Test 3"}]
62
62
  finder = new_finder entity, value_eq: "Test 1" do
63
- adapters :NonExisting
63
+ adapter :NonExisting
64
64
  end
65
65
 
66
- expect(finder.errors).to eq [{adapters: "One or more of the specified adapters are invalid"}]
67
- end
68
-
69
- it "checks if multiple orm adapters are requested and returns an error" do
70
- entity = [{id: 1, value: "Test 1"}, {id: 2, value: "Test 2"}, {id: 3, value: "Test 3"}]
71
- finder = new_finder entity, value_eq: "Test 1" do
72
- adapters :ActiveRecord, :Sequel
73
- end
74
-
75
- expect(finder.errors).to eq [{adapters: "More then one ORM adapter specified"}]
66
+ expect(finder.errors).to eq [{adapter: "The specified adapter are invalid"}]
76
67
  end
77
68
 
78
69
  it "sets the adapter in the config" do
79
70
  entity = [{id: 1, value: "Test 1"}, {id: 2, value: "Test 2"}, {id: 3, value: "Test 3"}]
80
71
  finder = new_finder entity, value_eq: "Test 1" do
81
- adapters ActiveRecord
72
+ adapter "ActiveRecord"
82
73
  property :value, type: Base
83
74
  end
84
75
 
85
- expect(finder.class.config[:adapters]).to eq ["ActiveRecord"]
76
+ expect(finder.class.config[:adapter]).to eq "ActiveRecord"
86
77
  end
87
78
  end
88
79
 
@@ -5,7 +5,7 @@ require "trailblazer"
5
5
  require "spec_helper_active_record"
6
6
 
7
7
  class Product::FinderNoEntity < Trailblazer::Finder
8
- adapters ActiveRecord
8
+ adapter "ActiveRecord"
9
9
 
10
10
  property :id, type: Types::Integer
11
11
  property :name, type: Types::String, sortable: true
@@ -19,7 +19,7 @@ class Product::FinderNoEntity < Trailblazer::Finder
19
19
  end
20
20
 
21
21
  class Product::FinderWithEntity < Trailblazer::Finder
22
- adapters ActiveRecord
22
+ adapter "ActiveRecord"
23
23
 
24
24
  entity { Product }
25
25
 
@@ -54,7 +54,7 @@ describe "Trailblazer::Operation - Finder Macro" do
54
54
  before do
55
55
  Product.destroy_all
56
56
  Product.reset_pk_sequence
57
- 20.times { |i| Product.create name: "product_#{i}" }
57
+ 22.times { |i| Product.create name: "product_#{i}" }
58
58
  end
59
59
 
60
60
  after do
@@ -69,6 +69,13 @@ describe "Trailblazer::Operation - Finder Macro" do
69
69
  expect(result[:finder].name).to eq "product_4"
70
70
  end
71
71
 
72
+ it "Can find a single row by id from ActiveSupport::HashWithIndifferentAccess" do
73
+ params = ActiveSupport::HashWithIndifferentAccess.new({id: 6})
74
+ result = Product::Show.call(params: params)
75
+
76
+ expect(result[:finder].name).to eq "product_5"
77
+ end
78
+
72
79
  it "Can find a single row by name" do
73
80
  params = {name_eq: "product_2"}
74
81
  result = Product::Show.call(params: params)
@@ -83,6 +90,13 @@ describe "Trailblazer::Operation - Finder Macro" do
83
90
  expect(result[:finder].result.last.name).to eq "product_19"
84
91
  end
85
92
 
93
+ it "Can find multiple rows by escaped name if key is string" do
94
+ params = {"escaped_name" => "product_1"}
95
+ result = Product::Index.call(params: params)
96
+
97
+ expect(result[:finder].result.last.name).to eq "product_19"
98
+ end
99
+
86
100
  it "Can find a single row by id when no entity type is given in macro" do
87
101
  params = {id: 8}
88
102
  result = Product::ShowNoEntity.call(params: params)
@@ -101,6 +115,7 @@ describe "Trailblazer::Operation - Finder Macro" do
101
115
  params = {escaped_name: "product_1"}
102
116
  result = Product::IndexNoEntity.call(params: params)
103
117
 
118
+ expect(result[:finder].result.count).to eq 11
104
119
  expect(result[:finder].result.last.name).to eq "product_19"
105
120
  end
106
121
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.test_files = spec.files.grep(%r{^(test)/})
18
18
  spec.require_paths = ["lib"]
19
19
 
20
- spec.add_dependency "dry-types"
20
+ spec.add_dependency "dry-types", ">= 1.0.0"
21
21
  spec.add_dependency "trailblazer-activity", ">= 0.10.0"
22
22
 
23
23
  spec.add_development_dependency "activerecord"
@@ -26,16 +26,15 @@ Gem::Specification.new do |spec|
26
26
  spec.add_development_dependency "kaminari-activerecord"
27
27
  spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency "rspec", "~> 3.5"
29
- spec.add_development_dependency "rspec-mocks", "~> 3.5"
30
29
  spec.add_development_dependency "rspec_junit_formatter"
30
+ spec.add_development_dependency "rspec-mocks", "~> 3.5"
31
31
  spec.add_development_dependency "rubocop"
32
32
  spec.add_development_dependency "rubocop-rspec"
33
33
  spec.add_development_dependency "sequel"
34
34
  spec.add_development_dependency "simplecov"
35
- spec.add_development_dependency "sqlite3"
36
35
  spec.add_development_dependency "trailblazer", "~> 2.1.0"
37
- spec.add_development_dependency "will_paginate"
38
36
  spec.add_development_dependency "trailblazer-developer"
37
+ spec.add_development_dependency "will_paginate"
39
38
 
40
- spec.required_ruby_version = ">= 2.3.8"
39
+ spec.required_ruby_version = ">= 2.5.0"
41
40
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trailblazer-finder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.1
4
+ version: 0.70.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sutterer
8
8
  - Marc Tich
9
9
  - Abdelkader Boudih
10
- autorequire:
10
+ autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-03-09 00:00:00.000000000 Z
13
+ date: 2021-11-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: dry-types
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.0.0
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: '0'
28
+ version: 1.0.0
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: trailblazer-activity
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -124,20 +124,6 @@ dependencies:
124
124
  - - "~>"
125
125
  - !ruby/object:Gem::Version
126
126
  version: '3.5'
127
- - !ruby/object:Gem::Dependency
128
- name: rspec-mocks
129
- requirement: !ruby/object:Gem::Requirement
130
- requirements:
131
- - - "~>"
132
- - !ruby/object:Gem::Version
133
- version: '3.5'
134
- type: :development
135
- prerelease: false
136
- version_requirements: !ruby/object:Gem::Requirement
137
- requirements:
138
- - - "~>"
139
- - !ruby/object:Gem::Version
140
- version: '3.5'
141
127
  - !ruby/object:Gem::Dependency
142
128
  name: rspec_junit_formatter
143
129
  requirement: !ruby/object:Gem::Requirement
@@ -153,21 +139,21 @@ dependencies:
153
139
  - !ruby/object:Gem::Version
154
140
  version: '0'
155
141
  - !ruby/object:Gem::Dependency
156
- name: rubocop
142
+ name: rspec-mocks
157
143
  requirement: !ruby/object:Gem::Requirement
158
144
  requirements:
159
- - - ">="
145
+ - - "~>"
160
146
  - !ruby/object:Gem::Version
161
- version: '0'
147
+ version: '3.5'
162
148
  type: :development
163
149
  prerelease: false
164
150
  version_requirements: !ruby/object:Gem::Requirement
165
151
  requirements:
166
- - - ">="
152
+ - - "~>"
167
153
  - !ruby/object:Gem::Version
168
- version: '0'
154
+ version: '3.5'
169
155
  - !ruby/object:Gem::Dependency
170
- name: rubocop-rspec
156
+ name: rubocop
171
157
  requirement: !ruby/object:Gem::Requirement
172
158
  requirements:
173
159
  - - ">="
@@ -181,7 +167,7 @@ dependencies:
181
167
  - !ruby/object:Gem::Version
182
168
  version: '0'
183
169
  - !ruby/object:Gem::Dependency
184
- name: sequel
170
+ name: rubocop-rspec
185
171
  requirement: !ruby/object:Gem::Requirement
186
172
  requirements:
187
173
  - - ">="
@@ -195,7 +181,7 @@ dependencies:
195
181
  - !ruby/object:Gem::Version
196
182
  version: '0'
197
183
  - !ruby/object:Gem::Dependency
198
- name: simplecov
184
+ name: sequel
199
185
  requirement: !ruby/object:Gem::Requirement
200
186
  requirements:
201
187
  - - ">="
@@ -209,7 +195,7 @@ dependencies:
209
195
  - !ruby/object:Gem::Version
210
196
  version: '0'
211
197
  - !ruby/object:Gem::Dependency
212
- name: sqlite3
198
+ name: simplecov
213
199
  requirement: !ruby/object:Gem::Requirement
214
200
  requirements:
215
201
  - - ">="
@@ -237,7 +223,7 @@ dependencies:
237
223
  - !ruby/object:Gem::Version
238
224
  version: 2.1.0
239
225
  - !ruby/object:Gem::Dependency
240
- name: will_paginate
226
+ name: trailblazer-developer
241
227
  requirement: !ruby/object:Gem::Requirement
242
228
  requirements:
243
229
  - - ">="
@@ -251,7 +237,7 @@ dependencies:
251
237
  - !ruby/object:Gem::Version
252
238
  version: '0'
253
239
  - !ruby/object:Gem::Dependency
254
- name: trailblazer-developer
240
+ name: will_paginate
255
241
  requirement: !ruby/object:Gem::Requirement
256
242
  requirements:
257
243
  - - ">="
@@ -273,10 +259,9 @@ executables: []
273
259
  extensions: []
274
260
  extra_rdoc_files: []
275
261
  files:
262
+ - ".github/workflows/ci.yml"
276
263
  - ".gitignore"
277
264
  - ".rubocop.yml"
278
- - ".rubocop_todo.yml"
279
- - ".travis.yml"
280
265
  - CHANGES.md
281
266
  - Gemfile
282
267
  - LICENSE.txt
@@ -285,7 +270,7 @@ files:
285
270
  - lib/trailblazer/finder.rb
286
271
  - lib/trailblazer/finder/activities/find.rb
287
272
  - lib/trailblazer/finder/activities/prepare.rb
288
- - lib/trailblazer/finder/activities/prepare_adapters.rb
273
+ - lib/trailblazer/finder/activities/prepare_adapter.rb
289
274
  - lib/trailblazer/finder/activities/prepare_entity.rb
290
275
  - lib/trailblazer/finder/activities/prepare_filters.rb
291
276
  - lib/trailblazer/finder/activities/prepare_paging.rb
@@ -341,7 +326,7 @@ homepage: http://trailblazer.to
341
326
  licenses:
342
327
  - LGPL-3.0
343
328
  metadata: {}
344
- post_install_message:
329
+ post_install_message:
345
330
  rdoc_options: []
346
331
  require_paths:
347
332
  - lib
@@ -349,7 +334,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
349
334
  requirements:
350
335
  - - ">="
351
336
  - !ruby/object:Gem::Version
352
- version: 2.3.8
337
+ version: 2.5.0
353
338
  required_rubygems_version: !ruby/object:Gem::Requirement
354
339
  requirements:
355
340
  - - ">="
@@ -357,7 +342,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
357
342
  version: '0'
358
343
  requirements: []
359
344
  rubygems_version: 3.0.3
360
- signing_key:
345
+ signing_key:
361
346
  specification_version: 4
362
347
  summary: Trailblazer based finder objects. It is designed to be used on its own as
363
348
  a separate gem. It was influenced by popular Ransack gem, but in addition to ActiveRecord,
data/.rubocop_todo.yml DELETED
@@ -1,78 +0,0 @@
1
- # This configuration was generated by
2
- # `rubocop --auto-gen-config`
3
- # on 2018-08-23 00:10:15 +0200 using RuboCop version 0.58.2.
4
- # The point is for the user to remove these configuration records
5
- # one by one as the offenses are removed from the code base.
6
- # Note that changes in the inspected code, or installation of new
7
- # versions of RuboCop, may require this file to be generated again.
8
-
9
- # Offense count: 1
10
- Metrics/AbcSize:
11
- Max: 31
12
-
13
- # Offense count: 2
14
- Metrics/CyclomaticComplexity:
15
- Max: 7
16
-
17
- # Offense count: 13
18
- # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
19
- # URISchemes: http, https
20
- Metrics/LineLength:
21
- Max: 283
22
-
23
- # Offense count: 1
24
- # Configuration parameters: CountKeywordArgs.
25
- Metrics/ParameterLists:
26
- Max: 6
27
-
28
- # Offense count: 1
29
- RSpec/DescribeClass:
30
- Exclude:
31
- - 'spec/trailblazer/operation/finder_spec.rb'
32
-
33
- # Offense count: 78
34
- # Configuration parameters: Max.
35
- RSpec/ExampleLength:
36
- Exclude:
37
- - 'spec/trailblazer/finder/adapters/active_record_spec.rb'
38
- - 'spec/trailblazer/finder/adapters/basic_spec.rb'
39
- - 'spec/trailblazer/finder/adapters/kaminari_spec.rb'
40
- - 'spec/trailblazer/finder/adapters/sequel_spec.rb'
41
- - 'spec/trailblazer/finder/adapters/will_paginate_spec.rb'
42
- - 'spec/trailblazer/finder/base_spec.rb'
43
- - 'spec/trailblazer/finder/dsl_spec.rb'
44
- - 'spec/trailblazer/finder/utils/string_spec.rb'
45
-
46
- # Offense count: 62
47
- # Configuration parameters: AggregateFailuresByDefault.
48
- RSpec/MultipleExpectations:
49
- Max: 7
50
-
51
- # Offense count: 2
52
- RSpec/RepeatedDescription:
53
- Exclude:
54
- - 'spec/trailblazer/finder/adapters/basic_spec.rb'
55
-
56
- # Offense count: 6
57
- # Cop supports --auto-correct.
58
- # Configuration parameters: AutoCorrect, EnforcedStyle.
59
- # SupportedStyles: nested, compact
60
- Style/ClassAndModuleChildren:
61
- Exclude:
62
- - 'spec/trailblazer/operation/finder_spec.rb'
63
-
64
- # Offense count: 1
65
- # Configuration parameters: SuspiciousParamNames.
66
- # SuspiciousParamNames: options, opts, args, params, parameters
67
- Style/OptionHash:
68
- Exclude:
69
- - 'lib/trailblazer/finder/dsl.rb'
70
-
71
- # Offense count: 3
72
- Style/Send:
73
- Exclude:
74
- - 'lib/trailblazer/finder/adapters/sequel/sorting.rb'
75
- - 'lib/trailblazer/operation/finder.rb'
76
-
77
- RSpec/DescribedClass:
78
- SkipBlocks: true
data/.travis.yml DELETED
@@ -1,7 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- before_install:
4
- - gem install bundler
5
- matrix:
6
- include:
7
- - rvm: 2.6.5
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Trailblazer
4
- class Finder
5
- module Activities
6
- # Adapters Activity
7
- class PrepareAdapters < Trailblazer::Activity::Railway
8
- def check_for_adapters(ctx, **)
9
- adapters = ctx.dig(:config, :adapters)
10
- return true if adapters.empty?
11
-
12
- adapters.each do |adapter|
13
- return true if Finder::Adapters.constants.include?(adapter.to_sym)
14
- end
15
- false
16
- end
17
-
18
- ## Only one ORM can be accepted
19
- def validate_adapters(ctx, **)
20
- adapters = ctx.dig(:config, :adapters)
21
- return true if adapters.empty?
22
-
23
- adapters.each do |adapter|
24
- if ORM_ADAPTERS.include?(adapter)
25
- return false if (adapters & (ORM_ADAPTERS - [adapter])).any?
26
- end
27
- end
28
- true
29
- end
30
-
31
- def invalid_adapters_error((ctx, flow_options), **_circuit_options)
32
- (ctx[:errors] ||= []) << {adapters: "One or more of the specified adapters are invalid"}
33
- end
34
-
35
- def multiple_orm_error((ctx, flow_options), **_circuit_options)
36
- (ctx[:errors] ||= []) << {adapters: "More then one ORM adapter specified"}
37
- end
38
-
39
- def set_adapters(ctx, **)
40
- adapters = ctx.dig(:config, :adapters)
41
- ctx[:adapters] = (ORM_ADAPTERS & adapters).any? ? adapters : ["Basic"] + adapters
42
- end
43
-
44
- step :check_for_adapters
45
- fail :invalid_adapters_error, Output(:success) => End(:failure)
46
- step :validate_adapters
47
- fail :multiple_orm_error
48
- step :set_adapters
49
- end
50
- end
51
- end
52
- end